diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c index b4de0a9..826648f 100644 --- a/src/bin/ephoto.c +++ b/src/bin/ephoto.c @@ -30,50 +30,50 @@ elm_main(int argc, char **argv) if (argc > 2) { - printf("Too Many Arguments!\n"); - _ephoto_display_usage(); - r = 1; - goto end; + printf("Too Many Arguments!\n"); + _ephoto_display_usage(); + r = 1; + goto end; } else if (argc < 2) { - Evas_Object *win = ephoto_window_add(NULL); + Evas_Object *win = ephoto_window_add(NULL); - if (!win) - { - r = 1; - goto end; - } + if (!win) + { + r = 1; + goto end; + } } else if (!strncmp(argv[1], "--help", 6)) { - _ephoto_display_usage(); - r = 0; - goto end; + _ephoto_display_usage(); + r = 0; + goto end; } else { - char *real = ecore_file_realpath(argv[1]); + char *real = ecore_file_realpath(argv[1]); - if (!real) - { - printf("invalid file or directory: '%s'\n", argv[1]); - r = 1; - goto end; - } - Evas_Object *win = ephoto_window_add(real); + if (!real) + { + printf("invalid file or directory: '%s'\n", argv[1]); + r = 1; + goto end; + } + Evas_Object *win = ephoto_window_add(real); - free(real); - if (!win) - { - r = 1; - goto end; - } + free(real); + if (!win) + { + r = 1; + goto end; + } } elm_run(); - end: +end: e_thumb_shutdown(); efreet_mime_shutdown(); eio_shutdown(); @@ -86,8 +86,8 @@ static void _ephoto_display_usage(void) { printf("Ephoto Usage: \n" "ephoto --help : This page\n" - "ephoto filename : Specifies a file to open\n" - "ephoto dirname : Specifies a directory to open\n"); + "ephoto filename : Specifies a file to open\n" + "ephoto dirname : Specifies a directory to open\n"); } ELM_MAIN() diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 8450a09..92af7a2 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -31,148 +31,148 @@ #if HAVE_GETTEXT && ENABLE_NLS # include -# define _(string) gettext (string) +# define _(string) gettext(string) #else -# define _(string) (string) +# define _(string) (string) # define ngettext(String1, String2, Var) Var == 1 ? String1 : String2 #endif # define USE_IPC /*local types*/ -typedef struct _Ephoto_Config Ephoto_Config; -typedef struct _Ephoto Ephoto; -typedef struct _Ephoto_Entry Ephoto_Entry; +typedef struct _Ephoto_Config Ephoto_Config; +typedef struct _Ephoto Ephoto; +typedef struct _Ephoto_Entry Ephoto_Entry; typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create; -typedef enum _Ephoto_State Ephoto_State; -typedef enum _Ephoto_Orient Ephoto_Orient; -typedef enum _Ephoto_Sort Ephoto_Sort; -typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain; +typedef enum _Ephoto_State Ephoto_State; +typedef enum _Ephoto_Orient Ephoto_Orient; +typedef enum _Ephoto_Sort Ephoto_Sort; +typedef enum _Ephoto_Ipc_Domain Ephoto_Ipc_Domain; /*main window functions*/ Evas_Object *ephoto_window_add(const char *path); -void ephoto_title_set(Ephoto *ephoto, const char *title); -void ephoto_thumb_size_set(Ephoto *ephoto, int size); +void ephoto_title_set(Ephoto *ephoto, const char *title); +void ephoto_thumb_size_set(Ephoto *ephoto, int size); Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, - Ephoto_Entry *entry); -void ephoto_directory_set(Ephoto *ephoto, const char *path, - Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only); -void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle); + Ephoto_Entry *entry); +void ephoto_directory_set(Ephoto *ephoto, const char *path, + Elm_Object_Item *expanded, Eina_Bool dirs_only, Eina_Bool thumbs_only); +void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle); /*config panel functions*/ -Eina_Bool ephoto_config_init(Ephoto *em); -void ephoto_config_save(Ephoto *em); -void ephoto_config_free(Ephoto *em); -void ephoto_config_main(Ephoto *em); +Eina_Bool ephoto_config_init(Ephoto *em); +void ephoto_config_save(Ephoto *em); +void ephoto_config_free(Ephoto *em); +void ephoto_config_main(Ephoto *em); /*single image functions*/ Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent); -void ephoto_single_browser_show_controls(Ephoto *ephoto); -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_focus_set(Ephoto *ephoto); -void ephoto_single_browser_path_pending_set(Evas_Object *obj, - const char *path); -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_image_data_update(Evas_Object *main, - Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h); -void ephoto_single_browser_image_data_done(Evas_Object *main, - unsigned int *image_data, Evas_Coord w, Evas_Coord h); -void ephoto_single_browser_cancel_editing(Evas_Object *main); -void ephoto_single_browser_slideshow(Evas_Object *obj); +void ephoto_single_browser_show_controls(Ephoto *ephoto); +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_focus_set(Ephoto *ephoto); +void ephoto_single_browser_path_pending_set(Evas_Object *obj, + const char *path); +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_image_data_update(Evas_Object *main, + Evas_Object *image, unsigned int *image_data, Evas_Coord w, Evas_Coord h); +void ephoto_single_browser_image_data_done(Evas_Object *main, + unsigned int *image_data, Evas_Coord w, Evas_Coord h); +void ephoto_single_browser_cancel_editing(Evas_Object *main); +void ephoto_single_browser_slideshow(Evas_Object *obj); /* smart callbacks called: "back" - the user wants to go back to the previous * screen. */ /*slideshow functions*/ Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent); -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_show_controls(Ephoto *ephoto); +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_show_controls(Ephoto *ephoto); /* smart callbacks called: "back" - the user wants to go back to the previous * screen. */ /*thumbnail browser functions*/ Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent); -void ephoto_thumb_browser_show_controls(Ephoto *ephoto); -void ephoto_thumb_browser_insert(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_info_label(Ephoto *ephoto); -void ephoto_thumb_browser_slideshow(Evas_Object *obj); -void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item); -void ephoto_thumb_browser_clear(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_show_controls(Ephoto *ephoto); +void ephoto_thumb_browser_insert(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_info_label(Ephoto *ephoto); +void ephoto_thumb_browser_slideshow(Evas_Object *obj); +void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item); +void ephoto_thumb_browser_clear(Ephoto *ephoto); +void ephoto_thumb_browser_recalc(Ephoto *ephoto); +void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only); /* smart callbacks called: "selected" - an item in the thumb browser is * selected. The selected Ephoto_Entry is passed as event_info argument. */ /*directory browser functions*/ Evas_Object *ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent); -void ephoto_directory_browser_initialize_structure(Ephoto *ephoto); -void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir); -void ephoto_directory_browser_clear(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_clear(Ephoto *ephoto); /*thumbnailing functions taken from enlightenment*/ -int e_thumb_init(void); -int e_thumb_shutdown(void); +int e_thumb_init(void); +int e_thumb_shutdown(void); 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_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); -void e_thumb_icon_begin(Evas_Object *obj); -void e_thumb_icon_end(Evas_Object *obj); -void e_thumb_icon_rethumb(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_del(Ecore_Ipc_Event_Client_Del *e); -int e_ipc_init(void); -int e_ipc_shutdown(void); +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_begin(Evas_Object *obj); +void e_thumb_icon_end(Evas_Object *obj); +void e_thumb_icon_rethumb(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_del(Ecore_Ipc_Event_Client_Del *e); +int e_ipc_init(void); +int e_ipc_shutdown(void); /*editing functions*/ Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, - const char *data_name, void *data); -void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent); -void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image_parent, Evas_Object *image); -void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image); -void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image); -void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image); -void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image); -void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, - Evas_Object *image, const char *file); -void ephoto_filter_blur(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_black_and_white(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_posterize(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_edge(Ephoto *ephoto, Evas_Object *image); -void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image); -void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image); + const char *data_name, void *data); +void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent); +void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image_parent, Evas_Object *image); +void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image); +void ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image); +void ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image); +void ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image); +void ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, + Evas_Object *image, const char *file); +void ephoto_filter_blur(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_black_and_white(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_posterize(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_edge(Ephoto *ephoto, Evas_Object *image); +void ephoto_filter_emboss(Ephoto *ephoto, Evas_Object *image); +void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image); /*file functions*/ -void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry, - Evas_Object *image); -void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry, - Evas_Object *image); -void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry); -void ephoto_file_new_dir(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_copy(Ephoto *ephoto, Eina_List *files, const char *path); -void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, - const char *path); -void ephoto_file_delete(Ephoto *ephoto, Eina_List *files, - Eina_File_Type type); -void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files); +void ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry, + Evas_Object *image); +void ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry, + Evas_Object *image); +void ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry); +void ephoto_file_new_dir(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_copy(Ephoto *ephoto, Eina_List *files, const char *path); +void ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, + const char *path); +void ephoto_file_delete(Ephoto *ephoto, Eina_List *files, + Eina_File_Type type); +void ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files); /*data types and structures*/ @@ -211,25 +211,25 @@ enum _Ephoto_Ipc_Domain struct _Ephoto_Config { - int config_version; - int thumb_size; - int thumb_gen_size; - int window_width; - int window_height; - double slideshow_timeout; - double left_size; - double right_size; - const char *directory; - const char *slideshow_transition; - const char *open; - Eina_Bool fsel_hide; - Eina_Bool prompts; - Eina_Bool drop; - Eina_Bool movess; - Eina_Bool smooth; - Eina_Bool firstrun; - Eina_Bool folders; - Eina_Bool thumbnail_aspect; + int config_version; + int thumb_size; + int thumb_gen_size; + int window_width; + int window_height; + double slideshow_timeout; + double left_size; + double right_size; + const char *directory; + const char *slideshow_transition; + const char *open; + Eina_Bool fsel_hide; + Eina_Bool prompts; + Eina_Bool drop; + Eina_Bool movess; + Eina_Bool smooth; + Eina_Bool firstrun; + Eina_Bool folders; + Eina_Bool thumbnail_aspect; Evas_Object *slide_time; Evas_Object *slide_trans; Evas_Object *open_dir; @@ -245,47 +245,47 @@ struct _Ephoto_Config struct _Ephoto { - Evas_Object *win; - Evas_Object *main; - Evas_Object *layout; - Evas_Object *pager; - Evas_Object *statusbar; - Evas_Object *folders_button; - Evas_Object *folders_icon; - Evas_Object *view_button; - Evas_Object *controls_left; - Evas_Object *controls_right; - Evas_Object *infolabel; - Evas_Object *exit; + Evas_Object *win; + Evas_Object *main; + Evas_Object *layout; + Evas_Object *pager; + Evas_Object *statusbar; + Evas_Object *folders_button; + Evas_Object *folders_icon; + Evas_Object *view_button; + Evas_Object *controls_left; + Evas_Object *controls_right; + Evas_Object *infolabel; + Evas_Object *exit; - Evas_Object *thumb_browser; - Evas_Object *single_browser; - Evas_Object *slideshow; - Evas_Object *dir_browser; - Evas_Object *file_popup; + Evas_Object *thumb_browser; + Evas_Object *single_browser; + Evas_Object *slideshow; + Evas_Object *dir_browser; + Evas_Object *file_popup; - Eina_Bool folders_toggle; - Eina_List *entries; - Eina_List *selentries; - Eina_List *searchentries; - Eina_List *thumbs; + Eina_Bool folders_toggle; + Eina_List *entries; + Eina_List *selentries; + Eina_List *searchentries; + Eina_List *thumbs; - Eio_Monitor *monitor; - Eina_List *monitor_handlers; - Eina_List *file_pos; - Eina_List *upload_handlers; - Ecore_Thread *file_thread; + Eio_Monitor *monitor; + Eina_List *monitor_handlers; + Eina_List *file_pos; + Eina_List *upload_handlers; + Ecore_Thread *file_thread; Ecore_Con_Url *url_up; - char *url_ret; - char *upload_error; - int file_errors; + char *url_ret; + char *upload_error; + int file_errors; - const char *top_directory; - const char *config_path; - const char *trash_path; - const char *destination; + const char *top_directory; + const char *config_path; + const char *trash_path; + const char *destination; - int thumb_gen_size; + int thumb_gen_size; struct { @@ -296,34 +296,34 @@ struct _Ephoto Ecore_Job *change_dir; } job; - Eio_File *ls; + Eio_File *ls; - Evas_Object *prefs_win; - Ephoto_State state, prev_state; + Evas_Object *prefs_win; + Ephoto_State state, prev_state; Ephoto_Config *config; - Ephoto_Sort sort; + Ephoto_Sort sort; }; struct _Ephoto_Entry { - const char *path; - const char *basename; - const char *label; - const char *sort_id; - double size; - Ephoto *ephoto; - Eio_Monitor *monitor; - Eina_List *monitor_handlers; + const char *path; + const char *basename; + const char *label; + const char *sort_id; + double size; + Ephoto *ephoto; + Eio_Monitor *monitor; + Eina_List *monitor_handlers; Elm_Object_Item *item; Elm_Object_Item *parent; - Eina_List *free_listeners; - Eina_Bool is_dir; - Eina_Bool is_link; - Eina_Bool no_delete; - Evas_Object *genlist; - Evas_Object *gengrid; - Evas_Object *thumb; + Eina_List *free_listeners; + Eina_Bool is_dir; + Eina_Bool is_link; + Eina_Bool no_delete; + Evas_Object *genlist; + Evas_Object *gengrid; + Evas_Object *thumb; }; struct _Ephoto_Event_Entry_Create @@ -333,15 +333,15 @@ struct _Ephoto_Event_Entry_Create /*ephoto file functions*/ Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, - const char *label, Eina_File_Type type); -Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path); -void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry); -void ephoto_entry_free_listener_add(Ephoto_Entry *entry, - void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); -void ephoto_entry_free_listener_del(Ephoto_Entry *entry, - void (*cb) (void *data, const Ephoto_Entry *entry), const void *data); -void ephoto_entries_free(Ephoto *ephoto); -int ephoto_entries_cmp(const void *pa, const void *pb); + const char *label, Eina_File_Type type); +Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path); +void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry); +void ephoto_entry_free_listener_add(Ephoto_Entry *entry, + void (*cb)(void *data, const Ephoto_Entry *entry), const void *data); +void ephoto_entry_free_listener_del(Ephoto_Entry *entry, + void (*cb)(void *data, const Ephoto_Entry *entry), const void *data); +void ephoto_entries_free(Ephoto *ephoto); +int ephoto_entries_cmp(const void *pa, const void *pb); /*check if image can be loaded*/ 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; if (bname[0] == '.') - return EINA_FALSE; + return EINA_FALSE; if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN) && (info->type != EINA_FILE_LNK)) - return EINA_FALSE; + return EINA_FALSE; type = strrchr(bname, '.'); if (!type) - return EINA_FALSE; + return EINA_FALSE; count = sizeof(filters) / sizeof(filters[0]); for (i = 0; i < count; i++) { - if (!strcasecmp(type + 1, filters[i])) - return evas_object_image_extension_can_load_get(bname); + if (!strcasecmp(type + 1, filters[i])) + return evas_object_image_extension_can_load_get(bname); } return EINA_FALSE; } @@ -393,7 +393,7 @@ _ephoto_file_image_can_save(const char *ext) for (i = 0; i < count; i++) { if (!strcasecmp(ext, filters[i])) - return EINA_TRUE; + return EINA_TRUE; } return EINA_FALSE; } @@ -408,7 +408,7 @@ ephoto_normalize_color(int color) static inline int 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 @@ -427,15 +427,14 @@ extern int EPHOTO_EVENT_EDITOR_APPLY; extern int EPHOTO_EVENT_EDITOR_CANCEL; extern int EPHOTO_EVENT_EDITOR_BACK; - -#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__) -#define ERR(...) EINA_LOG_ERR(__VA_ARGS__) -#define WRN(...) EINA_LOG_WARN(__VA_ARGS__) -#define INF(...) EINA_LOG_INFO(__VA_ARGS__) -#define DBG(...) EINA_LOG_DBG(__VA_ARGS__) +#define CRIT(...) EINA_LOG_CRIT(__VA_ARGS__) +#define ERR(...) EINA_LOG_ERR(__VA_ARGS__) +#define WRN(...) EINA_LOG_WARN(__VA_ARGS__) +#define INF(...) EINA_LOG_INFO(__VA_ARGS__) +#define DBG(...) EINA_LOG_DBG(__VA_ARGS__) #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_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 diff --git a/src/bin/ephoto_bcg.c b/src/bin/ephoto_bcg.c index 4bd0815..9c4fa11 100644 --- a/src/bin/ephoto_bcg.c +++ b/src/bin/ephoto_bcg.c @@ -3,24 +3,24 @@ typedef struct _Ephoto_BCG Ephoto_BCG; struct _Ephoto_BCG { - Evas_Object *main; - Evas_Object *parent; - Evas_Object *image; - Evas_Object *editor; - Evas_Object *bslider; - Evas_Object *cslider; - Evas_Object *gslider; - Eina_List *handlers; - int contrast; - int brightness; - double gamma; - Evas_Coord w, h; + Evas_Object *main; + Evas_Object *parent; + Evas_Object *image; + Evas_Object *editor; + Evas_Object *bslider; + Evas_Object *cslider; + Evas_Object *gslider; + Eina_List *handlers; + int contrast; + int brightness; + double gamma; + Evas_Coord w, h; unsigned int *original_im_data; }; unsigned int * _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; 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); 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 - memcpy(im_data, ebcg->original_im_data, - sizeof(unsigned int) * ebcg->w * ebcg->h); + memcpy(im_data, ebcg->original_im_data, + sizeof(unsigned int) * ebcg->w * ebcg->h); ebcg->brightness = brightness; im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); for (y = 0; y < ebcg->h; y++) { - p1 = im_data + (y * ebcg->w); - p2 = im_data_new + (y * ebcg->w); - for (x = 0; x < ebcg->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - bb = (int) b + ebcg->brightness; - gg = (int) g + ebcg->brightness; - rr = (int) r + ebcg->brightness; - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ebcg->w); + p2 = im_data_new + (y * ebcg->w); + for (x = 0; x < ebcg->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + bb = (int)b + ebcg->brightness; + gg = (int)g + ebcg->brightness; + rr = (int)r + ebcg->brightness; + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } 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); return im_data_new; } unsigned int * _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; 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); 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 - memcpy(im_data, ebcg->original_im_data, - sizeof(unsigned int) * ebcg->w * ebcg->h); + memcpy(im_data, ebcg->original_im_data, + sizeof(unsigned int) * ebcg->w * ebcg->h); ebcg->contrast = contrast; top = ((255 + (contrast)) * 259); 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); for (y = 0; y < ebcg->h; y++) { - p1 = im_data + (y * ebcg->w); - p2 = im_data_new + (y * ebcg->w); - for (x = 0; x < ebcg->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - bb = (int) ((factor * (b - 128)) + 128); - gg = (int) ((factor * (g - 128)) + 128); - rr = (int) ((factor * (r - 128)) + 128); - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ebcg->w); + p2 = im_data_new + (y * ebcg->w); + for (x = 0; x < ebcg->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + bb = (int)((factor * (b - 128)) + 128); + gg = (int)((factor * (g - 128)) + 128); + rr = (int)((factor * (r - 128)) + 128); + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } 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); return im_data_new; } unsigned int * _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; 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); 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 - memcpy(im_data, ebcg->original_im_data, - sizeof(unsigned int) * ebcg->w * ebcg->h); + memcpy(im_data, ebcg->original_im_data, + sizeof(unsigned int) * ebcg->w * ebcg->h); ebcg->gamma = 1 / gamma; im_data_new = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); for (y = 0; y < ebcg->h; y++) { - p1 = im_data + (y * ebcg->w); - p2 = im_data_new + (y * ebcg->w); - for (x = 0; x < ebcg->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - bb = (int) (pow(((double) b / 255), ebcg->gamma) * 255); - gg = (int) (pow(((double) g / 255), ebcg->gamma) * 255); - rr = (int) (pow(((double) r / 255), ebcg->gamma) * 255); - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ebcg->w); + p2 = im_data_new + (y * ebcg->w); + for (x = 0; x < ebcg->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + bb = (int)(pow(((double)b / 255), ebcg->gamma) * 255); + gg = (int)(pow(((double)g / 255), ebcg->gamma) * 255); + rr = (int)(pow(((double)r / 255), ebcg->gamma) * 255); + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } 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); return im_data_new; } static void _brightness_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; int brightness; @@ -186,13 +186,13 @@ _brightness_slider_changed(void *data, Evas_Object *obj, brightness = elm_slider_value_get(obj); image_data = _ephoto_bcg_adjust_brightness(ebcg, brightness, NULL); 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); } static void _contrast_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; int contrast; @@ -201,13 +201,13 @@ _contrast_slider_changed(void *data, Evas_Object *obj, contrast = elm_slider_value_get(obj); image_data = _ephoto_bcg_adjust_contrast(ebcg, contrast, NULL); 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); } static void _gamma_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; double gamma; @@ -216,13 +216,13 @@ _gamma_slider_changed(void *data, Evas_Object *obj, gamma = elm_slider_value_get(obj); image_data = _ephoto_bcg_adjust_gamma(ebcg, gamma, NULL); 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); } static Eina_Bool _bcg_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; @@ -239,7 +239,7 @@ _bcg_reset(void *data, int type EINA_UNUSED, static Eina_Bool _bcg_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; unsigned int *image_data; @@ -254,7 +254,7 @@ _bcg_apply(void *data, int type EINA_UNUSED, else { 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); 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 _bcg_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_BCG *ebcg = data; @@ -284,7 +284,7 @@ _bcg_cancel(void *data, int type EINA_UNUSED, static void _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; 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->image = image; im_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, &ebcg->w, - &ebcg->h); + &ebcg->h); ebcg->original_im_data = malloc(sizeof(unsigned int) * ebcg->w * ebcg->h); 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", ebcg); + "ebcg", ebcg); evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del, - ebcg); + ebcg); slider = elm_slider_add(ebcg->editor); 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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _gamma_slider_changed, ebcg); + _gamma_slider_changed, ebcg); elm_box_pack_start(ebcg->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _contrast_slider_changed, ebcg); + _contrast_slider_changed, ebcg); elm_box_pack_start(ebcg->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _brightness_slider_changed, ebcg); + _brightness_slider_changed, ebcg); elm_box_pack_start(ebcg->editor, slider); evas_object_show(slider); ebcg->bslider = slider; ebcg->handlers = - eina_list_append(ebcg->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _bcg_reset, ebcg)); + eina_list_append(ebcg->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _bcg_reset, ebcg)); ebcg->handlers = - eina_list_append(ebcg->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _bcg_apply, ebcg)); + eina_list_append(ebcg->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _bcg_apply, ebcg)); ebcg->handlers = - eina_list_append(ebcg->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _bcg_cancel, ebcg)); + eina_list_append(ebcg->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _bcg_cancel, ebcg)); return; - error: +error: return; } + diff --git a/src/bin/ephoto_color.c b/src/bin/ephoto_color.c index 15d0465..36a0f20 100644 --- a/src/bin/ephoto_color.c +++ b/src/bin/ephoto_color.c @@ -3,18 +3,18 @@ typedef struct _Ephoto_Color Ephoto_Color; struct _Ephoto_Color { - Evas_Object *main; - Evas_Object *parent; - Evas_Object *image; - Evas_Object *editor; - Evas_Object *bslider; - Evas_Object *gslider; - Evas_Object *rslider; - Eina_List *handlers; - int blue; - int green; - int red; - Evas_Coord w, h; + Evas_Object *main; + Evas_Object *parent; + Evas_Object *image; + Evas_Object *editor; + Evas_Object *bslider; + Evas_Object *gslider; + Evas_Object *rslider; + Eina_List *handlers; + int blue; + int green; + int red; + Evas_Coord w, h; 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); 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 - memcpy(im_data, eco->original_im_data, - sizeof(unsigned int) * eco->w * eco->h); + memcpy(im_data, eco->original_im_data, + 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); for (x = 0; x < eco->w; x++) { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); b = ephoto_mul_color_alpha(b, a); g = ephoto_mul_color_alpha(g, a); r = ephoto_mul_color_alpha(r, a); switch (color) { - case EPHOTO_COLOR_ADJUST_RED: - eco->red = adjust; - cc = (int) r + eco->red; - r = cc; - break; - case EPHOTO_COLOR_ADJUST_BLUE: - eco->blue = adjust; - cc = (int) b + eco->blue; - b = cc; - break; - case EPHOTO_COLOR_ADJUST_GREEN: - eco->green = adjust; - cc = (int) g + eco->green; - g = cc; - break; - default: - break; + case EPHOTO_COLOR_ADJUST_RED: + eco->red = adjust; + cc = (int)r + eco->red; + r = cc; + break; + + case EPHOTO_COLOR_ADJUST_BLUE: + eco->blue = adjust; + cc = (int)b + eco->blue; + b = cc; + break; + + case EPHOTO_COLOR_ADJUST_GREEN: + eco->green = adjust; + cc = (int)g + eco->green; + g = cc; + break; + + default: + break; } b = ephoto_normalize_color(b); 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, - im_data_new, eco->w, eco->h); + im_data_new, eco->w, eco->h); free(im_data); return im_data_new; } @@ -107,7 +110,7 @@ _red_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) static void _green_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Color *eco = data; int green; @@ -121,7 +124,7 @@ _green_slider_changed(void *data, Evas_Object *obj, static void _blue_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Color *eco = data; int blue; @@ -135,7 +138,7 @@ _blue_slider_changed(void *data, Evas_Object *obj, static Eina_Bool _color_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Color *eco = data; @@ -152,7 +155,7 @@ _color_reset(void *data, int type EINA_UNUSED, static Eina_Bool _color_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Color *eco = data; unsigned int *image_data; @@ -167,7 +170,7 @@ _color_apply(void *data, int type EINA_UNUSED, else { 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); 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 _color_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Color *eco = data; @@ -197,7 +200,7 @@ _color_cancel(void *data, int type EINA_UNUSED, static void _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; 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->image = image; im_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, &eco->w, - &eco->h); + &eco->h); eco->original_im_data = malloc(sizeof(unsigned int) * eco->w * eco->h); 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", eco); + "eco", eco); evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del, - eco); + eco); slider = elm_slider_add(eco->editor); 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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _blue_slider_changed, eco); + _blue_slider_changed, eco); elm_box_pack_start(eco->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _green_slider_changed, eco); + _green_slider_changed, eco); elm_box_pack_start(eco->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _red_slider_changed, eco); + _red_slider_changed, eco); elm_box_pack_start(eco->editor, slider); evas_object_show(slider); eco->rslider = slider; eco->handlers = - eina_list_append(eco->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _color_reset, eco)); + eina_list_append(eco->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _color_reset, eco)); eco->handlers = - eina_list_append(eco->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _color_apply, eco)); + eina_list_append(eco->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _color_apply, eco)); eco->handlers = - eina_list_append(eco->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _color_cancel, eco)); + eina_list_append(eco->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _color_cancel, eco)); return; - error: +error: return; } + diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index 2781547..93f4ed8 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -2,14 +2,14 @@ #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 Eet_Data_Descriptor *edd = NULL; static void _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; 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); if (!strcmp(text, _("Root Directory"))) - path = "/"; + path = "/"; else if (!strcmp(text, _("Home Directory"))) - path = eina_environment_home_get(); + path = eina_environment_home_get(); else if (!strcmp(text, _("Last Open Directory"))) - path = "Last"; + path = "Last"; 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")) - eina_stringshare_replace(&ephoto->config->open, path); + eina_stringshare_replace(&ephoto->config->open, path); if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") && - ecore_file_exists(path)) + ecore_file_exists(path)) { char *rp = ecore_file_realpath(path); 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) - ephoto->config->slideshow_timeout = - elm_spinner_value_get(ephoto->config->slide_time); + ephoto->config->slideshow_timeout = + elm_spinner_value_get(ephoto->config->slide_time); if (elm_object_text_get(ephoto->config->slide_trans)) - eina_stringshare_replace(&ephoto->config->slideshow_transition, - elm_object_text_get(ephoto->config->slide_trans)); + eina_stringshare_replace(&ephoto->config->slideshow_transition, + elm_object_text_get(ephoto->config->slide_trans)); evas_object_del(popup); 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)); 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 - elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE); + elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE); } static void @@ -90,7 +90,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) check = elm_check_add(table); 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_table_pack(table, check, 0, 0, 1, 1); evas_object_show(check); @@ -156,13 +156,13 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) hoversel = elm_hoversel_add(table); elm_hoversel_hover_parent_set(hoversel, ephoto->win); 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, - _open_hv_select, ephoto); + _open_hv_select, ephoto); 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, - _open_hv_select, ephoto); + _open_hv_select, ephoto); elm_object_text_set(hoversel, ephoto->config->open); evas_object_data_set(hoversel, "ephoto", ephoto); 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_disabled_set(entry, EINA_TRUE); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); + ELM_SCROLLER_POLICY_OFF); EPHOTO_EXPAND(entry); EPHOTO_FILL(entry); 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 _spinner_changed(void *data EINA_UNUSED, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { double val; char buf[PATH_MAX]; @@ -281,13 +281,14 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) evas_object_show(label); transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get - (ephoto->slideshow), "transitions")); + (ephoto->slideshow), "transitions")); hoversel = elm_hoversel_add(table); elm_hoversel_hover_parent_set(hoversel, ephoto->win); EINA_LIST_FOREACH(transitions, l, - transition) elm_hoversel_item_add(hoversel, transition, NULL, 0, - _hv_select, transition); + transition) + elm_hoversel_item_add(hoversel, transition, NULL, 0, + _hv_select, transition); elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL); elm_object_text_set(hoversel, ephoto->config->slideshow_transition); EPHOTO_EXPAND(hoversel); @@ -297,8 +298,6 @@ _config_slideshow(Ephoto *ephoto, Evas_Object *parent) ephoto->config->slide_trans = hoversel; } - - static Evas_Object * _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 _link_anchor_bt(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { char buf[PATH_MAX]; Evas_Object *av = data; @@ -347,7 +346,7 @@ _link_anchor_bt(void *data, Evas_Object *obj, static void _copy_anchor_bt(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { char buf[PATH_MAX]; Evas_Object *av = data; @@ -356,7 +355,7 @@ _copy_anchor_bt(void *data, Evas_Object *obj, elm_entry_anchor_hover_end(av); snprintf(buf, PATH_MAX, "%s", link); elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, - buf, strlen(buf)); + buf, strlen(buf)); } 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_part_content_set(ei->hover, "middle", button); 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_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_part_content_set(ei->hover, "bottom", button); 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_show(button); } @@ -414,53 +413,53 @@ _config_bindings(Evas_Object *parent) EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); EPHOTO_FILL(entry); eina_strbuf_append_printf(sbuf, - _("General Bindings
" - "F1: Settings Panel
" - "F5: Start Slideshow
" - "F11: Toggle Fullscreen
" - "Ctrl+Shift+f: Toggle File Selector

" - "Thumbnail Browser Bindings
" - "Ctrl++: Zoom In
" - "Ctrl+-: Zoom Out
" - "Ctrl+Tab: View Image
" - "Ctrl+c: Copy Image
" - "Ctrl+x: Cut Image
" - "Ctrl+v: Paste Image
" - "Ctrl+a: Select All
" - "Ctrl+f: Toggle Search
" - "Ctrl+Delete: Delete Image
" - "F2: Rename Image
" - "Escape: Clear Selection

" - "Single Browser Bindings
" - "Ctrl+Shift+0: Zoom 1:1
" - "Ctrl++: Zoom In
" - "Ctrl+-: Zoom Out
" - "Ctrl+0: Zoom Fit
" - "Ctrl+Shift+l: Rotate Counter Clockwise
" - "Ctrl+l: Flip Horizontal
" - "Ctrl+Shift+r: Rotate Clockwise
" - "Ctrl+r: Flip Vertical
" - "Ctrl+Shift+s: Save Image As
" - "Ctrl+s: Save Image
" - "Ctrl+u: Reset Image
" - "Ctrl+y: Redo
" - "Ctrl+Shift+z: Redo
" - "Ctrl+z: Undo
" - "Home: Navigate First
" - "Left Arrow: Navigate Previous
" - "Right Arrow: Navigate Next
" - "Space: Navigate Next
" - "End: Navigate Last
" - "Ctrl+Delete: Delete Image
" - "F2 Rename Image
" - "Escape: Return to Thumbnail Browser

" - "Slideshow Bindings
" - "Space: Play/Pause Slideshow
" - "Home: Navigate First
" - "Left Arrow: Navigate Previous
" - "Right Arrow: Navigate Next
" - "End: Navigate Last
" - "Escape: Quit Slideshow
")); + _("General Bindings
" + "F1: Settings Panel
" + "F5: Start Slideshow
" + "F11: Toggle Fullscreen
" + "Ctrl+Shift+f: Toggle File Selector

" + "Thumbnail Browser Bindings
" + "Ctrl++: Zoom In
" + "Ctrl+-: Zoom Out
" + "Ctrl+Tab: View Image
" + "Ctrl+c: Copy Image
" + "Ctrl+x: Cut Image
" + "Ctrl+v: Paste Image
" + "Ctrl+a: Select All
" + "Ctrl+f: Toggle Search
" + "Ctrl+Delete: Delete Image
" + "F2: Rename Image
" + "Escape: Clear Selection

" + "Single Browser Bindings
" + "Ctrl+Shift+0: Zoom 1:1
" + "Ctrl++: Zoom In
" + "Ctrl+-: Zoom Out
" + "Ctrl+0: Zoom Fit
" + "Ctrl+Shift+l: Rotate Counter Clockwise
" + "Ctrl+l: Flip Horizontal
" + "Ctrl+Shift+r: Rotate Clockwise
" + "Ctrl+r: Flip Vertical
" + "Ctrl+Shift+s: Save Image As
" + "Ctrl+s: Save Image
" + "Ctrl+u: Reset Image
" + "Ctrl+y: Redo
" + "Ctrl+Shift+z: Redo
" + "Ctrl+z: Undo
" + "Home: Navigate First
" + "Left Arrow: Navigate Previous
" + "Right Arrow: Navigate Next
" + "Space: Navigate Next
" + "End: Navigate Last
" + "Ctrl+Delete: Delete Image
" + "F2 Rename Image
" + "Escape: Return to Thumbnail Browser

" + "Slideshow Bindings
" + "Space: Play/Pause Slideshow
" + "Home: Navigate First
" + "Left Arrow: Navigate Previous
" + "Right Arrow: Navigate Next
" + "End: Navigate Last
" + "Escape: Quit Slideshow
")); elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); elm_object_content_set(scroller, entry); evas_object_show(entry); @@ -523,63 +522,63 @@ _config_about(Evas_Object *parent) EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); EPHOTO_FILL(entry); eina_strbuf_append_printf(sbuf, - _("Ephoto is a comprehensive image viewer based on the EFL. For more" - "information, please visit the Ephoto project page:
" - "" - "http://www.smhouston.us/ephoto/

" - "Ephoto also has a page on the Enlightenment wiki:
" - "" - "https://phab.enlightenment.org/w/projects/ephoto

" - "Ephoto's source can be found through Enlightenment's git:
" - "" - "http://git.enlightenment.org/apps/ephoto.git

" - "Authors:
")); + _("Ephoto is a comprehensive image viewer based on the EFL. For more" + "information, please visit the Ephoto project page:
" + "" + "http://www.smhouston.us/ephoto/

" + "Ephoto also has a page on the Enlightenment wiki:
" + "" + "https://phab.enlightenment.org/w/projects/ephoto

" + "Ephoto's source can be found through Enlightenment's git:
" + "" + "http://git.enlightenment.org/apps/ephoto.git

" + "Authors:
")); f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r"); if (f) { - char buf[PATH_MAX]; + char buf[PATH_MAX]; - while (fgets(buf, sizeof(buf), f)) - { - int len; + while (fgets(buf, sizeof(buf), f)) + { + int len; - len = strlen(buf); - if (len > 0) - { - if (buf[len - 1] == '\n') - { - buf[len - 1] = 0; - len--; - } - if (len > 0) - { - char *p; + len = strlen(buf); + if (len > 0) + { + if (buf[len - 1] == '\n') + { + buf[len - 1] = 0; + len--; + } + if (len > 0) + { + char *p; - do - { - p = strchr(buf, '<'); - if (p) - *p = 0; - } - while (p); - do - { - p = strchr(buf, '>'); - if (p) - *p = 0; - } - while (p); - eina_strbuf_append_printf(sbuf, "%s
", buf); - } - if (len == 0) - eina_strbuf_append_printf(sbuf, "
"); - } - } - fclose(f); + do + { + p = strchr(buf, '<'); + if (p) + *p = 0; + } + while (p); + do + { + p = strchr(buf, '>'); + if (p) + *p = 0; + } + while (p); + eina_strbuf_append_printf(sbuf, "%s
", buf); + } + if (len == 0) + eina_strbuf_append_printf(sbuf, "
"); + } + } + fclose(f); } elm_object_text_set(entry, eina_strbuf_string_get(sbuf)); evas_object_smart_callback_add(entry, "anchor,hover,opened", - _link_anchor, entry); + _link_anchor, entry); elm_box_pack_end(box, entry); evas_object_show(entry); @@ -616,9 +615,9 @@ _ephoto_config_load(Ephoto *ephoto) ef = eet_open(buf, EET_FILE_MODE_READ); if (!ef) { - ephoto_config_free(ephoto); - ephoto->config = calloc(1, sizeof(Ephoto_Config)); - return 0; + ephoto_config_free(ephoto); + ephoto->config = calloc(1, sizeof(Ephoto_Config)); + return 0; } 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) { - ephoto_config_free(ephoto); - ephoto->config = calloc(1, sizeof(Ephoto_Config)); - return 0; + ephoto_config_free(ephoto); + ephoto->config = calloc(1, sizeof(Ephoto_Config)); + return 0; } if (ephoto->config->config_version < CONFIG_VERSION) { - ecore_file_unlink(buf); - ephoto_config_free(ephoto); - ephoto->config = calloc(1, sizeof(Ephoto_Config)); - return 0; + ecore_file_unlink(buf); + ephoto_config_free(ephoto); + ephoto->config = calloc(1, sizeof(Ephoto_Config)); + return 0; } return 1; } @@ -653,16 +652,16 @@ _ephoto_on_config_save(void *data) ef = eet_open(buf2, EET_FILE_MODE_WRITE); if (!ef) - goto save_end; + goto save_end; eet_data_write(ef, edd, "config", ephoto->config, 1); if (eet_close(ef)) - goto save_end; + goto save_end; if (!ecore_file_mv(buf2, buf)) - goto save_end; + goto save_end; - save_end: +save_end: ecore_file_unlink(buf2); return ECORE_CALLBACK_CANCEL; @@ -713,28 +712,28 @@ ephoto_config_main(Ephoto *ephoto) elm_icon_standard_set(ic, "preferences-system"); evas_object_show(ic); settingsi = elm_list_item_append(list, _("General"), ic, NULL, - _list_clicked, settings); + _list_clicked, settings); ic = elm_icon_add(list); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, "media-playback-start"); evas_object_show(ic); slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL, - _list_clicked, slideshow); + _list_clicked, slideshow); ic = elm_icon_add(list); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, "input-keyboard"); evas_object_show(ic); kbi = elm_list_item_append(list, _("Bindings"), ic, NULL, - _list_clicked, kb); + _list_clicked, kb); ic = elm_icon_add(list); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, "help-about"); evas_object_show(ic); abouti = elm_list_item_append(list, _("About"), ic, NULL, - _list_clicked, about); + _list_clicked, about); elm_list_go(list); @@ -776,13 +775,13 @@ ephoto_config_init(Ephoto *ephoto) Eet_Data_Descriptor_Class 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) - edd = eet_data_descriptor_stream_new(&eddc); + edd = eet_data_descriptor_stream_new(&eddc); #undef T #undef D @@ -812,28 +811,28 @@ ephoto_config_init(Ephoto *ephoto) C_VAL(D, T, thumbnail_aspect, EET_T_INT); switch (_ephoto_config_load(ephoto)) { - case 0: - /* Start a new config */ - ephoto->config->config_version = CONFIG_VERSION; - ephoto->config->slideshow_timeout = 4.0; - ephoto->config->slideshow_transition = eina_stringshare_add("fade"); - ephoto->config->window_width = 900*elm_config_scale_get(); - ephoto->config->window_height = 500*elm_config_scale_get(); - ephoto->config->fsel_hide = 0; - ephoto->config->left_size = .25; - ephoto->config->right_size = .25; - ephoto->config->open = eina_stringshare_add(eina_environment_home_get()); - ephoto->config->prompts = 1; - ephoto->config->drop = 0; - ephoto->config->movess = 1; - ephoto->config->smooth = 1; - ephoto->config->firstrun = 1; - ephoto->config->folders = 1; - ephoto->config->thumbnail_aspect = 0; - break; + case 0: + /* Start a new config */ + ephoto->config->config_version = CONFIG_VERSION; + ephoto->config->slideshow_timeout = 4.0; + ephoto->config->slideshow_transition = eina_stringshare_add("fade"); + ephoto->config->window_width = 900 * elm_config_scale_get(); + ephoto->config->window_height = 500 * elm_config_scale_get(); + ephoto->config->fsel_hide = 0; + ephoto->config->left_size = .25; + ephoto->config->right_size = .25; + ephoto->config->open = eina_stringshare_add(eina_environment_home_get()); + ephoto->config->prompts = 1; + ephoto->config->drop = 0; + ephoto->config->movess = 1; + ephoto->config->smooth = 1; + ephoto->config->firstrun = 1; + ephoto->config->folders = 1; + ephoto->config->thumbnail_aspect = 0; + break; - default: - return EINA_TRUE; + default: + return EINA_TRUE; } ephoto_config_save(ephoto); diff --git a/src/bin/ephoto_cropper.c b/src/bin/ephoto_cropper.c index e76df59..ddee2d5 100644 --- a/src/bin/ephoto_cropper.c +++ b/src/bin/ephoto_cropper.c @@ -13,17 +13,17 @@ struct _Ephoto_Cropper Evas_Object *layout; Evas_Object *cropw; Evas_Object *croph; - Eina_List *handlers; - Evas_Coord startx; - Evas_Coord starty; - Evas_Coord offsetx; - Evas_Coord offsety; - Eina_Bool resizing; + Eina_List *handlers; + Evas_Coord startx; + Evas_Coord starty; + Evas_Coord offsetx; + Evas_Coord offsety; + Eina_Bool resizing; }; static void _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; Edje_Message_Int_Set *msg; @@ -31,13 +31,13 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED, double scalew, scaleh; 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), - "ephoto.swallow.cropper", 0, 0, &cw, &ch); + "ephoto.swallow.cropper", 0, 0, &cw, &ch); evas_object_image_size_get(ec->image, &iw, &ih); - scalew = (double) cw / (double) w; - scaleh = (double) ch / (double) h; + scalew = (double)cw / (double)w; + scaleh = (double)ch / (double)h; nw = iw * scalew; nh = ih * scaleh; @@ -51,12 +51,12 @@ _calculate_cropper_size(void *data, Evas_Object *obj EINA_UNUSED, msg->val[1] = nw; msg->val[2] = nh; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + EDJE_MESSAGE_INT_SET, 1, msg); } static void _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Cropper *ec = data; 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); 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), - "ephoto.swallow.cropper", &cx, 0, &cw, 0); + "ephoto.swallow.cropper", &cx, 0, &cw, 0); evas_object_image_size_get(ec->image, &iw, 0); - scalew = (double) mw / (double) iw; + scalew = (double)mw / (double)iw; nw = lw * scalew; left = (nw - cw) / 2; @@ -78,13 +78,13 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, if ((cx + cw + right) >= (lx + lw)) { - right = (lx + lw) - (cx + cw); - left += left - right; + right = (lx + lw) - (cx + cw); + left += left - right; } else if ((cx - left) <= lx) { - left = cx - lx; - right += right - left; + left = cx - lx; + right += right - left; } left *= -1; @@ -94,7 +94,7 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, msgl->val[1] = left; msgl->val[2] = 0; 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->count = 3; @@ -102,12 +102,12 @@ _cropper_changed_width(void *data, Evas_Object *obj EINA_UNUSED, msgr->val[1] = right; msgr->val[2] = 0; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msgr); + EDJE_MESSAGE_INT_SET, 1, msgr); } static void _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Cropper *ec = data; 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); 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), - "ephoto.swallow.cropper", 0, &cy, 0, &ch); + "ephoto.swallow.cropper", 0, &cy, 0, &ch); evas_object_image_size_get(ec->image, 0, &ih); - scaleh = (double) mh / (double) ih; + scaleh = (double)mh / (double)ih; nh = lh * scaleh; top = (nh - ch) / 2; bottom = (nh - ch) / 2; if ((cy + ch + bottom) >= (ly + lh)) { - bottom = (ly + lh) - (cy + ch); - top += top - bottom; + bottom = (ly + lh) - (cy + ch); + top += top - bottom; } else if ((cy - top) <= ly) { - top = cy - ly; - bottom += bottom - top; + top = cy - ly; + bottom += bottom - top; } top *= -1; @@ -145,7 +145,7 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED, msgt->val[1] = 0; msgt->val[2] = top; 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->count = 3; @@ -153,12 +153,12 @@ _cropper_changed_height(void *data, Evas_Object *obj EINA_UNUSED, msgb->val[1] = 0; msgb->val[2] = bottom; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msgb); + EDJE_MESSAGE_INT_SET, 1, msgb); } static void _reset_crop(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Cropper *ec = data; Edje_Message_Int_Set *msg; @@ -169,12 +169,12 @@ _reset_crop(void *data, Evas_Object *obj EINA_UNUSED, msg->val[1] = 0; msg->val[2] = 0; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + EDJE_MESSAGE_INT_SET, 1, msg); } static void _apply_crop(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Cropper *ec = data; 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.cropper", &cx, &cy, &cw, - &ch); + &ch); evas_object_image_size_get(ec->image, &iw, &ih); 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; - scaley = (double) (cy-y) / (double) h; - scalew = (double) cw / (double) w; - scaleh = (double) ch / (double) h; + scalex = (double)(cx - x) / (double)w; + scaley = (double)(cy - y) / (double)h; + scalew = (double)cw / (double)w; + scaleh = (double)ch / (double)h; nx = iw * scalex; ny = ih * scaley; @@ -207,20 +207,20 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED, for (i = 0; i < nh; i++) { - tmpy = (i + ny) * iw; - for (j = 0; j < nw; j++) - { - tmpx = j + nx; - ind = tmpy + tmpx; - idata_new[index] = idata[ind]; - index++; - } + tmpy = (i + ny) * iw; + for (j = 0; j < nw; j++) + { + tmpx = j + nx; + ind = tmpy + tmpx; + idata_new[index] = idata[ind]; + index++; + } } elm_table_unpack(ec->image_parent, ec->box); elm_layout_content_unset(ec->layout, "ephoto.swallow.image"); elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1); 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->layout); evas_object_del(ec->box); @@ -229,7 +229,7 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED, static void _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Cropper *ec = data; @@ -245,7 +245,7 @@ _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED, static void _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; 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); if (mx < lx) - mx = lx; + mx = lx; else if (mx > lx + lw) - mx = lx + lw; + mx = lx + lw; if (my < ly) - my = ly; + my = ly; else if (my > ly + lh) - my = ly + lh; + my = ly + lh; nx = mx - ec->startx; 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->count = 3; if (!strcmp(source, "handle1")) - msg->val[0] = 1; + msg->val[0] = 1; else if (!strcmp(source, "handle3")) - msg->val[0] = 3; + msg->val[0] = 3; else if (!strcmp(source, "handle5")) - msg->val[0] = 5; + msg->val[0] = 5; else if (!strcmp(source, "handle7")) - msg->val[0] = 7; + msg->val[0] = 7; msg->val[1] = nx; msg->val[2] = ny; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + EDJE_MESSAGE_INT_SET, 1, msg); } static void _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; 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, - _cropper_both_mouse_up, ec); + _cropper_both_mouse_up, ec); ec->resizing = 0; } static void _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; Evas_Coord mx, my, cx, cy; @@ -315,14 +315,14 @@ _cropper_resize_both(void *data, Evas_Object *obj EINA_UNUSED, ec->starty = my; 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, - _cropper_both_mouse_up, ec); + _cropper_both_mouse_up, ec); } static void _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; 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); if (mx < lx) - mx = lx; + mx = lx; else if (mx > lx + lw) - mx = lx + lw; + mx = lx + lw; nx = mx - ec->startx; 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->count = 3; if (!strcmp(source, "handle4")) - msg->val[0] = 4; + msg->val[0] = 4; else if (!strcmp(source, "handle8")) - msg->val[0] = 8; + msg->val[0] = 8; msg->val[1] = nx; msg->val[2] = 0; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + EDJE_MESSAGE_INT_SET, 1, msg); } static void _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; 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, - _cropper_horiz_mouse_up, ec); + _cropper_horiz_mouse_up, ec); ec->resizing = 0; } static void _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; Evas_Coord mx, my, cx, cy; @@ -381,14 +381,14 @@ _cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED, ec->starty = my; 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, - _cropper_horiz_mouse_up, ec); + _cropper_horiz_mouse_up, ec); } static void _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; 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); if (my < ly) - my = ly; + my = ly; else if (my > ly + lh) - my = ly + lh; + my = ly + lh; ny = my - ec->starty; 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->count = 3; if (!strcmp(source, "handle2")) - msg->val[0] = 2; + msg->val[0] = 2; else if (!strcmp(source, "handle6")) - msg->val[0] = 6; + msg->val[0] = 6; msg->val[1] = 0; msg->val[2] = ny; edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + EDJE_MESSAGE_INT_SET, 1, msg); } static void _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; 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, - _cropper_vert_mouse_up, ec); + _cropper_vert_mouse_up, ec); ec->resizing = 0; } static void _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; Evas_Coord mx, my, cx, cy; @@ -447,66 +447,66 @@ _cropper_resize_vert(void *data, Evas_Object *obj EINA_UNUSED, ec->starty = my; 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, - _cropper_vert_mouse_up, ec); + _cropper_vert_mouse_up, ec); } static void _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; if (!ec->resizing) { - Edje_Message_Int_Set *msg; - Evas_Coord mx, my, cx, cy, cw, ch, nx, ny, lx, ly, lw, lh; + Edje_Message_Int_Set *msg; + 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), - &mx, &my); - evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch); - evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); + evas_pointer_canvas_xy_get(evas_object_evas_get(ec->cropper), + &mx, &my); + evas_object_geometry_get(ec->cropper, &cx, &cy, &cw, &ch); + evas_object_geometry_get(ec->layout, &lx, &ly, &lw, &lh); - if (mx < lx) - mx = lx; - else if (mx > lx + lw) - mx = lx + lw; - if (my < ly) - my = ly; - else if (my > ly + lh) - my = ly + lh; + if (mx < lx) + mx = lx; + else if (mx > lx + lw) + mx = lx + lw; + if (my < ly) + my = ly; + else if (my > ly + lh) + my = ly + lh; - nx = mx - ec->startx; - ny = my - ec->starty; - ec->startx = mx; - ec->starty = my; + nx = mx - ec->startx; + ny = my - ec->starty; + ec->startx = mx; + ec->starty = my; - msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); - msg->count = 3; - msg->val[0] = 0; - msg->val[1] = nx; - msg->val[2] = ny; - edje_object_message_send(elm_layout_edje_get(ec->layout), - EDJE_MESSAGE_INT_SET, 1, msg); + msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); + msg->count = 3; + msg->val[0] = 0; + msg->val[1] = nx; + msg->val[2] = ny; + edje_object_message_send(elm_layout_edje_get(ec->layout), + EDJE_MESSAGE_INT_SET, 1, msg); } } static void _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; 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", - _cropper_mouse_up, ec); + _cropper_mouse_up, ec); } static void _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; Evas_Coord mx, my, cx, cy; @@ -519,14 +519,14 @@ _cropper_move(void *data, Evas_Object *obj EINA_UNUSED, ec->offsety = my - cy; 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", - _cropper_mouse_up, ec); + _cropper_mouse_up, ec); } static void _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; 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) { - nw = sw; - nh = ih * ((double) sw / (double) iw); - if (nh > sh) - { - Evas_Coord onw, onh; + nw = sw; + nh = ih * ((double)sw / (double)iw); + if (nh > sh) + { + Evas_Coord onw, onh; - onw = nw; - onh = nh; - nh = sh; - nw = onw * ((double) nh / (double) onh); - } + onw = nw; + onh = nh; + nh = sh; + nw = onw * ((double)nh / (double)onh); + } } else { - nh = sh; - nw = iw * ((double) sh / (double) ih); - if (nw > sw) - { - Evas_Coord onw, onh; + nh = sh; + nw = iw * ((double)sh / (double)ih); + if (nw > sw) + { + Evas_Coord onw, onh; - onw = nw; - onh = nh; - nw = sw; - nh = onh * ((double) nw / (double) onw); - } + onw = nw; + onh = nh; + nw = sw; + nh = onh * ((double)nw / (double)onw); + } } diffw = sw - nw; 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[2] = 0; 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 _crop_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { _reset_crop(data, NULL, NULL); @@ -596,7 +596,7 @@ _crop_reset(void *data, int type EINA_UNUSED, static Eina_Bool _crop_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { _apply_crop(data, NULL, NULL); @@ -605,7 +605,7 @@ _crop_apply(void *data, int type EINA_UNUSED, static Eina_Bool _crop_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { _cancel_crop(data, NULL, NULL); @@ -614,7 +614,7 @@ _crop_cancel(void *data, int type EINA_UNUSED, static void _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; Ecore_Event_Handler *handler; @@ -627,7 +627,7 @@ _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 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) { Ephoto_Cropper *ec; 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); 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_FILL(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)); 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), - "cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size, - ec); + "cropper,changed", "ephoto.swallow.cropper", _calculate_cropper_size, + ec); elm_layout_content_set(ec->layout, "ephoto.swallow.cropper", ec->cropper); evas_object_show(ec->cropper); 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", - _cropper_resize_both, ec); + _cropper_resize_both, ec); 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", - _cropper_resize_both, ec); + _cropper_resize_both, ec); 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", - _cropper_resize_both, ec); + _cropper_resize_both, ec); 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", - _cropper_resize_both, ec); + _cropper_resize_both, ec); 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, - _image_resize, ec); + _image_resize, ec); ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"), - "ec", ec); + "ec", ec); evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL, - _editor_del, ec); + _editor_del, ec); ec->croph = elm_slider_add(ec->editor); 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); elm_box_pack_start(ec->editor, ec->croph); evas_object_smart_callback_add(ec->croph, "slider,drag,stop", - _cropper_changed_height, ec); + _cropper_changed_height, ec); evas_object_show(ec->croph); 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); elm_box_pack_start(ec->editor, ec->cropw); evas_object_smart_callback_add(ec->cropw, "slider,drag,stop", - _cropper_changed_width, ec); + _cropper_changed_width, ec); evas_object_show(ec->cropw); ec->handlers = - eina_list_append(ec->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _crop_reset, ec)); + eina_list_append(ec->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _crop_reset, ec)); ec->handlers = - eina_list_append(ec->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _crop_apply, ec)); + eina_list_append(ec->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _crop_apply, ec)); ec->handlers = - eina_list_append(ec->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _crop_cancel, ec)); + eina_list_append(ec->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _crop_cancel, ec)); return; - error: +error: return; } + diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c index aa8eaef..b7d8288 100644 --- a/src/bin/ephoto_directory_browser.c +++ b/src/bin/ephoto_directory_browser.c @@ -11,48 +11,48 @@ typedef struct _Ephoto_Directory_Browser Ephoto_Directory_Browser; struct _Ephoto_Directory_Browser { - Ephoto *ephoto; - Evas_Object *main; - Evas_Object *fsel; - Evas_Object *fsel_back; - Evas_Object *leftbox; + Ephoto *ephoto; + Evas_Object *main; + Evas_Object *fsel; + Evas_Object *fsel_back; + Evas_Object *leftbox; Elm_Object_Item *dir_current; Elm_Object_Item *last_sel; - Eio_File *ls; - Eina_Bool dirs_only; - Eina_Bool thumbs_only; - Eio_Monitor *monitor; - Eina_List *monitor_handlers; - Eina_List *handlers; - Eina_List *todo_items; - Ecore_Job *change_dir_job; - Ecore_Timer *click_timer; - Eina_Bool processing; - Eina_Bool initializing; + Eio_File *ls; + Eina_Bool dirs_only; + Eina_Bool thumbs_only; + Eio_Monitor *monitor; + Eina_List *monitor_handlers; + Eina_List *handlers; + Eina_List *todo_items; + Ecore_Job *change_dir_job; + Ecore_Timer *click_timer; + Eina_Bool processing; + Eina_Bool initializing; struct { Ecore_Animator *todo_items; - int count; - int processed; + int count; + int processed; } animator; - Eina_Bool main_deleted:1; - const char *back_directory; + Eina_Bool main_deleted : 1; + const char *back_directory; }; static Elm_Genlist_Item_Class *_ephoto_dir_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, - void *event); -static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info); + void *event); +static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info); /*File Pane Callbacks*/ static void _menu_dismissed_cb(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Directory_Browser *db = data; @@ -62,7 +62,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj, static void _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; Eina_List *paths = NULL; @@ -83,7 +83,7 @@ _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, static Eina_Bool _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) 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"); if (!ev->data) - return EINA_FALSE; + return EINA_FALSE; if (ev->len <= 0) - return EINA_FALSE; + return EINA_FALSE; if (!path) - return EINA_FALSE; + return EINA_FALSE; char *dd = strdup(ev->data); if (!dd) - return EINA_FALSE; + return EINA_FALSE; 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)) files = eina_list_append(files, s); - files = eina_list_append(files, s); - s = _drag_data_extract(&dd); + files = eina_list_append(files, s); + s = _drag_data_extract(&dd); } free(dd); @@ -128,7 +128,7 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, static Elm_Object_Item * _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; @@ -154,9 +154,9 @@ _drop_leave(void *data, Evas_Object *obj EINA_UNUSED) static void _drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED, - Elm_Object_Item *it, Evas_Coord x EINA_UNUSED, - Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, - int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) + Elm_Object_Item *it, Evas_Coord x EINA_UNUSED, + Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, + int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) { elm_genlist_item_selected_set(it, EINA_TRUE); } @@ -167,42 +167,42 @@ _drag_data_extract(char **drag_data) char *uri = NULL; if (!drag_data) - return uri; + return uri; char *p = *drag_data; if (!p) - return uri; + return uri; char *s = strstr(p, FILESEP); if (s) - p += FILESEP_LEN; + p += FILESEP_LEN; s = strchr(p, '\n'); uri = p; if (s) { - if (s - p > 0) - { - char *s1 = s - 1; + if (s - p > 0) + { + char *s1 = s - 1; - if (s1[0] == '\r') - s1[0] = '\0'; - else - { - char *s2 = s + 1; + if (s1[0] == '\r') + s1[0] = '\0'; + else + { + char *s2 = s + 1; - if (s2[0] == '\r') - { - s[0] = '\0'; - s++; - } + if (s2[0] == '\r') + { + s[0] = '\0'; + s++; + } else - s[0] = '\0'; - } - } + s[0] = '\0'; + } + } else - s[0] = '\0'; - s++; + s[0] = '\0'; + s++; } else p = NULL; @@ -224,7 +224,7 @@ _entry_cmp(const void *pa, const void *pb) static void _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Directory_Browser *db = data; Elm_Object_Item *it = event_info; @@ -241,7 +241,7 @@ _on_list_expand_req(void *data, Evas_Object *obj EINA_UNUSED, static void _on_list_contract_req(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Directory_Browser *db = data; 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->dirs_only = 0; 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); + db->ephoto->config->directory); } static void @@ -326,7 +326,7 @@ _dir_job(void *data) db->thumbs_only = 1; db->dirs_only = 0; 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); } @@ -342,7 +342,7 @@ _wait_job(void *data) static void _on_list_selected(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Directory_Browser *db = data; Elm_Object_Item *it = event_info; @@ -357,7 +357,7 @@ _on_list_selected(void *data, Evas_Object *obj EINA_UNUSED, static char * _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; @@ -366,12 +366,12 @@ _dir_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, static Evas_Object * _dir_item_icon_get(void *data, Evas_Object *obj, - const char *part) + const char *part) { Ephoto_Entry *entry = data; if (!strcmp(part, "elm.swallow.end")) - return NULL; + return NULL; Evas_Object *ic = elm_icon_add(obj); if (entry->item) @@ -428,7 +428,7 @@ _check_for_subdirs(Ephoto_Entry *entry) static void _trash_back(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Directory_Browser *db = data; @@ -441,13 +441,13 @@ _trash_back(void *data, Evas_Object *obj EINA_UNUSED, db->thumbs_only = 1; db->dirs_only = 0; 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); } static void _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; 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); EPHOTO_EXPAND(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", - _on_list_expand_req, db); + _on_list_expand_req, db); 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, "contracted", _on_list_contracted, - db); + db); 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); elm_box_pack_end(db->leftbox, db->fsel); evas_object_show(db->fsel); eina_stringshare_replace(&db->back_directory, - db->ephoto->config->directory); + db->ephoto->config->directory); 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->dirs_only = 0; 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_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 _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; 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 _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; 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 _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; 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 _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; 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 _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; Evas_Object *menu; @@ -635,7 +635,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, ecore_timer_del(db->click_timer); db->click_timer = NULL; 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) - return; - + return; if (item) 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); elm_menu_move(menu, x, y); 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"), - _fsel_menu_go_home, db->ephoto); + _fsel_menu_go_home, db->ephoto); if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path)) { elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"), - _fsel_menu_new_dir_cb, db); + _fsel_menu_new_dir_cb, db); } if (item) { elm_menu_item_add(menu, NULL, "edit", _("Rename"), - _fsel_menu_rename_cb, db); - elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"), - _fsel_menu_paste_cb, db); + _fsel_menu_rename_cb, db); + elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"), + _fsel_menu_paste_cb, db); } 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"), - _menu_empty_cb, db); + _menu_empty_cb, db); } if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path) && item) { 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"), - _dir_go_trash, db); + _dir_go_trash, db); } evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, - db); + db); 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); EPHOTO_EXPAND(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", - _on_list_expand_req, db); + _on_list_expand_req, db); 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, "contracted", _on_list_contracted, - db); + db); 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); elm_box_pack_end(db->leftbox, db->fsel); evas_object_show(db->fsel); elm_drop_item_container_add(db->fsel, ELM_SEL_FORMAT_TARGETS, - _drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db, - _drop_dropcb, NULL); + _drop_item_getcb, _drop_enter, db, _drop_leave, db, _drop_pos, db, + _drop_dropcb, NULL); } /*Ephoto Populating Functions*/ @@ -743,36 +742,36 @@ _monitor_add(Ephoto_Entry *e) e->monitor = eio_monitor_add(rp); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, + _monitor_cb, e)); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, + _monitor_cb, e)); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, + _monitor_cb, e)); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, + _monitor_cb, e)); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, + _monitor_cb, e)); e->monitor_handlers = - eina_list_append(e->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, - _monitor_cb, e)); + eina_list_append(e->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, + _monitor_cb, e)); free(rp); } static Eina_Bool _monitor_cb(void *data, int type, - void *event) + void *event) { Elm_Object_Item *item; Ephoto_Entry *entry = data; @@ -813,17 +812,17 @@ _monitor_cb(void *data, int type, ic = _ephoto_dir_class; snprintf(buf, PATH_MAX, "%s", ev->filename); e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf), - EINA_FILE_DIR); + EINA_FILE_DIR); e->genlist = entry->genlist; e->parent = entry->item; if (!_check_for_subdirs(e)) e->item = 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 e->item = 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) _monitor_add(e); } @@ -833,8 +832,8 @@ _monitor_cb(void *data, int type, ic = _ephoto_dir_tree_class; parent = - elm_genlist_item_insert_before(entry->genlist, ic, entry, - entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL); + elm_genlist_item_insert_before(entry->genlist, ic, entry, + entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, NULL); entry->no_delete = EINA_TRUE; elm_object_item_del(entry->item); entry->item = parent; @@ -865,8 +864,8 @@ _monitor_cb(void *data, int type, Elm_Object_Item *parent; ic = _ephoto_dir_class; parent = - elm_genlist_item_insert_before(entry->genlist, ic, entry, - entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_insert_before(entry->genlist, ic, entry, + entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL, NULL); entry->no_delete = EINA_TRUE; elm_object_item_del(entry->item); @@ -917,7 +916,7 @@ _monitor_cb(void *data, int type, static Eina_Bool _top_monitor_cb(void *data, int type, - void *event) + void *event) { Elm_Object_Item *item; Ephoto_Directory_Browser *db = data; @@ -951,12 +950,12 @@ _top_monitor_cb(void *data, int type, } snprintf(buf, PATH_MAX, "%s", ev->filename); e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf), - EINA_FILE_DIR); + EINA_FILE_DIR); e->genlist = db->fsel; ic = _ephoto_dir_class; e->item = - elm_genlist_item_append(db->fsel, ic, e, - NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_append(db->fsel, ic, e, + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); if (e->item) _monitor_add(e); free(rp); @@ -1018,53 +1017,53 @@ _todo_items_process(void *data) return EINA_TRUE; db->animator.todo_items = NULL; db->processing = 0; - return EINA_FALSE; + return EINA_FALSE; } 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->processing = 1; EINA_LIST_FREE(db->todo_items, entry) - { - i++; - if (i > TODO_ITEM_MIN_BATCH) - return EINA_TRUE; - if (entry->is_dir && !entry->item) - { - const Elm_Genlist_Item_Class *ic; - if (_check_for_subdirs(entry)) - { - ic = _ephoto_dir_tree_class; - entry->item = + { + i++; + if (i > TODO_ITEM_MIN_BATCH) + return EINA_TRUE; + if (entry->is_dir && !entry->item) + { + const Elm_Genlist_Item_Class *ic; + if (_check_for_subdirs(entry)) + { + ic = _ephoto_dir_tree_class; + entry->item = elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); - } - else - { - ic = _ephoto_dir_class; - entry->item = + entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, NULL, NULL); + } + else + { + ic = _ephoto_dir_class; + entry->item = elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); - } - if (!entry->item) - { - ephoto_entry_free(db->ephoto, entry); - } - else - { - _monitor_add(entry); - entry->genlist = db->fsel; - } - } - db->animator.processed++; - } + entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL); + } + if (!entry->item) + { + ephoto_entry_free(db->ephoto, entry); + } + else + { + _monitor_add(entry); + entry->genlist = db->fsel; + } + } + db->animator.processed++; + } return EINA_TRUE; } static Eina_Bool _ephoto_dir_populate_start(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Directory_Browser *db = data; @@ -1078,15 +1077,15 @@ _ephoto_dir_populate_start(void *data, int type EINA_UNUSED, static Eina_Bool _ephoto_dir_populate_end(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Directory_Browser *db = data; db->ls = NULL; if (db->main_deleted) { - free(db); - return ECORE_CALLBACK_PASS_ON; + free(db); + return ECORE_CALLBACK_PASS_ON; } db->dirs_only = 0; 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 _ephoto_dir_populate_error(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { 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); if (e->is_dir) { - db->todo_items = eina_list_append(db->todo_items, e); - db->animator.count++; + db->todo_items = eina_list_append(db->todo_items, e); + db->animator.count++; } 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++; } 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); 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*/ static void _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; Ecore_Event_Handler *handler; _todo_items_free(db); 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) { - ecore_animator_del(db->animator.todo_items); - db->animator.todo_items = NULL; + ecore_animator_del(db->animator.todo_items); + db->animator.todo_items = NULL; } if (db->ls) { - db->main_deleted = EINA_TRUE; - eio_file_cancel(db->ls); - return; + db->main_deleted = EINA_TRUE; + eio_file_cancel(db->ls); + return; } if (db->monitor) { @@ -1170,7 +1170,7 @@ void ephoto_directory_browser_clear(Ephoto *ephoto) { 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); } @@ -1179,7 +1179,7 @@ void ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir) { 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; 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); db->monitor = eio_monitor_add(rp); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, + _top_monitor_cb, db)); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, + _top_monitor_cb, db)); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, + _top_monitor_cb, db)); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, + _top_monitor_cb, db)); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, + _top_monitor_cb, db)); db->monitor_handlers = - eina_list_append(db->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, - _top_monitor_cb, db)); + eina_list_append(db->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, + _top_monitor_cb, db)); free(rp); } @@ -1225,7 +1225,7 @@ void ephoto_directory_browser_initialize_structure(Ephoto *ephoto) { 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; Elm_Object_Item *next = NULL, *cur = NULL; char path[PATH_MAX], *dir, *end_dir; @@ -1246,7 +1246,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) dir = ecore_file_dir_get(path); dirs = eina_list_prepend(dirs, strdup(dir)); memset(path, 0x00, sizeof(path)); - snprintf(path, PATH_MAX, "%s", dir); + snprintf(path, PATH_MAX, "%s", dir); } free(dir); dir = NULL; @@ -1276,7 +1276,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) if (strncmp(finfo->path + finfo->name_start, ".", 1)) { 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; if (entry->is_dir && !entry->item) { @@ -1285,17 +1285,17 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto) { ic = _ephoto_dir_tree_class; entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, - NULL, NULL); + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_TREE, _entry_cmp, + NULL, NULL); } else { ic = _ephoto_dir_class; entry->item = - elm_genlist_item_sorted_insert(db->fsel, ic, entry, - entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, - NULL, NULL); + elm_genlist_item_sorted_insert(db->fsel, ic, entry, + entry->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, + NULL, NULL); } if (!entry->item) { @@ -1370,36 +1370,37 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object *parent) db->main = box; 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, - _ephoto_main_del, db); + _ephoto_main_del, db); evas_object_data_set(db->main, "directory_browser", db); _ephoto_directory_view_add(db); db->handlers = - eina_list_append(db->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, - _ephoto_dir_populate_start, db)); + eina_list_append(db->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, + _ephoto_dir_populate_start, db)); db->handlers = - eina_list_append(db->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, - _ephoto_dir_populate_end, db)); + eina_list_append(db->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, + _ephoto_dir_populate_end, db)); db->handlers = - eina_list_append(db->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, - _ephoto_dir_populate_error, db)); + eina_list_append(db->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, + _ephoto_dir_populate_error, db)); db->handlers = - eina_list_append(db->handlers, - ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, - _ephoto_dir_entry_create, db)); + eina_list_append(db->handlers, + ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, + _ephoto_dir_entry_create, db)); return db->main; - - error: + +error: evas_object_del(db->main); return NULL; } + diff --git a/src/bin/ephoto_editor.c b/src/bin/ephoto_editor.c index 358fd3c..21a1f05 100644 --- a/src/bin/ephoto_editor.c +++ b/src/bin/ephoto_editor.c @@ -2,28 +2,28 @@ static void _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); } static void _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); } static void _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); } Evas_Object * 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; @@ -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_FILL(frame); evas_object_data_set(frame, data_name, data); - elm_box_pack_end(parent, frame); + elm_box_pack_end(parent, frame); evas_object_show(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); ic = elm_icon_add(box); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 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); ic = elm_icon_add(box); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 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); ic = elm_icon_add(box); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, "window-close"); diff --git a/src/bin/ephoto_file.c b/src/bin/ephoto_file.c index 84f9ddd..f83f5a4 100644 --- a/src/bin/ephoto_file.c +++ b/src/bin/ephoto_file.c @@ -2,7 +2,7 @@ static void _complete_ok(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -16,7 +16,6 @@ _complete(Ephoto *ephoto, const char *title, const char *text) { Evas_Object *popup, *box, *label, *ic, *button; - popup = elm_popup_add(ephoto->win); elm_object_part_text_set(popup, "title,text", title); elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER); @@ -52,7 +51,7 @@ _complete(Ephoto *ephoto, const char *title, const char *text) static void _prompt_cancel(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -91,7 +90,7 @@ _prompt(Ephoto *ephoto, const char *title, const char *text) static void _save_image_as_overwrite(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; const char *file = evas_object_data_get(popup, "file"); @@ -102,25 +101,25 @@ _save_image_as_overwrite(void *data, Evas_Object *obj EINA_UNUSED, if (ecore_file_exists(file)) { - success = ecore_file_unlink(file); - if (!success) - { - _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); - ephoto_single_browser_entry_set(ephoto->single_browser, entry); - evas_object_del(popup); + success = ecore_file_unlink(file); + if (!success) + { + _complete(ephoto, _("Save Failed"), + _("Error: Image could not be saved here!")); + ephoto_single_browser_entry_set(ephoto->single_browser, entry); + evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); - return; - } + return; + } } ephoto_single_browser_path_pending_set(ephoto->single_browser, file); success = - evas_object_image_save(image, file, - NULL, NULL); + evas_object_image_save(image, file, + NULL, NULL); if (!success) { _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); + _("Error: Image could not be saved here!")); ephoto_single_browser_path_pending_unset(ephoto->single_browser); } evas_object_del(popup); @@ -129,7 +128,7 @@ _save_image_as_overwrite(void *data, Evas_Object *obj EINA_UNUSED, static void _upload_entry_anchor_bt(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { char buf[PATH_MAX]; Evas_Object *av = data; @@ -155,13 +154,13 @@ _upload_entry_anchor(void *data, Evas_Object *obj, void *event_info) elm_object_text_set(button, _("Open Link In Browser")); elm_object_part_content_set(ei->hover, "middle", button); evas_object_smart_callback_add(button, "clicked", _upload_entry_anchor_bt, - av); + av); evas_object_show(button); } static void _upload_image_url_copy(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *entry = data; @@ -181,7 +180,7 @@ _upload_image_complete_cb(void *data, int ev_type EINA_UNUSED, void *event) int ret; if (ev->url_con != ephoto->url_up) - return ECORE_CALLBACK_RENEW; + return ECORE_CALLBACK_RENEW; evas_object_del(ppopup); elm_object_focus_set(ephoto->pager, EINA_TRUE); @@ -216,11 +215,11 @@ _upload_image_complete_cb(void *data, int ev_type EINA_UNUSED, void *event) elm_entry_scrollable_set(entry, EINA_TRUE); elm_entry_context_menu_disabled_set(entry, EINA_TRUE); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); + ELM_SCROLLER_POLICY_OFF); EPHOTO_EXPAND(entry); EPHOTO_FILL(entry); evas_object_smart_callback_add(entry, "anchor,hover,opened", - _upload_entry_anchor, entry); + _upload_entry_anchor, entry); elm_box_pack_end(hbox, entry); evas_object_show(entry); @@ -233,7 +232,7 @@ _upload_image_complete_cb(void *data, int ev_type EINA_UNUSED, void *event) if (!ret) elm_object_text_set(button, _("Copy")); evas_object_smart_callback_add(button, "clicked", _upload_image_url_copy, - entry); + entry); elm_box_pack_end(hbox, button); evas_object_show(button); @@ -245,7 +244,7 @@ _upload_image_complete_cb(void *data, int ev_type EINA_UNUSED, void *event) elm_object_text_set(button, _("Ok")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); @@ -254,58 +253,59 @@ _upload_image_complete_cb(void *data, int ev_type EINA_UNUSED, void *event) evas_object_show(popup); EINA_LIST_FREE(ephoto->upload_handlers, - handler) ecore_event_handler_del(handler); + handler) + ecore_event_handler_del(handler); if (!ephoto->url_ret || ev->status != 200) { - elm_object_text_set(label, - _("There was an error uploading your image!")); - elm_entry_single_line_set(entry, EINA_TRUE); - elm_object_text_set(entry, ephoto->upload_error); - evas_object_show(popup); - ecore_con_url_free(ephoto->url_up); - ephoto->url_up = NULL; - free(ephoto->upload_error); - ephoto->upload_error = NULL; - return EINA_FALSE; + elm_object_text_set(label, + _("There was an error uploading your image!")); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_object_text_set(entry, ephoto->upload_error); + evas_object_show(popup); + ecore_con_url_free(ephoto->url_up); + ephoto->url_up = NULL; + free(ephoto->upload_error); + ephoto->upload_error = NULL; + return EINA_FALSE; } else { - char buf[PATH_MAX], link[PATH_MAX]; + char buf[PATH_MAX], link[PATH_MAX]; - snprintf(buf, PATH_MAX, "%s", - ephoto->url_ret, ephoto->url_ret); - snprintf(link, PATH_MAX, "%s", ephoto->url_ret); - evas_object_data_set(entry, "link", strdup(link)); - elm_object_text_set(label, - _("Your image was uploaded to the following link:")); - elm_entry_single_line_set(entry, EINA_TRUE); - elm_object_text_set(entry, buf); - evas_object_show(popup); - ecore_con_url_free(ephoto->url_up); - ephoto->url_up = NULL; - free(ephoto->url_ret); - ephoto->url_ret = NULL; - return ECORE_CALLBACK_RENEW; + snprintf(buf, PATH_MAX, "%s", + ephoto->url_ret, ephoto->url_ret); + snprintf(link, PATH_MAX, "%s", ephoto->url_ret); + evas_object_data_set(entry, "link", strdup(link)); + elm_object_text_set(label, + _("Your image was uploaded to the following link:")); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_object_text_set(entry, buf); + evas_object_show(popup); + ecore_con_url_free(ephoto->url_up); + ephoto->url_up = NULL; + free(ephoto->url_ret); + ephoto->url_ret = NULL; + return ECORE_CALLBACK_RENEW; } } static Eina_Bool _upload_image_xml_parse(void *data, Eina_Simple_XML_Type type, - const char *content, unsigned offset EINA_UNUSED, - unsigned length EINA_UNUSED) + const char *content, unsigned offset EINA_UNUSED, + unsigned length EINA_UNUSED) { Ephoto *ephoto = data; char *linkf, *linkl; if (type == EINA_SIMPLE_XML_OPEN) { - if (!strncmp("link>", content, strlen("link>"))) - { - linkf = strchr(content, '>') + 1; - linkl = strtok(linkf, "<"); - ephoto->url_ret = strdup(linkl); - } + if (!strncmp("link>", content, strlen("link>"))) + { + linkf = strchr(content, '>') + 1; + linkl = strtok(linkf, "<"); + ephoto->url_ret = strdup(linkl); + } } return EINA_TRUE; } @@ -315,21 +315,21 @@ _upload_image_cb(void *data, int ev_type EINA_UNUSED, void *event) { Ephoto *ephoto = data; Ecore_Con_Event_Url_Data *ev = event; - const char *string = (const char *) ev->data; + const char *string = (const char *)ev->data; if (ev->url_con != ephoto->url_up) - return EINA_TRUE; + return EINA_TRUE; eina_simple_xml_parse(string, strlen(string) + 1, EINA_TRUE, - _upload_image_xml_parse, ephoto); + _upload_image_xml_parse, ephoto); if (!ephoto->url_ret) - ephoto->upload_error = strdup(string); + ephoto->upload_error = strdup(string); return EINA_FALSE; } static void _new_dir_confirm(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Evas_Object *popup = data; Evas_Object *entry = evas_object_data_get(popup, "entry"); @@ -344,7 +344,7 @@ _new_dir_confirm(void *data, Evas_Object *obj EINA_UNUSED, if (!ret) { _complete(ephoto, _("Error"), - _("There was an error creating this directory.")); + _("There was an error creating this directory.")); } evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); @@ -352,7 +352,7 @@ _new_dir_confirm(void *data, Evas_Object *obj EINA_UNUSED, static void _new_dir_cancel(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -385,7 +385,7 @@ _new_dir(Ephoto *ephoto, const char *file) elm_object_text_set(entry, _("New Directory")); elm_entry_select_all(entry); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); + ELM_SCROLLER_POLICY_OFF); EPHOTO_EXPAND(entry); EPHOTO_FILL(entry); elm_box_pack_end(box, entry); @@ -420,7 +420,7 @@ _new_dir(Ephoto *ephoto, const char *file) static void _rename_confirm(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Evas_Object *popup = data; Evas_Object *entry = evas_object_data_get(popup, "entry"); @@ -433,31 +433,31 @@ _rename_confirm(void *data, Evas_Object *obj EINA_UNUSED, if (!escaped) { - evas_object_del(popup); + evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); - return; + return; } snprintf(dir, PATH_MAX, "%s", file); if (ecore_file_is_dir(file)) snprintf(new_file_name, PATH_MAX, "%s/%s", ecore_file_dir_get(dir), text); else snprintf(new_file_name, PATH_MAX, "%s/%s.%s", ecore_file_dir_get(dir), escaped, - strrchr(dir, '.')+1); + strrchr(dir, '.') + 1); ret = ecore_file_mv(file, new_file_name); if (!ret) { if (ecore_file_is_dir(new_file_name)) _complete(ephoto, _("Error"), - _("There was an error renaming this directory.")); + _("There was an error renaming this directory.")); else _complete(ephoto, _("Error"), - _("There was an error renaming this file.")); + _("There was an error renaming this file.")); } else { if (ephoto->state == EPHOTO_STATE_SINGLE) ephoto_single_browser_path_pending_set(ephoto->single_browser, - new_file_name); + new_file_name); } evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); @@ -466,7 +466,7 @@ _rename_confirm(void *data, Evas_Object *obj EINA_UNUSED, static void _rename_cancel(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -481,7 +481,6 @@ _rename_file(Ephoto *ephoto, const char *file) Evas_Object *popup, *box, *entry, *button, *ic; char buf[PATH_MAX], *bn, *string; - popup = elm_popup_add(ephoto->win); if (ecore_file_is_dir(file)) elm_object_part_text_set(popup, "title, text", _("Rename Directory")); @@ -508,7 +507,7 @@ _rename_file(Ephoto *ephoto, const char *file) elm_object_text_set(entry, string); elm_entry_select_all(entry); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); + ELM_SCROLLER_POLICY_OFF); EPHOTO_EXPAND(entry); EPHOTO_FILL(entry); elm_box_pack_end(box, entry); @@ -588,8 +587,8 @@ _thread_end_cb(void *data, Ecore_Thread *et EINA_UNUSED) if (ephoto->file_errors > 0) { snprintf(msg, PATH_MAX, "%s %d %s.", - _("There was an error completing your action on"), ephoto->file_errors, - ngettext("file", "files", ephoto->file_errors)); + _("There was an error completing your action on"), ephoto->file_errors, + ngettext("file", "files", ephoto->file_errors)); _complete(ephoto, _("Error"), msg); } ephoto->file_pos = NULL; @@ -608,50 +607,50 @@ _move_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) const char *file; if (!ephoto->file_pos) - ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); + ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); EINA_LIST_FREE(ephoto->file_pos, file) { - if (!file) - break; - if (ecore_file_exists(file) && ecore_file_is_dir(destination) && - evas_object_image_extension_can_load_get(file)) - { - char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; - int ret; + if (!file) + break; + if (ecore_file_exists(file) && ecore_file_is_dir(destination) && + evas_object_image_extension_can_load_get(file)) + { + char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; + int ret; - snprintf(fp, PATH_MAX, "%s", file); - snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); - if (ecore_file_exists(dest)) - { - snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, - basename(fp)); - if (ecore_file_exists(extra)) - { - int count; + snprintf(fp, PATH_MAX, "%s", file); + snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); + if (ecore_file_exists(dest)) + { + snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, + basename(fp)); + if (ecore_file_exists(extra)) + { + int count; - for (count = 2; ecore_file_exists(extra); count++) - { - memset(extra, 0, sizeof(extra)); - snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", - destination, count, basename(fp)); - } - } - ret = ecore_file_mv(file, extra); - } + for (count = 2; ecore_file_exists(extra); count++) + { + memset(extra, 0, sizeof(extra)); + snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", + destination, count, basename(fp)); + } + } + ret = ecore_file_mv(file, extra); + } else ret = ecore_file_mv(file, dest); - if (!ret) + if (!ret) ephoto->file_errors++; - } + } } } static void _move_files(Ephoto *ephoto, Eina_List *files, - const char *destination) + const char *destination) { Evas_Object *popup = _processing(ephoto, _("Moving Files"), - _("Please wait while your files are moved.")); + _("Please wait while your files are moved.")); ephoto->file_popup = popup; ephoto->destination = destination; @@ -661,7 +660,7 @@ _move_files(Ephoto *ephoto, Eina_List *files, if (eina_list_count(files)) eina_list_free(files); ephoto->file_thread = ecore_thread_run(_move_thread_cb, - _thread_end_cb, _thread_end_cb, ephoto); + _thread_end_cb, _thread_end_cb, ephoto); } static void @@ -672,48 +671,48 @@ _copy_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) const char *file; if (!ephoto->file_pos) - ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); + ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); EINA_LIST_FREE(ephoto->file_pos, file) { if (ecore_file_exists(file) && ecore_file_is_dir(destination) && - evas_object_image_extension_can_load_get(file)) - { - char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; - int ret; + evas_object_image_extension_can_load_get(file)) + { + char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; + int ret; - snprintf(fp, PATH_MAX, "%s", file); - snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); - if (ecore_file_exists(dest)) - { - snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, - basename(fp)); - if (ecore_file_exists(extra)) - { - int count; + snprintf(fp, PATH_MAX, "%s", file); + snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); + if (ecore_file_exists(dest)) + { + snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, + basename(fp)); + if (ecore_file_exists(extra)) + { + int count; - for (count = 2; ecore_file_exists(extra); count++) - { - memset(extra, 0, PATH_MAX); - snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", - destination, count, basename(fp)); - } - } - ret = ecore_file_cp(file, extra); - } + for (count = 2; ecore_file_exists(extra); count++) + { + memset(extra, 0, PATH_MAX); + snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", + destination, count, basename(fp)); + } + } + ret = ecore_file_cp(file, extra); + } else ret = ecore_file_cp(file, dest); - if (!ret) - ephoto->file_errors++; - } + if (!ret) + ephoto->file_errors++; + } } } static void _copy_files(Ephoto *ephoto, Eina_List *files, - const char *destination) + const char *destination) { Evas_Object *popup = _processing(ephoto, _("Copying Files"), - _("Please wait while your files are copied.")); + _("Please wait while your files are copied.")); ephoto->file_popup = popup; ephoto->destination = destination; evas_object_show(popup); @@ -722,7 +721,7 @@ _copy_files(Ephoto *ephoto, Eina_List *files, if (eina_list_count(files)) eina_list_free(files); ephoto->file_thread = ecore_thread_run(_copy_thread_cb, - _thread_end_cb, NULL, ephoto); + _thread_end_cb, NULL, ephoto); } static void @@ -732,18 +731,18 @@ _delete_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) const char *file; if (!ecore_file_exists(ephoto->trash_path)) - ecore_file_mkpath(ephoto->trash_path); + ecore_file_mkpath(ephoto->trash_path); if (!ephoto->file_pos) - ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); + ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); EINA_LIST_FREE(ephoto->file_pos, file) { - if (!file) - break; - if (ecore_file_exists(file) && ecore_file_is_dir(ephoto->trash_path)) - { - char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; - int ret; + if (!file) + break; + if (ecore_file_exists(file) && ecore_file_is_dir(ephoto->trash_path)) + { + char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; + int ret; struct stat s; #ifdef _WIN32 if (stat(file, &s) == 0) @@ -757,31 +756,31 @@ _delete_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) } else { - snprintf(fp, PATH_MAX, "%s", file); - snprintf(dest, PATH_MAX, "%s/%s", ephoto->trash_path, basename(fp)); - if (ecore_file_exists(dest)) - { - snprintf(extra, PATH_MAX, "%s/CopyOf%s", ephoto->trash_path, - basename(fp)); - if (ecore_file_exists(extra)) - { - int count; + snprintf(fp, PATH_MAX, "%s", file); + snprintf(dest, PATH_MAX, "%s/%s", ephoto->trash_path, basename(fp)); + if (ecore_file_exists(dest)) + { + snprintf(extra, PATH_MAX, "%s/CopyOf%s", ephoto->trash_path, + basename(fp)); + if (ecore_file_exists(extra)) + { + int count; - for (count = 2; ecore_file_exists(extra); count++) - { - memset(extra, 0, sizeof(extra)); - snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", - ephoto->trash_path, count, basename(fp)); - } - } + for (count = 2; ecore_file_exists(extra); count++) + { + memset(extra, 0, sizeof(extra)); + snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", + ephoto->trash_path, count, basename(fp)); + } + } ret = ecore_file_mv(file, extra); - } + } else - ret = ecore_file_mv(file, dest); + ret = ecore_file_mv(file, dest); } - if (!ret) - ephoto->file_errors++; - } + if (!ret) + ephoto->file_errors++; + } } } } @@ -790,7 +789,7 @@ static void _delete_files(Ephoto *ephoto, Eina_List *files) { Evas_Object *popup = _processing(ephoto, _("Deleting Files"), - _("Please wait while your files are deleted.")); + _("Please wait while your files are deleted.")); ephoto->file_popup = popup; evas_object_show(popup); @@ -799,7 +798,7 @@ _delete_files(Ephoto *ephoto, Eina_List *files) if (eina_list_count(files)) eina_list_free(files); ephoto->file_thread = ecore_thread_run(_delete_thread_cb, - _thread_end_cb, NULL, ephoto); + _thread_end_cb, NULL, ephoto); } static void @@ -809,7 +808,7 @@ _delete_dir_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) const char *dir = eina_list_data_get(ephoto->file_pos); if (!ecore_file_exists(ephoto->trash_path)) - ecore_file_mkpath(ephoto->trash_path); + ecore_file_mkpath(ephoto->trash_path); if (dir) { @@ -823,7 +822,7 @@ _delete_dir_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) if (ecore_file_exists(dest)) { snprintf(extra, PATH_MAX, "%s/CopyOf%s", ephoto->trash_path, - basename(fp)); + basename(fp)); if (ecore_file_exists(extra)) { int count; @@ -831,9 +830,9 @@ _delete_dir_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) { memset(extra, 0, sizeof(extra)); snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", - ephoto->trash_path, count, basename(fp)); + ephoto->trash_path, count, basename(fp)); } - } + } ret = ecore_file_mv(dir, extra); } else @@ -850,13 +849,13 @@ static void _delete_dir(Ephoto *ephoto, Eina_List *files) { Evas_Object *popup = _processing(ephoto, _("Deleting Directory"), - _("Please wait while your directory is deleted.")); + _("Please wait while your directory is deleted.")); ephoto->file_popup = popup; evas_object_show(popup); ephoto->file_pos = eina_list_clone(files); ephoto->file_thread = ecore_thread_run(_delete_dir_thread_cb, - _thread_end_cb, NULL, ephoto); + _thread_end_cb, NULL, ephoto); } static void @@ -866,22 +865,22 @@ _empty_trash_thread_cb(void *data, Ecore_Thread *th EINA_UNUSED) const char *file; if (!ephoto->file_pos) - ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); + ephoto->file_pos = eina_list_nth(ephoto->file_pos, 0); EINA_LIST_FREE(ephoto->file_pos, file) { - if (!file) - break; - if (ecore_file_exists(file)) - { - int ret; + if (!file) + break; + if (ecore_file_exists(file)) + { + int ret; if (ecore_file_is_dir(file)) ret = ecore_file_recursive_rm(file); else - ret = ecore_file_unlink(file); - if (!ret) - ephoto->file_errors++; - } + ret = ecore_file_unlink(file); + if (!ret) + ephoto->file_errors++; + } } } @@ -889,7 +888,7 @@ static void _empty_trash(Ephoto *ephoto, Eina_List *files) { Evas_Object *popup = _processing(ephoto, _("Emptying Trash"), - _("Please wait while your files are deleted.")); + _("Please wait while your files are deleted.")); ephoto->file_popup = popup; evas_object_show(popup); @@ -897,12 +896,12 @@ _empty_trash(Ephoto *ephoto, Eina_List *files) if (eina_list_count(files)) eina_list_free(files); ephoto->file_thread = ecore_thread_run(_empty_trash_thread_cb, - _thread_end_cb, NULL, ephoto); + _thread_end_cb, NULL, ephoto); } static void _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *ppopup = data; Evas_Object *popup; @@ -916,7 +915,7 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED, evas_object_del(ppopup); popup = _processing(ephoto, _("Upload Image"), - ("Please wait while your image is uploaded.")); + ("Please wait while your image is uploaded.")); evas_object_show(popup); f = fopen(entry->path, "rb"); @@ -937,9 +936,9 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED, return; } rewind(f); - fdata = malloc(fsize+1); + fdata = malloc(fsize + 1); res = fread(fdata, fsize, 1, f); - if (res < 1) CRIT("fread() failed on file '%s': %s", entry->path, strerror(errno)); + if (res < 1) CRIT("fread() failed on file '%s': %s", entry->path, strerror(errno)); fdata[fsize] = '\0'; res = fclose(f); if (!res) CRIT("fclose() failed on file '%s': %s", entry->path, strerror(errno)); @@ -947,24 +946,24 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED, snprintf(buf, PATH_MAX, "image=%s", fdata); ephoto->upload_handlers = - eina_list_append(ephoto->upload_handlers, - ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, - _upload_image_cb, ephoto)); + eina_list_append(ephoto->upload_handlers, + ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, + _upload_image_cb, ephoto)); ephoto->upload_handlers = - eina_list_append(ephoto->upload_handlers, - ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, - _upload_image_complete_cb, popup)); + eina_list_append(ephoto->upload_handlers, + ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, + _upload_image_complete_cb, popup)); ephoto->url_up = ecore_con_url_new("https://api.imgur.com/3/image.xml"); ecore_con_url_additional_header_add(ephoto->url_up, "Authorization", - "Client-ID 67aecc7e6662370"); + "Client-ID 67aecc7e6662370"); ecore_con_url_http_version_set(ephoto->url_up, ECORE_CON_URL_HTTP_VERSION_1_0); ecore_con_url_post(ephoto->url_up, fdata, fsize, NULL); } static void _prompt_save_image_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -974,23 +973,23 @@ _prompt_save_image_apply(void *data, Evas_Object *obj EINA_UNUSED, if (ecore_file_exists(entry->path)) { - success = ecore_file_unlink(entry->path); - if (!success) - { - _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); - ephoto_single_browser_entry_set(ephoto->single_browser, entry); - evas_object_del(popup); + success = ecore_file_unlink(entry->path); + if (!success) + { + _complete(ephoto, _("Save Failed"), + _("Error: Image could not be saved here!")); + ephoto_single_browser_entry_set(ephoto->single_browser, entry); + evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); return; - } + } } success = - evas_object_image_save(image, entry->path, - NULL, NULL); + evas_object_image_save(image, entry->path, + NULL, NULL); if (!success) - _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); + _complete(ephoto, _("Save Failed"), + _("Error: Image could not be saved here!")); ephoto_single_browser_entry_set(ephoto->single_browser, entry); evas_object_del(popup); elm_object_focus_set(ephoto->pager, EINA_TRUE); @@ -1006,10 +1005,10 @@ _prompt_save_image_as_apply(void *data, Evas_Object *obj, void *event_info) if (selected) { - Evas_Object *image = evas_object_data_get(opopup, "image"); - Eina_Bool success; + Evas_Object *image = evas_object_data_get(opopup, "image"); + Eina_Bool success; - char buf[PATH_MAX]; + char buf[PATH_MAX]; const char *ex, *ext; ex = strrchr(selected, '.'); @@ -1019,7 +1018,7 @@ _prompt_save_image_as_apply(void *data, Evas_Object *obj, void *event_info) } else { - ext = eina_stringshare_add((strrchr(selected, '.')+1)); + ext = eina_stringshare_add((strrchr(selected, '.') + 1)); if (ext) { if (!_ephoto_file_image_can_save(ext)) @@ -1039,61 +1038,60 @@ _prompt_save_image_as_apply(void *data, Evas_Object *obj, void *event_info) snprintf(buf, PATH_MAX, "%s", selected); } } - if (ecore_file_exists(buf)) - { - Evas_Object *popup, *ic, *button; + if (ecore_file_exists(buf)) + { + Evas_Object *popup, *ic, *button; + popup = _prompt(ephoto, _("Overwrite Image"), + _("Are you sure you want to overwrite this image?")); - popup = _prompt(ephoto, _("Overwrite Image"), - _("Are you sure you want to overwrite this image?")); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + elm_icon_standard_set(ic, "document-save"); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); - elm_icon_standard_set(ic, "document-save"); + button = elm_button_add(popup); + elm_object_text_set(button, _("Yes")); + elm_object_part_content_set(button, "icon", ic); + evas_object_smart_callback_add(button, "clicked", + _save_image_as_overwrite, popup); + elm_object_part_content_set(popup, "button1", button); + evas_object_show(button); - button = elm_button_add(popup); - elm_object_text_set(button, _("Yes")); - elm_object_part_content_set(button, "icon", ic); - evas_object_smart_callback_add(button, "clicked", - _save_image_as_overwrite, popup); - elm_object_part_content_set(popup, "button1", button); - evas_object_show(button); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + elm_icon_standard_set(ic, "window-close"); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); - elm_icon_standard_set(ic, "window-close"); + button = elm_button_add(popup); + elm_object_text_set(button, _("No")); + elm_object_part_content_set(button, "icon", ic); + evas_object_smart_callback_add(button, "clicked", + _prompt_cancel, popup); + elm_object_part_content_set(popup, "button2", button); + evas_object_show(button); - button = elm_button_add(popup); - elm_object_text_set(button, _("No")); - elm_object_part_content_set(button, "icon", ic); - evas_object_smart_callback_add(button, "clicked", - _prompt_cancel, popup); - elm_object_part_content_set(popup, "button2", button); - evas_object_show(button); - - evas_object_data_set(popup, "ephoto", ephoto); - evas_object_data_set(popup, "file", strdup(buf)); + evas_object_data_set(popup, "ephoto", ephoto); + evas_object_data_set(popup, "file", strdup(buf)); evas_object_data_set(popup, "image", image); evas_object_data_set(popup, "entry", entry); - evas_object_show(popup); - } + evas_object_show(popup); + } else - { + { ephoto_single_browser_path_pending_set - (ephoto->single_browser, buf); - success = - evas_object_image_save(image, buf, - NULL, NULL); - if (!success) + (ephoto->single_browser, buf); + success = + evas_object_image_save(image, buf, + NULL, NULL); + if (!success) { - _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); + _complete(ephoto, _("Save Failed"), + _("Error: Image could not be saved here!")); ephoto_single_browser_path_pending_unset - (ephoto->single_browser); + (ephoto->single_browser); } - } + } } elm_object_content_unset(opopup); evas_object_del(obj); @@ -1103,7 +1101,7 @@ _prompt_save_image_as_apply(void *data, Evas_Object *obj, void *event_info) static void _prompt_empty_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -1116,7 +1114,7 @@ _prompt_empty_apply(void *data, Evas_Object *obj EINA_UNUSED, static void _prompt_delete_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -1133,7 +1131,7 @@ _prompt_delete_apply(void *data, Evas_Object *obj EINA_UNUSED, static void _prompt_move_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -1147,7 +1145,7 @@ _prompt_move_apply(void *data, Evas_Object *obj EINA_UNUSED, static void _prompt_copy_apply(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto *ephoto = evas_object_data_get(popup, "ephoto"); @@ -1164,15 +1162,15 @@ ephoto_file_save_image(Ephoto *ephoto, Ephoto_Entry *entry, Evas_Object *image) { Evas_Object *popup, *ic, *button; - if (!_ephoto_file_image_can_save(strrchr(entry->label, '.')+1)) + if (!_ephoto_file_image_can_save(strrchr(entry->label, '.') + 1)) { _complete(ephoto, _("Save Failed"), - _("Error: Image could not be saved here!")); + _("Error: Image could not be saved here!")); return; } popup = _prompt(ephoto, _("Save Image"), - _("Are you sure you want to overwrite this image?")); + _("Are you sure you want to overwrite this image?")); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -1232,7 +1230,7 @@ ephoto_file_save_image_as(Ephoto *ephoto, Ephoto_Entry *entry, Evas_Object *imag elm_fileselector_path_set(fsel, ephoto->config->directory); elm_fileselector_current_name_set(fsel, entry->basename); elm_fileselector_mime_types_filter_append(fsel, "image/*", - _("Image Files")); + _("Image Files")); EPHOTO_EXPAND(fsel); EPHOTO_FILL(fsel); evas_object_smart_callback_add(fsel, "done", _prompt_save_image_as_apply, popup); @@ -1253,8 +1251,8 @@ ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry) Evas_Object *popup, *ic, *button; popup = - _prompt(ephoto, _("Upload Image"), - _("Are you sure you want to upload this image publically to imgur.com?")); + _prompt(ephoto, _("Upload Image"), + _("Are you sure you want to upload this image publically to imgur.com?")); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -1264,7 +1262,7 @@ ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry) elm_object_text_set(button, _("Yes")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_upload_apply, - popup); + popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); @@ -1276,7 +1274,7 @@ ephoto_file_upload_image(Ephoto *ephoto, Ephoto_Entry *entry) elm_object_text_set(button, _("No")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); elm_object_part_content_set(popup, "button2", button); evas_object_show(button); @@ -1308,33 +1306,33 @@ ephoto_file_move(Ephoto *ephoto, Eina_List *files, const char *path) char move_dir[PATH_MAX]; snprintf(move_dir, PATH_MAX, "%s:
%s?", - _("Are you sure you want to move these files to"), path); + _("Are you sure you want to move these files to"), path); popup = _prompt(ephoto, _("Move Files"), move_dir); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); + 1); elm_icon_standard_set(ic, "document-save"); button = elm_button_add(popup); elm_object_text_set(button, _("Yes")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", - _prompt_move_apply, popup); + _prompt_move_apply, popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); + 1); elm_icon_standard_set(ic, "window-close"); button = elm_button_add(popup); elm_object_text_set(button, _("No")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); elm_object_part_content_set(popup, "button2", button); evas_object_show(button); @@ -1354,45 +1352,45 @@ ephoto_file_copy(Ephoto *ephoto, Eina_List *files, const char *path) return; if (ephoto->config->prompts) { - Evas_Object *ic, *button; - Evas_Object *popup; - char copy_dir[PATH_MAX]; + Evas_Object *ic, *button; + Evas_Object *popup; + char copy_dir[PATH_MAX]; - snprintf(copy_dir, PATH_MAX, "%s:
%s?", - _("Are you sure you want to copy these files to"), path); + snprintf(copy_dir, PATH_MAX, "%s:
%s?", + _("Are you sure you want to copy these files to"), path); - popup = _prompt(ephoto, _("Copy Files"), copy_dir); + popup = _prompt(ephoto, _("Copy Files"), copy_dir); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); - elm_icon_standard_set(ic, "document-save"); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + elm_icon_standard_set(ic, "document-save"); - button = elm_button_add(popup); - elm_object_text_set(button, _("Yes")); - elm_object_part_content_set(button, "icon", ic); + button = elm_button_add(popup); + elm_object_text_set(button, _("Yes")); + elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", - _prompt_copy_apply, popup); - elm_object_part_content_set(popup, "button1", button); - evas_object_show(button); + _prompt_copy_apply, popup); + elm_object_part_content_set(popup, "button1", button); + evas_object_show(button); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); - elm_icon_standard_set(ic, "window-close"); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + elm_icon_standard_set(ic, "window-close"); - button = elm_button_add(popup); - elm_object_text_set(button, _("No")); - elm_object_part_content_set(button, "icon", ic); - evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); - elm_object_part_content_set(popup, "button2", button); - evas_object_show(button); + button = elm_button_add(popup); + elm_object_text_set(button, _("No")); + elm_object_part_content_set(button, "icon", ic); + evas_object_smart_callback_add(button, "clicked", _prompt_cancel, + popup); + elm_object_part_content_set(popup, "button2", button); + evas_object_show(button); - evas_object_data_set(popup, "files", files); - evas_object_data_set(popup, "path", path); + evas_object_data_set(popup, "files", files); + evas_object_data_set(popup, "path", path); - evas_object_show(popup); + evas_object_show(popup); } else _copy_files(ephoto, files, path); @@ -1411,32 +1409,32 @@ ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, const char * Evas_Object *popup; popup = - _prompt(ephoto, _("Paste Files"), - _("Are you sure you want to paste these files here?")); + _prompt(ephoto, _("Paste Files"), + _("Are you sure you want to paste these files here?")); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); + 1, 1); elm_icon_standard_set(ic, "document-save"); button = elm_button_add(popup); elm_object_text_set(button, _("Yes")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", - _prompt_move_apply, popup); + _prompt_move_apply, popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); + 1, 1); elm_icon_standard_set(ic, "window-close"); button = elm_button_add(popup); elm_object_text_set(button, _("No")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); elm_object_part_content_set(popup, "button2", button); evas_object_show(button); @@ -1458,32 +1456,32 @@ ephoto_file_paste(Ephoto *ephoto, Eina_List *files, Eina_Bool copy, const char * Evas_Object *popup; popup = - _prompt(ephoto, _("Copy Files"), - _("Are you sure you want to copy these files here?")); + _prompt(ephoto, _("Copy Files"), + _("Are you sure you want to copy these files here?")); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); + 1, 1); elm_icon_standard_set(ic, "document-save"); button = elm_button_add(popup); elm_object_text_set(button, _("Yes")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", - _prompt_copy_apply, popup); + _prompt_copy_apply, popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); + 1, 1); elm_icon_standard_set(ic, "window-close"); button = elm_button_add(popup); elm_object_text_set(button, _("No")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); elm_object_part_content_set(popup, "button2", button); evas_object_show(button); @@ -1512,36 +1510,36 @@ ephoto_file_delete(Ephoto *ephoto, Eina_List *files, Eina_File_Type type) if (type == EINA_FILE_DIR) popup = - _prompt(ephoto, _("Delete Directory"), - _("Are you sure you want to delete this directory?")); + _prompt(ephoto, _("Delete Directory"), + _("Are you sure you want to delete this directory?")); else popup = - _prompt(ephoto, _("Delete Files"), - _("Are you sure you want to delete these files?")); + _prompt(ephoto, _("Delete Files"), + _("Are you sure you want to delete these files?")); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); + 1); elm_icon_standard_set(ic, "document-save"); button = elm_button_add(popup); elm_object_text_set(button, _("Yes")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_delete_apply, - popup); + popup); elm_object_part_content_set(popup, "button1", button); evas_object_show(button); ic = elm_icon_add(popup); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); + 1); elm_icon_standard_set(ic, "window-close"); button = elm_button_add(popup); elm_object_text_set(button, _("No")); elm_object_part_content_set(button, "icon", ic); evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); + popup); evas_object_show(button); elm_object_part_content_set(popup, "button2", button); @@ -1566,45 +1564,45 @@ ephoto_file_empty_trash(Ephoto *ephoto, Eina_List *files) return; if (ephoto->config->prompts) { - Evas_Object *ic, *button; - Evas_Object *popup; + Evas_Object *ic, *button; + Evas_Object *popup; - popup = - _prompt(ephoto, _("Empty Trash"), - _("Are you sure you want to empty the trash?")); + popup = + _prompt(ephoto, _("Empty Trash"), + _("Are you sure you want to empty the trash?")); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); - elm_icon_standard_set(ic, "document-save"); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + elm_icon_standard_set(ic, "document-save"); - button = elm_button_add(popup); - elm_object_text_set(button, _("Yes")); - elm_object_part_content_set(button, "icon", ic); - evas_object_smart_callback_add(button, "clicked", _prompt_empty_apply, - popup); - elm_object_part_content_set(popup, "button1", button); - evas_object_show(button); + button = elm_button_add(popup); + elm_object_text_set(button, _("Yes")); + elm_object_part_content_set(button, "icon", ic); + evas_object_smart_callback_add(button, "clicked", _prompt_empty_apply, + popup); + elm_object_part_content_set(popup, "button1", button); + evas_object_show(button); - ic = elm_icon_add(popup); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, - 1); - elm_icon_standard_set(ic, "window-close"); + ic = elm_icon_add(popup); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + elm_icon_standard_set(ic, "window-close"); - button = elm_button_add(popup); - elm_object_text_set(button, _("No")); - elm_object_part_content_set(button, "icon", ic); - evas_object_smart_callback_add(button, "clicked", _prompt_cancel, - popup); - elm_object_part_content_set(popup, "button2", button); - evas_object_show(button); - evas_object_data_set(popup, "files", files); + button = elm_button_add(popup); + elm_object_text_set(button, _("No")); + elm_object_part_content_set(button, "icon", ic); + evas_object_smart_callback_add(button, "clicked", _prompt_cancel, + popup); + elm_object_part_content_set(popup, "button2", button); + evas_object_show(button); + evas_object_data_set(popup, "files", files); - evas_object_show(popup); + evas_object_show(popup); } else { - _empty_trash(ephoto, files); + _empty_trash(ephoto, files); } } diff --git a/src/bin/ephoto_filters.c b/src/bin/ephoto_filters.c index bf6fe81..8ab5fbc 100644 --- a/src/bin/ephoto_filters.c +++ b/src/bin/ephoto_filters.c @@ -1,7 +1,7 @@ #include "ephoto.h" typedef enum _Ephoto_Image_Filter Ephoto_Image_Filter; -typedef struct _Ephoto_Filter Ephoto_Filter; +typedef struct _Ephoto_Filter Ephoto_Filter; enum _Ephoto_Image_Filter { @@ -22,24 +22,24 @@ enum _Ephoto_Image_Filter struct _Ephoto_Filter { Ephoto_Image_Filter filter; - Ephoto *ephoto; - Evas_Object *image; - Evas_Object *popup; - Ecore_Thread *thread;; - Eina_List *queue; - Evas_Coord w; - Evas_Coord h; - int rad; - int qpos; - int qcount; - double drad; - unsigned int *hist; - unsigned int *cdf; - unsigned int *im_data; - unsigned int *im_data_new; - unsigned int *im_data_orig; - unsigned int *im_data_two; - Eina_Bool save_data; + Ephoto *ephoto; + Evas_Object *image; + Evas_Object *popup; + Ecore_Thread *thread; + Eina_List *queue; + Evas_Coord w; + Evas_Coord h; + int rad; + int qpos; + int qcount; + double drad; + unsigned int *hist; + unsigned int *cdf; + unsigned int *im_data; + unsigned int *im_data_new; + unsigned int *im_data_orig; + unsigned int *im_data_two; + Eina_Bool save_data; }; 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 * _initialize_filter(Ephoto_Image_Filter filter, - Ephoto *ephoto, Evas_Object *image) + Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = calloc(1, sizeof(Ephoto_Filter)); Evas_Coord w, h; unsigned int *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); ef->filter = filter; @@ -93,7 +93,7 @@ _create_hist(Ephoto_Filter *ef) { int i; for (i = 0; i < 256; i++) - ef->hist[i] = 0; + ef->hist[i] = 0; } static Evas_Object * @@ -113,7 +113,7 @@ _processing(Evas_Object *main) label = elm_label_add(box); 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_FILL(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) { 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) { 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); 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; } free(ef->im_data); ef->im_data = NULL; ef->im_data = malloc(sizeof(unsigned int) * ef->w * ef->h); 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) free(ef->hist); ef->hist = NULL; @@ -180,18 +180,18 @@ _thread_finished_cb(void *data, Ecore_Thread *th EINA_UNUSED) free(ef->cdf); ef->cdf = NULL; ef->qpos++; - if (ef->qpos-1 < ef->qcount) + if (ef->qpos - 1 < ef->qcount) { free(ef->im_data_new); ef->im_data_new = NULL; 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), - _thread_finished_cb, NULL, ef); + ef->thread = ecore_thread_run(eina_list_nth(ef->queue, ef->qpos - 1), + _thread_finished_cb, NULL, ef); } else { 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) { evas_object_del(ef->popup); @@ -231,7 +231,7 @@ _blur_vertical(Ephoto_Filter *ef, double rad) 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++) { int t, l, rr; @@ -274,17 +274,17 @@ _blur_vertical(Ephoto_Filter *ef, double rad) valr += rs[r] - fr; vala += as[r] - fa; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data_new[t++] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; } for (i = rad + 1; i < w - rad; i++) { @@ -296,16 +296,16 @@ _blur_vertical(Ephoto_Filter *ef, double rad) valr += rs[r] - rs[ll]; vala += as[r] - as[ll]; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data_new[t++] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; } for (i = w - rad; i < w; i++) { @@ -316,16 +316,16 @@ _blur_vertical(Ephoto_Filter *ef, double rad) valr += lvr - rs[ll]; vala += lva - as[ll]; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data_new[t++] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; } } free(bs); @@ -399,16 +399,16 @@ _blur_horizontal(Ephoto_Filter *ef, double rad) valr += rs[rr] - fr; vala += as[rr] - fa; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data[t] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; rr += w; t += w; @@ -418,18 +418,18 @@ _blur_horizontal(Ephoto_Filter *ef, double rad) valb += bs[rr] - bs[l]; valg += gs[rr] - gs[l]; valr += rs[rr] - rs[l]; - vala += as[rr] - as[l];; + vala += as[rr] - as[l]; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data[t] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; l += w; rr += w; @@ -442,16 +442,16 @@ _blur_horizontal(Ephoto_Filter *ef, double rad) valr += lvr - rs[l]; vala += lva - as[l]; - bt = (int) round(valb * iarr); - gt = (int) round(valg * iarr); - rt = (int) round(valr * iarr); - at = (int) round(vala * iarr); + bt = (int)round(valb * iarr); + gt = (int)round(valg * iarr); + rt = (int)round(valr * iarr); + at = (int)round(vala * iarr); bt = ephoto_normalize_color(bt); gt = ephoto_normalize_color(gt); rt = ephoto_normalize_color(rt); at = ephoto_normalize_color(at); ef->im_data[t] = (at << 24) | (rt << 16) - | (gt << 8) | bt; + | (gt << 8) | bt; l += w; t += w; @@ -482,7 +482,7 @@ _blur(void *data, Ecore_Thread *th EINA_UNUSED) wl--; wu = wl + 2; 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); for (i = 0; i < 3; i++) @@ -495,7 +495,7 @@ _blur(void *data, Ecore_Thread *th EINA_UNUSED) rad = (sizes[i] - 1) / 2; memcpy(ef->im_data_new, ef->im_data, - sizeof(unsigned int) * w * h); + sizeof(unsigned int) * w * h); _blur_vertical(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); for (x = 1; x < (w - 1); x++) { - b = (int) (*p1 & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - bb = (int) (*p2 & 0xff); - gg = (int) ((*p2 >> 8) & 0xff); - rr = (int) ((*p2 >> 16) & 0xff); - aa = (int) ((*p2 >> 24) & 0xff); + b = (int)(*p1 & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + bb = (int)(*p2 & 0xff); + gg = (int)((*p2 >> 8) & 0xff); + rr = (int)((*p2 >> 16) & 0xff); + aa = (int)((*p2 >> 24) & 0xff); - bbb = (int) ((2 * bb) - b); - ggg = (int) ((2 * gg) - g); - rrr = (int) ((2 * rr) - r); - aaa = (int) ((2 * aa) - a); + bbb = (int)((2 * bb) - b); + ggg = (int)((2 * gg) - g); + rrr = (int)((2 * rr) - r); + aaa = (int)((2 * aa) - a); bbb = ephoto_normalize_color(bbb); ggg = ephoto_normalize_color(ggg); @@ -583,12 +583,12 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED) gg = ephoto_demul_color_alpha(gg, a); rr = ephoto_demul_color_alpha(rr, a); ef->im_data_new[index] = (a << 24) | (rr << 16) | - (gg << 8) | bb; + (gg << 8) | bb; errb = b - bb; errg = g - gg; errr = r - rr; - if ((x+1) < w) + if ((x + 1) < w) { index = y * w + x + 1; 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); rr = ephoto_demul_color_alpha(rr, a); 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); 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); rr = ephoto_demul_color_alpha(rr, a); 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; 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); rr = ephoto_demul_color_alpha(rr, a); 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); 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); rr = ephoto_demul_color_alpha(rr, a); 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++) { i = y * w + x; - b = (int) ((ef->im_data[i]) & 0xff); - g = (int) ((ef->im_data[i] >> 8) & 0xff); - r = (int) ((ef->im_data[i] >> 16) & 0xff); - a = (int) ((ef->im_data[i] >> 24) & 0xff); + b = (int)((ef->im_data[i]) & 0xff); + g = (int)((ef->im_data[i] >> 8) & 0xff); + r = (int)((ef->im_data[i] >> 16) & 0xff); + a = (int)((ef->im_data[i] >> 24) & 0xff); b = ephoto_mul_color_alpha(b, a); g = ephoto_mul_color_alpha(g, 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) gray = (gray * a) / 255; 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); g = ephoto_mul_color_alpha(g, 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); gg = ((r * .349) + (g * .686) + (b * .168)); 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_demul_color_alpha(bb, 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; pix = ef->im_data[index]; - hpval += pix * sobx[i+1][j+1]; - vpval += pix * soby[i+1][j+1]; + hpval += pix * sobx[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); for (x = 0; x < w; x++) - { + { int aa = 0, rr = 0, gg = 0, bb = 0; 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; index = (y + i) * w + x + j; pix = ef->im_data[index]; - bb += (int) ((pix) & 0xff) * - emboss[i+1][j+1]; - gg += (int) ((pix >> 8) & 0xff) * - emboss[i+1][j+1]; - rr += (int) ((pix >> 16) & 0xff) * - emboss[i+1][j+1]; - aa += (int) ((pix >> 24) & 0xff) * - emboss[i+1][j+1]; + bb += (int)((pix) & 0xff) * + emboss[i + 1][j + 1]; + gg += (int)((pix >> 8) & 0xff) * + emboss[i + 1][j + 1]; + rr += (int)((pix >> 16) & 0xff) * + emboss[i + 1][j + 1]; + aa += (int)((pix >> 24) & 0xff) * + 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); r = ephoto_mul_color_alpha(r, a); 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; p1++; } @@ -1005,9 +1005,9 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED) sum = 0; for (i = 0; i < 256; i++) { - sum += ((double) ef->hist[i] / - (double) total); - ef->cdf[i] = (int) round(sum * 255); + sum += ((double)ef->hist[i] / + (double)total); + ef->cdf[i] = (int)round(sum * 255); } 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); r = ephoto_mul_color_alpha(r, a); evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); - norm = (int) round((double) v * (double) 255); - nv = (float) ef->cdf[norm] / (float) 255; + norm = (int)round((double)v * (double)255); + nv = (float)ef->cdf[norm] / (float)255; evas_color_hsv_to_rgb(hh, s, nv, &rr, &gg, &bb); bb = ephoto_normalize_color(bb); gg = ephoto_normalize_color(gg); @@ -1043,22 +1043,22 @@ void ephoto_filter_blur(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_BLUR, - ephoto, image); + ephoto, image); ef->rad = 9; ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_blur, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image) { 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); 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->qcount = 1; @@ -1066,61 +1066,61 @@ ephoto_filter_sharpen(Ephoto *ephoto, Evas_Object *image) ef->queue = eina_list_append(ef->queue, _sharpen); ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_blur, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_dither(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_DITHER, - ephoto, image); + ephoto, image); 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->thread = ecore_thread_run(_dither, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_black_and_white(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_GRAYSCALE, - ephoto, image); + ephoto, image); ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_grayscale, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_old_photo(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_SEPIA, - ephoto, image); + ephoto, image); ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_sepia, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_posterize(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_POSTERIZE, - ephoto, image); + ephoto, image); ef->drad = 2.0; ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_posterize, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_painting(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_PAINTING, - ephoto, image); + ephoto, image); ef->rad = 5; 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->popup = _processing(ephoto->win); 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, image); + ephoto, image); ef->popup = _processing(ephoto->win); 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, image); + ephoto, image); ef->rad = 4; 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->popup = _processing(ephoto->win); 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, image); + ephoto, image); ef->rad = 3; 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->popup = _processing(ephoto->win); 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, image); + ephoto, image); ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_emboss, _thread_finished_cb, - NULL, ef); + NULL, ef); } void ephoto_filter_histogram_eq(Ephoto *ephoto, Evas_Object *image) { Ephoto_Filter *ef = _initialize_filter(EPHOTO_IMAGE_FILTER_EQUALIZE, - ephoto, image); + ephoto, image); ef->hist = malloc(sizeof(unsigned int) * 256); ef->cdf = malloc(sizeof(unsigned int) * 256); _create_hist(ef); ef->popup = _processing(ephoto->win); ef->thread = ecore_thread_run(_histogram_eq, _thread_finished_cb, - NULL, ef); + NULL, ef); } + diff --git a/src/bin/ephoto_hsv.c b/src/bin/ephoto_hsv.c index 782d224..f942840 100644 --- a/src/bin/ephoto_hsv.c +++ b/src/bin/ephoto_hsv.c @@ -3,18 +3,18 @@ typedef struct _Ephoto_HSV Ephoto_HSV; struct _Ephoto_HSV { - Evas_Object *main; - Evas_Object *parent; - Evas_Object *image; - Evas_Object *editor; - Evas_Object *hslider; - Evas_Object *sslider; - Evas_Object *vslider; - Eina_List *handlers; - double hue; - double saturation; - double value; - Evas_Coord w, h; + Evas_Object *main; + Evas_Object *parent; + Evas_Object *image; + Evas_Object *editor; + Evas_Object *hslider; + Evas_Object *sslider; + Evas_Object *vslider; + Eina_List *handlers; + double hue; + double saturation; + double value; + Evas_Coord w, h; 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); 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 - memcpy(im_data, ehsv->original_im_data, - sizeof(unsigned int) * ehsv->w * ehsv->h); + memcpy(im_data, ehsv->original_im_data, + 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++) { - p1 = im_data + (y * ehsv->w); - p2 = im_data_new + (y * ehsv->w); - for (x = 0; x < ehsv->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); - hh += hue; - if (hh < 0) - hh += 360; - if (hh > 360) - hh -= 360; - evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ehsv->w); + p2 = im_data_new + (y * ehsv->w); + for (x = 0; x < ehsv->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); + hh += hue; + if (hh < 0) + hh += 360; + if (hh > 360) + hh -= 360; + evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } ehsv->hue = hue; 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); return im_data_new; } unsigned int * _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; 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); 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 - memcpy(im_data, ehsv->original_im_data, - sizeof(unsigned int) * ehsv->w * ehsv->h); + memcpy(im_data, ehsv->original_im_data, + 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++) { - p1 = im_data + (y * ehsv->w); - p2 = im_data_new + (y * ehsv->w); - for (x = 0; x < ehsv->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); - s += s * ((float) saturation / 100); - if (s < 0) - s = 0; - if (s > 1) - s = 1; - evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ehsv->w); + p2 = im_data_new + (y * ehsv->w); + for (x = 0; x < ehsv->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); + s += s * ((float)saturation / 100); + if (s < 0) + s = 0; + if (s > 1) + s = 1; + evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } ehsv->saturation = saturation; 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); return im_data_new; } unsigned int * _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; 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); 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 - memcpy(im_data, ehsv->original_im_data, - sizeof(unsigned int) * ehsv->w * ehsv->h); + memcpy(im_data, ehsv->original_im_data, + 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++) { - p1 = im_data + (y * ehsv->w); - p2 = im_data_new + (y * ehsv->w); - for (x = 0; x < ehsv->w; x++) - { - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); - v += (v * ((float) value / 100)); - if (v < 0) - v = 0; - if (v > 1) - v = 1; - evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); - bb = ephoto_normalize_color(bb); - gg = ephoto_normalize_color(gg); - rr = ephoto_normalize_color(rr); - bb = ephoto_demul_color_alpha(bb, a); - gg = ephoto_demul_color_alpha(gg, a); - rr = ephoto_demul_color_alpha(rr, a); - *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; - p2++; - p1++; - } + p1 = im_data + (y * ehsv->w); + p2 = im_data_new + (y * ehsv->w); + for (x = 0; x < ehsv->w; x++) + { + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v); + v += (v * ((float)value / 100)); + if (v < 0) + v = 0; + if (v > 1) + v = 1; + evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb); + bb = ephoto_normalize_color(bb); + gg = ephoto_normalize_color(gg); + rr = ephoto_normalize_color(rr); + bb = ephoto_demul_color_alpha(bb, a); + gg = ephoto_demul_color_alpha(gg, a); + rr = ephoto_demul_color_alpha(rr, a); + *p2 = (a << 24) | (rr << 16) | (gg << 8) | bb; + p2++; + p1++; + } } ehsv->value = value; 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); 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); image_data = _ephoto_hsv_adjust_hue(ehsv, hue, NULL); 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); } static void _saturation_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_HSV *ehsv = data; double saturation; @@ -215,7 +215,7 @@ _saturation_slider_changed(void *data, Evas_Object *obj, static void _value_slider_changed(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_HSV *ehsv = data; double value; @@ -229,7 +229,7 @@ _value_slider_changed(void *data, Evas_Object *obj, static Eina_Bool _hsv_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_HSV *ehsv = data; @@ -246,7 +246,7 @@ _hsv_reset(void *data, int type EINA_UNUSED, static Eina_Bool _hsv_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_HSV *ehsv = data; unsigned int *image_data; @@ -261,7 +261,7 @@ _hsv_apply(void *data, int type EINA_UNUSED, else { 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); 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 _hsv_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_HSV *ehsv = data; @@ -291,7 +291,7 @@ _hsv_cancel(void *data, int type EINA_UNUSED, static void _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; 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->image = image; im_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, &ehsv->w, - &ehsv->h); + &ehsv->h); ehsv->original_im_data = malloc(sizeof(unsigned int) * ehsv->w * ehsv->h); 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", ehsv); + "ehsv", ehsv); evas_object_event_callback_add(ehsv->editor, EVAS_CALLBACK_DEL, _editor_del, - ehsv); + ehsv); slider = elm_slider_add(ehsv->editor); 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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", _value_slider_changed, - ehsv); + ehsv); elm_box_pack_start(ehsv->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _saturation_slider_changed, ehsv); + _saturation_slider_changed, ehsv); elm_box_pack_start(ehsv->editor, slider); evas_object_show(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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _hue_slider_changed, ehsv); + _hue_slider_changed, ehsv); elm_box_pack_start(ehsv->editor, slider); evas_object_show(slider); ehsv->hslider = slider; ehsv->handlers = - eina_list_append(ehsv->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _hsv_reset, ehsv)); + eina_list_append(ehsv->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _hsv_reset, ehsv)); ehsv->handlers = - eina_list_append(ehsv->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _hsv_apply, ehsv)); + eina_list_append(ehsv->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _hsv_apply, ehsv)); ehsv->handlers = - eina_list_append(ehsv->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _hsv_cancel, ehsv)); + eina_list_append(ehsv->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _hsv_cancel, ehsv)); return; - error: +error: return; } + diff --git a/src/bin/ephoto_ipc.c b/src/bin/ephoto_ipc.c index 35372d3..77c5aad 100644 --- a/src/bin/ephoto_ipc.c +++ b/src/bin/ephoto_ipc.c @@ -1,6 +1,6 @@ #include "ephoto.h" #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 /* local subsystem functions */ @@ -22,7 +22,7 @@ e_ipc_init(void) snprintf(port_str, sizeof(port_str), "%d", port); setenv("EPHOTO_IPC_PORT", port_str, 1); _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) { ERR("Couldn't create Ephoto IPC server port=%d", port); diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index f1a9c72..862b410 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -12,17 +12,17 @@ int EPHOTO_EVENT_EDITOR_BACK = 0; typedef struct _Ephoto_Entry_Free_Listener 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; }; typedef struct _Ephoto_Dir_Data Ephoto_Dir_Data; struct _Ephoto_Dir_Data { - Ephoto *ephoto; + Ephoto *ephoto; Elm_Object_Item *expanded; - Eina_Bool dirs_only; - Eina_Bool thumbs_only; + Eina_Bool dirs_only; + Eina_Bool thumbs_only; }; static void @@ -72,13 +72,13 @@ _ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry) { if (ephoto->selentries) ephoto_single_browser_entries_set(ephoto->single_browser, - ephoto->selentries); + ephoto->selentries); else if (ephoto->searchentries) ephoto_single_browser_entries_set(ephoto->single_browser, - ephoto->searchentries); + ephoto->searchentries); else ephoto_single_browser_entries_set(ephoto->single_browser, - ephoto->entries); + ephoto->entries); ephoto_single_browser_entry_set(ephoto->single_browser, entry); evas_object_hide(ephoto->slideshow); @@ -122,7 +122,7 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry) static void _ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; @@ -133,25 +133,25 @@ _ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; switch (ephoto->prev_state) { - case EPHOTO_STATE_SINGLE: - _ephoto_single_browser_show(ephoto, entry); - break; + case EPHOTO_STATE_SINGLE: + _ephoto_single_browser_show(ephoto, entry); + break; - case EPHOTO_STATE_THUMB: - ephoto->selentries = NULL; - _ephoto_thumb_browser_show(ephoto, entry); - break; + case EPHOTO_STATE_THUMB: + ephoto->selentries = NULL; + _ephoto_thumb_browser_show(ephoto, entry); + break; - default: - ephoto->selentries = NULL; - _ephoto_thumb_browser_show(ephoto, entry); + default: + ephoto->selentries = NULL; + _ephoto_thumb_browser_show(ephoto, entry); } if (ephoto->folders_toggle) { @@ -164,7 +164,7 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; @@ -174,7 +174,7 @@ _ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_UNUSED, static void _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; @@ -185,7 +185,7 @@ _ephoto_thumb_browser_changed_directory(void *data, static void _ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; @@ -195,7 +195,7 @@ _ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto *ephoto = data; Ephoto_Entry *entry = event_info; @@ -205,7 +205,7 @@ _ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED, static void _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; 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) ecore_thread_cancel(ephoto->file_thread); if (eina_list_count(ephoto->file_pos)) - eina_list_free(ephoto->file_pos); + eina_list_free(ephoto->file_pos); if (ephoto->upload_handlers) EINA_LIST_FREE(ephoto->upload_handlers, 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 _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; 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); if (w && h) { - ephoto->config->window_width = w; - ephoto->config->window_height = h; + ephoto->config->window_width = w; + ephoto->config->window_height = h; } } static void _folder_icon_clicked(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto *ephoto = data; int ret = 0; @@ -273,7 +273,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj, elm_box_pack_start(ephoto->layout, ephoto->dir_browser); ephoto->folders_toggle = EINA_TRUE; ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open"); - if (!ret) + if (!ret) elm_object_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); ephoto->folders_toggle = EINA_FALSE; ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); - if (!ret) + if (!ret) elm_object_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*/ static void _slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto *ephoto = data; @@ -302,10 +302,9 @@ _slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, ephoto_single_browser_slideshow(ephoto->single_browser); } - static void _settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto *ephoto = data; @@ -314,7 +313,7 @@ _settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, static void _exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto *ephoto = data; @@ -331,11 +330,11 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle) { evas_object_show(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"); if (!ret) 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) { @@ -345,7 +344,7 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle) ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); if (!ret) 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"); if (!ephoto->win) { - free(ephoto); - return NULL; + free(ephoto); + return NULL; } 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, - _resize_cb, ephoto); + _resize_cb, ephoto); elm_win_autodel_set(ephoto->win, EINA_TRUE); if (!ephoto_config_init(ephoto)) { - evas_object_del(ephoto->win); - return NULL; + evas_object_del(ephoto->win); + return NULL; } if ((ephoto->config->thumb_gen_size != 128) && (ephoto->config->thumb_gen_size != 256) && (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); 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); if (!ephoto->thumb_browser) { - evas_object_del(ephoto->win); - return NULL; + evas_object_del(ephoto->win); + return NULL; } elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1); 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", - _ephoto_thumb_browser_changed_directory, ephoto); + _ephoto_thumb_browser_changed_directory, ephoto); 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); if (!ephoto->single_browser) { - evas_object_del(ephoto->win); - return NULL; + evas_object_del(ephoto->win); + return NULL; } elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1); 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", - _ephoto_single_browser_slideshow, ephoto); + _ephoto_single_browser_slideshow, ephoto); ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout); if (!ephoto->slideshow) { - evas_object_del(ephoto->win); - return NULL; + evas_object_del(ephoto->win); + return NULL; } elm_table_pack(ephoto->pager, ephoto->slideshow, 0, 0, 1, 1); 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_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); ephoto->statusbar = elm_box_add(ephoto->main); - evas_object_size_hint_min_set(ephoto->statusbar, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ephoto->statusbar, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE); EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_FILL(ephoto->statusbar); @@ -468,8 +467,8 @@ ephoto_window_add(const char *path) evas_object_show(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "folder"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); ephoto->folders_icon = ic; @@ -511,8 +510,8 @@ ephoto_window_add(const char *path) evas_object_show(ephoto->controls_right); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "media-playback-start"); 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) elm_object_text_set(but, _("Slideshow")); 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_orient_set(but, ELM_TOOLTIP_ORIENT_TOP); elm_box_pack_end(ephoto->statusbar, but); evas_object_show(but); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "preferences-other"); 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) elm_object_text_set(but, _("Settings")); 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_orient_set(but, ELM_TOOLTIP_ORIENT_TOP); elm_box_pack_end(ephoto->statusbar, but); evas_object_show(but); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "application-exit"); 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) elm_object_text_set(ephoto->exit, _("Exit")); 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_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP); evas_object_hide(ephoto->exit); if ((!path) || (!ecore_file_exists(path))) { - if (ephoto->config->open) - { - if (!strcmp(ephoto->config->open, "Last")) - path = ephoto->config->directory; - else - path = ephoto->config->open; - if ((path) && (!ecore_file_exists(path))) - path = NULL; - } + if (ephoto->config->open) + { + if (!strcmp(ephoto->config->open, "Last")) + path = ephoto->config->directory; + else + path = ephoto->config->open; + if ((path) && (!ecore_file_exists(path))) + path = NULL; + } else if (!ephoto->config->open || path) - { - if (getcwd(buf, sizeof(buf))) - path = buf; - else - path = eina_environment_home_get(); - } + { + if (getcwd(buf, sizeof(buf))) + path = buf; + else + path = eina_environment_home_get(); + } } if (ecore_file_is_dir(path)) @@ -585,22 +584,22 @@ ephoto_window_add(const char *path) char *rp = ecore_file_realpath(path); eina_stringshare_replace(&ephoto->config->directory, rp); free(rp); - _ephoto_thumb_browser_show(ephoto, NULL); + _ephoto_thumb_browser_show(ephoto, NULL); } else { - char *dir = ecore_file_dir_get(path); + char *dir = ecore_file_dir_get(path); char *rp = ecore_file_realpath(dir); eina_stringshare_replace(&ephoto->config->directory, rp); free(rp); - free(dir); + free(dir); ephoto_single_browser_path_pending_set(ephoto->single_browser, path); evas_object_hide(ephoto->thumb_browser); evas_object_hide(ephoto->slideshow); evas_object_show(ephoto->single_browser); 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()); @@ -611,7 +610,7 @@ ephoto_window_add(const char *path) ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory); ephoto_directory_browser_initialize_structure(ephoto); evas_object_resize(ephoto->win, ephoto->config->window_width, - ephoto->config->window_height); + ephoto->config->window_height); evas_object_show(ephoto->win); if (!ephoto->config->folders) @@ -620,17 +619,17 @@ ephoto_window_add(const char *path) elm_box_unpack(ephoto->layout, ephoto->dir_browser); ephoto->folders_toggle = EINA_FALSE; ret = elm_icon_standard_set(ephoto->folders_icon, "folder"); - if (!ret) + if (!ret) 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 { 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) 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) { @@ -648,11 +647,11 @@ ephoto_title_set(Ephoto *ephoto, const char *title) if (title) { - snprintf(buf, sizeof(buf), "Ephoto - %s", title); - elm_win_title_set(ephoto->win, buf); + snprintf(buf, sizeof(buf), "Ephoto - %s", title); + elm_win_title_set(ephoto->win, buf); } else - elm_win_title_set(ephoto->win, "Ephoto"); + elm_win_title_set(ephoto->win, "Ephoto"); } int @@ -667,38 +666,43 @@ ephoto_entries_cmp(const void *pa, const void *pb) modb = ecore_file_mod_time(b->path); switch (a->ephoto->sort) { - case EPHOTO_SORT_ALPHABETICAL_ASCENDING: - return i; - case EPHOTO_SORT_ALPHABETICAL_DESCENDING: - return i * -1; - case EPHOTO_SORT_MODTIME_ASCENDING: - if (moda < modb) - return -1; - else if (moda > modb) - return 1; - else - return i; - case EPHOTO_SORT_MODTIME_DESCENDING: - if (moda < modb) - return 1; - else if (moda > modb) - return -1; - else - return i * -1; - case EPHOTO_SORT_SIMILARITY: - if (!a->sort_id || !b->sort_id) - return 0; - else - return strcmp(a->sort_id, b->sort_id); - default: - return i; + case EPHOTO_SORT_ALPHABETICAL_ASCENDING: + return i; + + case EPHOTO_SORT_ALPHABETICAL_DESCENDING: + return i * -1; + + case EPHOTO_SORT_MODTIME_ASCENDING: + if (moda < modb) + return -1; + else if (moda > modb) + return 1; + else + return i; + + case EPHOTO_SORT_MODTIME_DESCENDING: + if (moda < modb) + return 1; + else if (moda > modb) + return -1; + else + return i * -1; + + case EPHOTO_SORT_SIMILARITY: + if (!a->sort_id || !b->sort_id) + return 0; + else + return strcmp(a->sort_id, b->sort_id); + + default: + return i; } return i; } static void _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_Entry *e; @@ -707,7 +711,7 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED, if (ephoto_entry_exists(ed->ephoto, info->path)) return; e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start, - info->type); + info->type); if (e->is_dir) 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->entries) - ed->ephoto->entries = eina_list_append(ed->ephoto->entries, e); - else - { - int near_cmp; - Eina_List *near_node = - eina_list_search_sorted_near_list(ed->ephoto->entries, - ephoto_entries_cmp, e, &near_cmp); + if (!ed->ephoto->entries) + ed->ephoto->entries = eina_list_append(ed->ephoto->entries, e); + else + { + int near_cmp; + Eina_List *near_node = + eina_list_search_sorted_near_list(ed->ephoto->entries, + ephoto_entries_cmp, e, &near_cmp); - if (near_cmp < 0) - ed->ephoto->entries = - eina_list_append_relative_list(ed->ephoto->entries, e, - near_node); - else - ed->ephoto->entries = - eina_list_prepend_relative_list(ed->ephoto->entries, e, - near_node); + if (near_cmp < 0) + ed->ephoto->entries = + eina_list_append_relative_list(ed->ephoto->entries, e, + near_node); + else + ed->ephoto->entries = + eina_list_prepend_relative_list(ed->ephoto->entries, e, + near_node); } - } - e->parent = NULL; + } + e->parent = NULL; } ev = calloc(1, sizeof(Ephoto_Event_Entry_Create)); ev->entry = e; @@ -744,14 +748,14 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED, static Eina_Bool _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; const char *bname = info->path + info->name_start; char *rp; if (bname[0] == '.') - return EINA_FALSE; + return EINA_FALSE; rp = ecore_file_realpath(info->path); 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)) 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); free(ed); } @@ -814,9 +818,9 @@ _ephoto_populate_entries(Ephoto_Dir_Data *ed) ed->ephoto->entries = NULL; ed->ephoto->ls = - eio_file_stat_ls(ed->ephoto->config->directory, _ephoto_populate_filter, - _ephoto_populate_main, _ephoto_populate_end, _ephoto_populate_error, - ed); + eio_file_stat_ls(ed->ephoto->config->directory, _ephoto_populate_filter, + _ephoto_populate_main, _ephoto_populate_end, _ephoto_populate_error, + ed); ecore_event_add(EPHOTO_EVENT_POPULATE_START, NULL, NULL, NULL); } @@ -832,7 +836,7 @@ _ephoto_change_dir(void *data) static Eina_Bool _monitor_cb(void *data, int type, - void *event) + void *event) { Ephoto *ephoto = data; Eio_Monitor_Event *ev = event; @@ -860,7 +864,7 @@ _monitor_cb(void *data, int type, return ECORE_CALLBACK_PASS_ON; snprintf(buf, PATH_MAX, "%s", ev->filename); entry = ephoto_entry_new(ephoto, ev->filename, basename(buf), - EINA_FILE_REG); + EINA_FILE_REG); ephoto_single_browser_path_created(ephoto->single_browser, entry); if (!ephoto->entries) { @@ -870,17 +874,17 @@ _monitor_cb(void *data, int type, { int near_cmp; Eina_List *near_node = - eina_list_search_sorted_near_list(ephoto->entries, - ephoto_entries_cmp, entry, &near_cmp); + eina_list_search_sorted_near_list(ephoto->entries, + ephoto_entries_cmp, entry, &near_cmp); if (near_cmp < 0) - ephoto->entries = - eina_list_append_relative_list(ephoto->entries, entry, - near_node); + ephoto->entries = + eina_list_append_relative_list(ephoto->entries, entry, + near_node); else - ephoto->entries = - eina_list_prepend_relative_list(ephoto->entries, entry, - near_node); + ephoto->entries = + eina_list_prepend_relative_list(ephoto->entries, entry, + near_node); } ephoto_thumb_browser_insert(ephoto, entry); return ECORE_CALLBACK_PASS_ON; @@ -920,7 +924,7 @@ _monitor_cb(void *data, int type, void 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; 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); 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); 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_handlers = - eina_list_append(ephoto->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, - _monitor_cb, ephoto)); + eina_list_append(ephoto->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, + _monitor_cb, ephoto)); ephoto->monitor_handlers = - eina_list_append(ephoto->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, - _monitor_cb, ephoto)); + eina_list_append(ephoto->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, + _monitor_cb, ephoto)); ephoto->monitor_handlers = - eina_list_append(ephoto->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, - _monitor_cb, ephoto)); + eina_list_append(ephoto->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, + _monitor_cb, ephoto)); free(rp); } @@ -979,17 +983,17 @@ _thumb_gen_size_changed_timer_cb(void *data) Evas_Object *o; if (ephoto->config->thumb_gen_size == ephoto->thumb_gen_size) - goto end; + goto end; ephoto->config->thumb_gen_size = ephoto->thumb_gen_size; EINA_LIST_FOREACH(ephoto->thumbs, l, o) { e_thumb_icon_size_set(o, ephoto->thumb_gen_size, - ephoto->thumb_gen_size); - e_thumb_icon_rethumb(o); + ephoto->thumb_gen_size); + e_thumb_icon_rethumb(o); } - end: +end: ephoto->timer.thumb_regen = NULL; return EINA_FALSE; } @@ -999,25 +1003,25 @@ ephoto_thumb_size_set(Ephoto *ephoto, int size) { if (ephoto->config->thumb_size != size) { - ephoto->config->thumb_size = size; + ephoto->config->thumb_size = size; } if (size <= 128) - ephoto->thumb_gen_size = 128; + ephoto->thumb_gen_size = 128; else if (size <= 256) - ephoto->thumb_gen_size = 256; + ephoto->thumb_gen_size = 256; else - ephoto->thumb_gen_size = 512; + ephoto->thumb_gen_size = 512; if (ephoto->timer.thumb_regen) - ecore_timer_del(ephoto->timer.thumb_regen); + ecore_timer_del(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 _thumb_gen_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Entry *entry = data; const char *id; @@ -1054,24 +1058,24 @@ _thumb_gen_cb(void *data, Evas_Object *obj EINA_UNUSED, { int near_cmp; Eina_List *near_node = - eina_list_search_sorted_near_list(entry->ephoto->entries, - ephoto_entries_cmp, entry, &near_cmp); + eina_list_search_sorted_near_list(entry->ephoto->entries, + ephoto_entries_cmp, entry, &near_cmp); if (near_cmp < 0) - entry->ephoto->entries = - eina_list_append_relative_list(entry->ephoto->entries, entry, - near_node); + entry->ephoto->entries = + eina_list_append_relative_list(entry->ephoto->entries, entry, + near_node); else - entry->ephoto->entries = - eina_list_prepend_relative_list(entry->ephoto->entries, entry, - near_node); + entry->ephoto->entries = + eina_list_prepend_relative_list(entry->ephoto->entries, entry, + near_node); } } } static void _thumb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto *ephoto = data; @@ -1085,16 +1089,16 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry) if (entry->path) { - const char *ext = strrchr(entry->path, '.'); + const char *ext = strrchr(entry->path, '.'); - if (ext) - { - ext++; - if ((strcasecmp(ext, "edj") == 0)) + if (ext) + { + ext++; + if ((strcasecmp(ext, "edj") == 0)) { const char *group = NULL; - o = elm_icon_add(parent); + o = elm_icon_add(parent); if (edje_file_group_exists(entry->path, "e/desktop/background")) group = "e/desktop/background"; else @@ -1106,14 +1110,14 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry) } elm_image_file_set(o, entry->path, group); } - } + } 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); - 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, - ephoto->thumb_gen_size); + ephoto->thumb_gen_size); e_thumb_icon_begin(o); entry->thumb = o; } @@ -1129,7 +1133,7 @@ ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, Ephoto_Entry *entry) Ephoto_Entry * ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, - Eina_File_Type type) + Eina_File_Type type) { Ephoto_Entry *entry; char *rp; @@ -1179,7 +1183,7 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry) EINA_LIST_FREE(entry->free_listeners, fl) { - fl->cb((void *) fl->data, entry); + fl->cb((void *)fl->data, entry); free(fl); } 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); ephoto->selentries = eina_list_remove_list(ephoto->selentries, - node); + node); } if (entry->sort_id) eina_stringshare_del(entry->sort_id); @@ -1207,8 +1211,8 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry) } void -ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb) (void *data, - const Ephoto_Entry *entry), const void *data) +ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb)(void *data, + const Ephoto_Entry *entry), const void *data) { Ephoto_Entry_Free_Listener *fl; @@ -1219,8 +1223,8 @@ ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb) (void *data, } void -ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb) (void *data, - const Ephoto_Entry *entry), const void *data) +ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb)(void *data, + const Ephoto_Entry *entry), const void *data) { Eina_List *l; 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) { if ((fl->cb == cb) && (fl->data == data)) - { + { if (eina_list_data_find(entry->free_listeners, l)) { - entry->free_listeners = - eina_list_remove_list(entry->free_listeners, l); - break; + entry->free_listeners = + eina_list_remove_list(entry->free_listeners, l); + break; } } } @@ -1248,3 +1252,4 @@ ephoto_entries_free(Ephoto *ephoto) ephoto_entry_free(ephoto, entry); ephoto->entries = NULL; } + diff --git a/src/bin/ephoto_red_eye.c b/src/bin/ephoto_red_eye.c index 11507fe..2e96e85 100644 --- a/src/bin/ephoto_red_eye.c +++ b/src/bin/ephoto_red_eye.c @@ -3,21 +3,21 @@ typedef struct _Ephoto_Reye Ephoto_Reye; struct _Ephoto_Reye { - Evas_Object *main; - Evas_Object *parent; - Evas_Object *image; - Evas_Object *editor; - Evas_Object *rslider; - Eina_List *handlers; - int rad; - Evas_Coord w, h; + Evas_Object *main; + Evas_Object *parent; + Evas_Object *image; + Evas_Object *editor; + Evas_Object *rslider; + Eina_List *handlers; + int rad; + Evas_Coord w, h; unsigned int *original_im_data; unsigned int *edited_im_data; }; static void _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; 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_object_geometry_get(er->image, &imx, &imy, &imw, &imh); - xadj = xpos-imx; - yadj = ypos-imy; + xadj = xpos - imx; + yadj = ypos - imy; if (xadj < 0) xadj = 0; if (yadj < 0) yadj = 0; - scalex = (double) (xadj) / (double) imw; - scaley = (double) (yadj) / (double) imh; + scalex = (double)(xadj) / (double)imw; + scaley = (double)(yadj) / (double)imh; nx = er->w * scalex; 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); if (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 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 (xx = -er->rad; xx <= er->rad; xx++) - { - if ((xx * xx) + (yy * yy) <= (er->rad * er->rad)) - { - nnx = nx + xx; - nny = ny + yy; + { + if ((xx * xx) + (yy * yy) <= (er->rad * er->rad)) + { + nnx = nx + xx; + nny = ny + yy; - p1 = im_data + (nny * er->w) + nnx; - b = (int) ((*p1) & 0xff); - g = (int) ((*p1 >> 8) & 0xff); - r = (int) ((*p1 >> 16) & 0xff); - a = (int) ((*p1 >> 24) & 0xff); - b = ephoto_mul_color_alpha(b, a); - g = ephoto_mul_color_alpha(g, a); - r = ephoto_mul_color_alpha(r, a); - r = (int) ((g+b)/2); - b = ephoto_normalize_color(b); - g = ephoto_normalize_color(g); - r = ephoto_normalize_color(r); - b = ephoto_demul_color_alpha(b, a); - g = ephoto_demul_color_alpha(g, a); - r = ephoto_demul_color_alpha(r, a); - *p1 = (a << 24) | (r << 16) | (g << 8) | b; + p1 = im_data + (nny * er->w) + nnx; + b = (int)((*p1) & 0xff); + g = (int)((*p1 >> 8) & 0xff); + r = (int)((*p1 >> 16) & 0xff); + a = (int)((*p1 >> 24) & 0xff); + b = ephoto_mul_color_alpha(b, a); + g = ephoto_mul_color_alpha(g, a); + r = ephoto_mul_color_alpha(r, a); + r = (int)((g + b) / 2); + b = ephoto_normalize_color(b); + g = ephoto_normalize_color(g); + r = ephoto_normalize_color(r); + b = ephoto_demul_color_alpha(b, a); + g = ephoto_demul_color_alpha(g, a); + r = ephoto_demul_color_alpha(r, a); + *p1 = (a << 24) | (r << 16) | (g << 8) | b; } } } er->edited_im_data = im_data; ephoto_single_browser_image_data_update(er->main, er->image, - im_data, er->w, er->h); + im_data, er->w, er->h); } static void @@ -96,7 +96,7 @@ _radius_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSE static Eina_Bool _reye_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Reye *er = data; @@ -108,14 +108,14 @@ _reye_reset(void *data, int type EINA_UNUSED, er->edited_im_data = NULL; } 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; } static Eina_Bool _reye_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Reye *er = data; unsigned int *image_data; @@ -128,7 +128,7 @@ _reye_apply(void *data, int type EINA_UNUSED, else { 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); 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 _reye_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Reye *er = data; @@ -159,7 +159,7 @@ _reye_cancel(void *data, int type EINA_UNUSED, static void _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; 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->image = image; im_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, &er->w, - &er->h); + &er->h); er->original_im_data = malloc(sizeof(unsigned int) * er->w * er->h); 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, - _reye_clicked, er); + _reye_clicked, er); 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, - er); + er); slider = elm_slider_add(er->editor); 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_ALIGN(slider, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(slider, "delay,changed", - _radius_slider_changed, er); + _radius_slider_changed, er); elm_box_pack_start(er->editor, slider); evas_object_show(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); er->handlers = - eina_list_append(er->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _reye_reset, er)); + eina_list_append(er->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _reye_reset, er)); er->handlers = - eina_list_append(er->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _reye_apply, er)); + eina_list_append(er->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _reye_apply, er)); er->handlers = - eina_list_append(er->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _reye_cancel, er)); + eina_list_append(er->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _reye_cancel, er)); return; - error: +error: return; } + diff --git a/src/bin/ephoto_scale.c b/src/bin/ephoto_scale.c index 4ec95ce..d92be81 100644 --- a/src/bin/ephoto_scale.c +++ b/src/bin/ephoto_scale.c @@ -3,27 +3,27 @@ typedef struct _Ephoto_Scale Ephoto_Scale; struct _Ephoto_Scale { - Evas_Object *main; - Evas_Object *parent; - Evas_Object *image; - Evas_Object *editor; - Evas_Object *scalew; - Evas_Object *scaleh; - Evas_Object *aspect; + Evas_Object *main; + Evas_Object *parent; + Evas_Object *image; + Evas_Object *editor; + Evas_Object *scalew; + Evas_Object *scaleh; + Evas_Object *aspect; Eina_Stringshare *tmp_file; - Eina_List *handlers; - double aspectw; - double aspecth; - Evas_Coord w, h; - unsigned int *original_im_data; + Eina_List *handlers; + double aspectw; + double aspecth; + Evas_Coord w, h; + unsigned int *original_im_data; }; static void _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); + void *event_info EINA_UNUSED); static void _scale_height_changed(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Scale *es = data; double nw; @@ -31,27 +31,27 @@ _scale_height_changed(void *data, Evas_Object *obj EINA_UNUSED, if (!elm_check_state_get(es->aspect)) return; evas_object_smart_callback_del(es->scalew, "changed", - _scale_width_changed); + _scale_width_changed); nw = round(es->aspectw * elm_spinner_value_get(es->scaleh)); if (nw <= 1) { double nh; evas_object_smart_callback_del(es->scaleh, "changed", - _scale_height_changed); + _scale_height_changed); nh = round(es->aspecth * 1); elm_spinner_value_set(es->scaleh, nh); evas_object_smart_callback_add(es->scaleh, "changed", - _scale_height_changed, es); + _scale_height_changed, es); nw = 1; } elm_spinner_value_set(es->scalew, nw); evas_object_smart_callback_add(es->scalew, "changed", - _scale_width_changed, es); + _scale_width_changed, es); } static void _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Scale *es = data; double nh; @@ -59,28 +59,28 @@ _scale_width_changed(void *data, Evas_Object *obj EINA_UNUSED, if (!elm_check_state_get(es->aspect)) return; evas_object_smart_callback_del(es->scaleh, "changed", - _scale_height_changed); + _scale_height_changed); nh = round(es->aspecth * elm_spinner_value_get(es->scalew)); if (nh <= 1) { double nw; evas_object_smart_callback_del(es->scalew, "changed", - _scale_width_changed); + _scale_width_changed); nw = round(es->aspectw * 1); elm_spinner_value_set(es->scalew, nw); evas_object_smart_callback_add(es->scalew, "changed", - _scale_width_changed, es); + _scale_width_changed, es); nh = 1; } elm_spinner_value_set(es->scaleh, nh); evas_object_smart_callback_add(es->scaleh, "changed", - _scale_height_changed, es); + _scale_height_changed, es); } static Eina_Bool _es_reset(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Scale *es = data; @@ -88,13 +88,13 @@ _es_reset(void *data, int type EINA_UNUSED, elm_spinner_value_set(es->scaleh, es->h); es->aspectw = (double)es->w / (double)es->h; es->aspecth = (double)es->h / (double)es->w; - + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _es_apply(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Scale *es = 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)); h = round(elm_spinner_value_get(es->scaleh)); evas_object_image_file_get(es->image, - NULL, &key); + NULL, &key); ee = ecore_evas_buffer_new(1, 1); eecanvas = ecore_evas_get(ee); @@ -153,7 +153,7 @@ _es_apply(void *data, int type EINA_UNUSED, static Eina_Bool _es_cancel(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Scale *es = data; @@ -165,7 +165,7 @@ _es_cancel(void *data, int type EINA_UNUSED, static void _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; Ecore_Event_Handler *handler; @@ -180,7 +180,7 @@ _editor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void 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; unsigned int *im_data; @@ -196,28 +196,28 @@ ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, es->image = image; snprintf(buf, PATH_MAX, "%s/temp.%s", ephoto->config_path, - strrchr(file, '.')+1); + strrchr(file, '.') + 1); es->tmp_file = eina_stringshare_add(buf); if (ecore_file_exists(es->tmp_file)) ecore_file_unlink(es->tmp_file); evas_object_image_save(es->image, es->tmp_file, - NULL, NULL); + NULL, NULL); im_data = - evas_object_image_data_get(es->image, - EINA_FALSE); + evas_object_image_data_get(es->image, + EINA_FALSE); 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); 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->aspecth = (double)es->h / (double)es->w; 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, - es); + es); es->aspect = elm_check_add(es->editor); 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); es->handlers = - eina_list_append(es->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, - _es_reset, es)); + eina_list_append(es->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_RESET, + _es_reset, es)); es->handlers = - eina_list_append(es->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, - _es_apply, es)); + eina_list_append(es->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_APPLY, + _es_apply, es)); es->handlers = - eina_list_append(es->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, - _es_cancel, es)); + eina_list_append(es->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_CANCEL, + _es_cancel, es)); return; - error: +error: return; } diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 67ec395..1d446f0 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -5,83 +5,83 @@ static Ecore_Timer *_1s_hold = NULL; typedef struct _Ephoto_Single_Browser Ephoto_Single_Browser; -typedef struct _Ephoto_Viewer Ephoto_Viewer; -typedef struct _Ephoto_History Ephoto_History; +typedef struct _Ephoto_Viewer Ephoto_Viewer; +typedef struct _Ephoto_History Ephoto_History; struct _Ephoto_Single_Browser { - Ephoto *ephoto; - Evas_Object *main; - Evas_Object *mhbox; - Evas_Object *table; - Evas_Object *viewer; - Evas_Object *nolabel; - Evas_Object *event; - Evas_Object *edit_main; + Ephoto *ephoto; + Evas_Object *main; + Evas_Object *mhbox; + Evas_Object *table; + Evas_Object *viewer; + Evas_Object *nolabel; + Evas_Object *event; + Evas_Object *edit_main; Elm_Object_Item *save; - const char *pending_path; - Ephoto_Entry *entry; - Ephoto_Orient orient; - Eina_List *handlers; - Eina_List *entries; - Eina_List *history; - unsigned int history_pos; - Eina_Bool editing:1; - Eina_Bool cropping:1; + const char *pending_path; + Ephoto_Entry *entry; + Ephoto_Orient orient; + Eina_List *handlers; + Eina_List *entries; + Eina_List *history; + unsigned int history_pos; + Eina_Bool editing : 1; + Eina_Bool cropping : 1; }; struct _Ephoto_Viewer { - Eina_List *handlers; + Eina_List *handlers; Eio_Monitor *monitor; - Eina_List *monitor_handlers; + Eina_List *monitor_handlers; Evas_Object *scroller; Evas_Object *table; Evas_Object *image; - double zoom; - Eina_Bool fit:1; - Eina_Bool zoom_first:1; - double duration; - int frame_count; - int cur_frame; + double zoom; + Eina_Bool fit : 1; + Eina_Bool zoom_first : 1; + double duration; + int frame_count; + int cur_frame; Ecore_Timer *anim_timer; }; struct _Ephoto_History { unsigned int *im_data; - Evas_Coord w; - Evas_Coord h; + Evas_Coord w; + Evas_Coord h; Ephoto_Orient orient; }; /*Common Callbacks*/ -static void _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb); -static const char *_ephoto_get_edje_group(const char *path); -static char *_ephoto_get_file_size(const char *path); -static void _ephoto_update_bottom_bar(Ephoto_Single_Browser *sb); +static void _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb); +static const char *_ephoto_get_edje_group(const char *path); +static char *_ephoto_get_file_size(const char *path); +static void _ephoto_update_bottom_bar(Ephoto_Single_Browser *sb); /*Main Callbacks*/ -static void _ephoto_main_edit_menu(Ephoto_Single_Browser *sb); -static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED,void *event_info EINA_UNUSED); -static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static void _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); -static void _next_entry(Ephoto_Single_Browser *sb); -static void _orient_apply(Ephoto_Single_Browser *sb); +static void _ephoto_main_edit_menu(Ephoto_Single_Browser *sb); +static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static void _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _next_entry(Ephoto_Single_Browser *sb); +static void _orient_apply(Ephoto_Single_Browser *sb); /*Vewer Callbacks*/ -static double _viewer_zoom_get(Evas_Object *obj); -static void _viewer_zoom_set(Evas_Object *obj, double zoom); -static void _viewer_zoom_fit(Evas_Object *obj); +static double _viewer_zoom_get(Evas_Object *obj); +static void _viewer_zoom_set(Evas_Object *obj, double zoom); +static void _viewer_zoom_fit(Evas_Object *obj); /*Common*/ static const char * -_ephoto_get_edje_group(const char *path) +_ephoto_get_edje_group(const char *path) { const char *group = NULL; const char *ext = strrchr(path, '.'); @@ -92,7 +92,7 @@ _ephoto_get_edje_group(const char *path) if ((strcasecmp(ext, "edj") == 0)) { if (edje_file_group_exists(path, "e/desktop/background")) - group = "e/desktop/background"; + group = "e/desktop/background"; else { Eina_List *g = edje_file_collection_list(path); @@ -116,12 +116,12 @@ _ephoto_update_bottom_bar(Ephoto_Single_Browser *sb) return; evas_object_image_size_get(v->image, - &w, &h); + &w, &h); tmp = _ephoto_get_file_size(sb->entry->path); snprintf(image_info, PATH_MAX, - "%s: %s %s: %dx%d %s: %s", - _("Type"), efreet_mime_type_get(sb->entry->path), - _("Resolution"), w, h, _("File Size"), tmp); + "%s: %s %s: %dx%d %s: %s", + _("Type"), efreet_mime_type_get(sb->entry->path), + _("Resolution"), w, h, _("File Size"), tmp); free(tmp); elm_object_text_set(sb->ephoto->infolabel, image_info); @@ -135,44 +135,44 @@ _ephoto_get_file_size(const char *path) size_t size = eina_file_size_get(f); eina_file_close(f); - double dsize = (double) size; + double dsize = (double)size; if (dsize < 1024.0) - snprintf(isize, sizeof(isize), "%'.0f%s", dsize, ngettext("B", "B", - dsize)); + snprintf(isize, sizeof(isize), "%'.0f%s", dsize, ngettext("B", "B", + dsize)); else { - dsize /= 1024.0; - if (dsize < 1024) - snprintf(isize, sizeof(isize), "%'.0f%s", dsize, - ngettext("KB", "KB", dsize)); - else - { - dsize /= 1024.0; - if (dsize < 1024) - snprintf(isize, sizeof(isize), "%'.1f%s", dsize, - ngettext("MB", "MB", dsize)); - else - { - dsize /= 1024.0; - if (dsize < 1024) - snprintf(isize, sizeof(isize), "%'.1f%s", dsize, - ngettext("GB", "GB", dsize)); - else - { - dsize /= 1024.0; - snprintf(isize, sizeof(isize), "%'.1f%s", dsize, - ngettext("TB", "TB", dsize)); - } - } - } + dsize /= 1024.0; + if (dsize < 1024) + snprintf(isize, sizeof(isize), "%'.0f%s", dsize, + ngettext("KB", "KB", dsize)); + else + { + dsize /= 1024.0; + if (dsize < 1024) + snprintf(isize, sizeof(isize), "%'.1f%s", dsize, + ngettext("MB", "MB", dsize)); + else + { + dsize /= 1024.0; + if (dsize < 1024) + snprintf(isize, sizeof(isize), "%'.1f%s", dsize, + ngettext("GB", "GB", dsize)); + else + { + dsize /= 1024.0; + snprintf(isize, sizeof(isize), "%'.1f%s", dsize, + ngettext("TB", "TB", dsize)); + } + } + } } return strdup(isize); } static void _menu_dismissed_cb(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -183,7 +183,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj, /*Image Viewer Callbacks*/ static Evas_Object * _image_create_icon(void *data, Evas_Object *parent, Evas_Coord *xoff, - Evas_Coord *yoff) + Evas_Coord *yoff) { Evas_Object *ic; Evas_Object *io = data; @@ -200,9 +200,9 @@ _image_create_icon(void *data, Evas_Object *parent, Evas_Coord *xoff, evas_pointer_canvas_xy_get(evas_object_evas_get(io), &xm, &ym); if (xoff) - *xoff = xm - 30; + *xoff = xm - 30; if (yoff) - *yoff = ym - 30; + *yoff = ym - 30; return ic; } @@ -218,7 +218,7 @@ _1s_hold_time(void *data) snprintf(dd, sizeof(dd), "file://%s", f); elm_drag_start(io, ELM_SEL_FORMAT_IMAGE, dd, ELM_XDND_ACTION_COPY, - _image_create_icon, io, NULL, NULL, NULL, NULL, NULL, NULL); + _image_create_icon, io, NULL, NULL, NULL, NULL, NULL, NULL); _1s_hold = NULL; return ECORE_CALLBACK_CANCEL; @@ -226,7 +226,7 @@ _1s_hold_time(void *data) static void _image_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, - Evas_Object *obj, void *event_info) + Evas_Object *obj, void *event_info) { Evas_Object *io = obj; Evas_Event_Mouse_Down *ev = event_info; @@ -244,7 +244,7 @@ _image_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, static void _image_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_Single_Browser *sb = data; Evas_Event_Mouse_Up *ev = event_info; @@ -270,7 +270,7 @@ _image_mouse_up_cb(void *data, Evas *e EINA_UNUSED, static void _scroller_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_Single_Browser *sb = data; Evas_Event_Mouse_Up *ev = event_info; @@ -286,7 +286,7 @@ _scroller_mouse_up_cb(void *data, Evas *e EINA_UNUSED, static void _viewer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Viewer *v = data; Ecore_Event_Handler *handler; @@ -303,7 +303,7 @@ _viewer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, static Eina_Bool _monitor_cb(void *data, int type, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -340,7 +340,7 @@ _monitor_cb(void *data, int type, { if (!ecore_file_exists(sb->entry->path)) _ephoto_main_back(sb, NULL, NULL); - } + } return ECORE_CALLBACK_PASS_ON; } @@ -372,12 +372,12 @@ _viewer_zoom_fit_apply(Ephoto_Viewer *v) evas_object_image_size_get(image, &iw, &ih); if ((cw <= 0) || (ch <= 0)) - return; + return; EINA_SAFETY_ON_TRUE_RETURN(iw <= 0); EINA_SAFETY_ON_TRUE_RETURN(ih <= 0); - zx = (double) (cw-15) / (double) iw; - zy = (double) (ch-15) / (double) ih; + zx = (double)(cw - 15) / (double)iw; + zy = (double)(ch - 15) / (double)ih; zoom = (zx < zy) ? zx : zy; _viewer_zoom_apply(v, zoom); @@ -385,30 +385,30 @@ _viewer_zoom_fit_apply(Ephoto_Viewer *v) static void _viewer_resized(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Viewer *v = data; if (v->zoom_first) { - Evas_Coord cw, ch, iw, ih; - Evas_Object *image; + Evas_Coord cw, ch, iw, ih; + Evas_Object *image; - image = v->image; - evas_object_geometry_get(v->scroller, NULL, NULL, &cw, &ch); - evas_object_image_size_get(image, &iw, &ih); + image = v->image; + evas_object_geometry_get(v->scroller, NULL, NULL, &cw, &ch); + evas_object_image_size_get(image, &iw, &ih); - if ((cw <= 0) || (ch <= 0)) - return; - EINA_SAFETY_ON_TRUE_RETURN(iw <= 0); - EINA_SAFETY_ON_TRUE_RETURN(ih <= 0); - if (iw < cw && ih < ch) - _viewer_zoom_apply(v, 1); - else - _viewer_zoom_fit_apply(v); + if ((cw <= 0) || (ch <= 0)) + return; + EINA_SAFETY_ON_TRUE_RETURN(iw <= 0); + EINA_SAFETY_ON_TRUE_RETURN(ih <= 0); + if (iw < cw && ih < ch) + _viewer_zoom_apply(v, 1); + else + _viewer_zoom_fit_apply(v); } else - _viewer_zoom_fit_apply(v); + _viewer_zoom_fit_apply(v); } static void @@ -420,9 +420,9 @@ _viewer_zoom_set(Evas_Object *obj, double zoom) if (v->fit) { - evas_object_event_callback_del_full(v->scroller, EVAS_CALLBACK_RESIZE, - _viewer_resized, v); - v->fit = EINA_FALSE; + evas_object_event_callback_del_full(v->scroller, EVAS_CALLBACK_RESIZE, + _viewer_resized, v); + v->fit = EINA_FALSE; } } @@ -440,11 +440,11 @@ _viewer_zoom_fit(Evas_Object *obj) Ephoto_Viewer *v = evas_object_data_get(obj, "viewer"); if (v->fit) - return; + return; v->fit = EINA_TRUE; evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_RESIZE, - _viewer_resized, v); + _viewer_resized, v); _viewer_zoom_fit_apply(v); } @@ -456,40 +456,40 @@ _orient_set(Ephoto_Single_Browser *sb, Ephoto_Orient orient) switch (orient) { - case EPHOTO_ORIENT_0: - evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_NONE); - break; + case EPHOTO_ORIENT_0: + evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_NONE); + break; - case EPHOTO_ORIENT_90: - evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_90); - break; + case EPHOTO_ORIENT_90: + evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_90); + break; - case EPHOTO_ORIENT_180: - evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_180); - break; + case EPHOTO_ORIENT_180: + evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_180); + break; - case EPHOTO_ORIENT_270: - evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_270); - break; + case EPHOTO_ORIENT_270: + evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_270); + break; - case EPHOTO_ORIENT_FLIP_HORIZ: - evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_HORIZONTAL); - break; + case EPHOTO_ORIENT_FLIP_HORIZ: + evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_HORIZONTAL); + break; - case EPHOTO_ORIENT_FLIP_VERT: - evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_VERTICAL); - break; + case EPHOTO_ORIENT_FLIP_VERT: + evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_VERTICAL); + break; - case EPHOTO_ORIENT_FLIP_HORIZ_90: - evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_TRANSPOSE); - break; + case EPHOTO_ORIENT_FLIP_HORIZ_90: + evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_TRANSPOSE); + break; - case EPHOTO_ORIENT_FLIP_VERT_90: - evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_TRANSVERSE); - break; + case EPHOTO_ORIENT_FLIP_VERT_90: + evas_object_image_orient_set(v->image, EVAS_IMAGE_FLIP_TRANSVERSE); + break; - default: - return; + default: + return; } } @@ -511,7 +511,7 @@ _orient_apply(Ephoto_Single_Browser *sb) evas_object_size_hint_max_set(v->image, w, h); elm_table_pack(v->table, v->image, 0, 0, 1, 1); elm_object_content_set(v->scroller, v->table); - if (sb->history_pos < (eina_list_count(sb->history)-1)) + if (sb->history_pos < (eina_list_count(sb->history) - 1)) { int count; @@ -530,7 +530,7 @@ _orient_apply(Ephoto_Single_Browser *sb) eh = calloc(1, sizeof(Ephoto_History)); eh->im_data = malloc(sizeof(unsigned int) * w * h); eh->im_data = memcpy(eh->im_data, evas_object_image_data_get(v->image, EINA_FALSE), - sizeof(unsigned int) * w * h); + sizeof(unsigned int) * w * h); eh->w = w; eh->h = h; eh->orient = sb->orient; @@ -541,9 +541,9 @@ _orient_apply(Ephoto_Single_Browser *sb) _ephoto_update_bottom_bar(sb); if (v->fit) - _viewer_zoom_fit_apply(v); + _viewer_zoom_fit_apply(v); else - _viewer_zoom_set(sb->viewer, _viewer_zoom_get(sb->viewer)); + _viewer_zoom_set(sb->viewer, _viewer_zoom_get(sb->viewer)); } static void @@ -551,41 +551,41 @@ _rotate_counterclock(Ephoto_Single_Browser *sb) { switch (sb->orient) { - case EPHOTO_ORIENT_0: - sb->orient = EPHOTO_ORIENT_270; - break; + case EPHOTO_ORIENT_0: + sb->orient = EPHOTO_ORIENT_270; + break; - case EPHOTO_ORIENT_90: - sb->orient = EPHOTO_ORIENT_0; - break; + case EPHOTO_ORIENT_90: + sb->orient = EPHOTO_ORIENT_0; + break; - case EPHOTO_ORIENT_180: - sb->orient = EPHOTO_ORIENT_90; - break; + case EPHOTO_ORIENT_180: + sb->orient = EPHOTO_ORIENT_90; + break; - case EPHOTO_ORIENT_270: - sb->orient = EPHOTO_ORIENT_180; - break; + case EPHOTO_ORIENT_270: + sb->orient = EPHOTO_ORIENT_180; + break; - case EPHOTO_ORIENT_FLIP_HORIZ: - sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; - break; + case EPHOTO_ORIENT_FLIP_HORIZ: + sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; + break; - case EPHOTO_ORIENT_FLIP_VERT_90: - sb->orient = EPHOTO_ORIENT_FLIP_VERT; - break; + case EPHOTO_ORIENT_FLIP_VERT_90: + sb->orient = EPHOTO_ORIENT_FLIP_VERT; + break; - case EPHOTO_ORIENT_FLIP_VERT: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; - break; + case EPHOTO_ORIENT_FLIP_VERT: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; + break; - case EPHOTO_ORIENT_FLIP_HORIZ_90: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; - break; + case EPHOTO_ORIENT_FLIP_HORIZ_90: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; + break; - default: - sb->orient = EPHOTO_ORIENT_0; - break; + default: + sb->orient = EPHOTO_ORIENT_0; + break; } _orient_apply(sb); } @@ -595,41 +595,41 @@ _rotate_clock(Ephoto_Single_Browser *sb) { switch (sb->orient) { - case EPHOTO_ORIENT_0: - sb->orient = EPHOTO_ORIENT_90; - break; + case EPHOTO_ORIENT_0: + sb->orient = EPHOTO_ORIENT_90; + break; - case EPHOTO_ORIENT_90: - sb->orient = EPHOTO_ORIENT_180; - break; + case EPHOTO_ORIENT_90: + sb->orient = EPHOTO_ORIENT_180; + break; - case EPHOTO_ORIENT_180: - sb->orient = EPHOTO_ORIENT_270; - break; + case EPHOTO_ORIENT_180: + sb->orient = EPHOTO_ORIENT_270; + break; - case EPHOTO_ORIENT_270: - sb->orient = EPHOTO_ORIENT_0; - break; + case EPHOTO_ORIENT_270: + sb->orient = EPHOTO_ORIENT_0; + break; - case EPHOTO_ORIENT_FLIP_HORIZ: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; - break; + case EPHOTO_ORIENT_FLIP_HORIZ: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; + break; - case EPHOTO_ORIENT_FLIP_VERT_90: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; - break; + case EPHOTO_ORIENT_FLIP_VERT_90: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; + break; - case EPHOTO_ORIENT_FLIP_VERT: - sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; - break; + case EPHOTO_ORIENT_FLIP_VERT: + sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; + break; - case EPHOTO_ORIENT_FLIP_HORIZ_90: - sb->orient = EPHOTO_ORIENT_FLIP_VERT; - break; + case EPHOTO_ORIENT_FLIP_HORIZ_90: + sb->orient = EPHOTO_ORIENT_FLIP_VERT; + break; - default: - sb->orient = EPHOTO_ORIENT_0; - break; + default: + sb->orient = EPHOTO_ORIENT_0; + break; } _orient_apply(sb); } @@ -639,41 +639,41 @@ _flip_horiz(Ephoto_Single_Browser *sb) { switch (sb->orient) { - case EPHOTO_ORIENT_0: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; - break; + case EPHOTO_ORIENT_0: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; + break; - case EPHOTO_ORIENT_90: - sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; - break; + case EPHOTO_ORIENT_90: + sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; + break; - case EPHOTO_ORIENT_180: - sb->orient = EPHOTO_ORIENT_FLIP_VERT; - break; + case EPHOTO_ORIENT_180: + sb->orient = EPHOTO_ORIENT_FLIP_VERT; + break; - case EPHOTO_ORIENT_270: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; - break; + case EPHOTO_ORIENT_270: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; + break; - case EPHOTO_ORIENT_FLIP_HORIZ: - sb->orient = EPHOTO_ORIENT_0; - break; + case EPHOTO_ORIENT_FLIP_HORIZ: + sb->orient = EPHOTO_ORIENT_0; + break; - case EPHOTO_ORIENT_FLIP_VERT_90: - sb->orient = EPHOTO_ORIENT_90; - break; + case EPHOTO_ORIENT_FLIP_VERT_90: + sb->orient = EPHOTO_ORIENT_90; + break; - case EPHOTO_ORIENT_FLIP_VERT: - sb->orient = EPHOTO_ORIENT_180; - break; + case EPHOTO_ORIENT_FLIP_VERT: + sb->orient = EPHOTO_ORIENT_180; + break; - case EPHOTO_ORIENT_FLIP_HORIZ_90: - sb->orient = EPHOTO_ORIENT_270; - break; + case EPHOTO_ORIENT_FLIP_HORIZ_90: + sb->orient = EPHOTO_ORIENT_270; + break; - default: - sb->orient = EPHOTO_ORIENT_0; - break; + default: + sb->orient = EPHOTO_ORIENT_0; + break; } _orient_apply(sb); } @@ -683,41 +683,41 @@ _flip_vert(Ephoto_Single_Browser *sb) { switch (sb->orient) { - case EPHOTO_ORIENT_0: - sb->orient = EPHOTO_ORIENT_FLIP_VERT; - break; + case EPHOTO_ORIENT_0: + sb->orient = EPHOTO_ORIENT_FLIP_VERT; + break; - case EPHOTO_ORIENT_90: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; - break; + case EPHOTO_ORIENT_90: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ_90; + break; - case EPHOTO_ORIENT_180: - sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; - break; + case EPHOTO_ORIENT_180: + sb->orient = EPHOTO_ORIENT_FLIP_HORIZ; + break; - case EPHOTO_ORIENT_270: - sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; - break; + case EPHOTO_ORIENT_270: + sb->orient = EPHOTO_ORIENT_FLIP_VERT_90; + break; - case EPHOTO_ORIENT_FLIP_HORIZ: - sb->orient = EPHOTO_ORIENT_180; - break; + case EPHOTO_ORIENT_FLIP_HORIZ: + sb->orient = EPHOTO_ORIENT_180; + break; - case EPHOTO_ORIENT_FLIP_VERT_90: - sb->orient = EPHOTO_ORIENT_270; - break; + case EPHOTO_ORIENT_FLIP_VERT_90: + sb->orient = EPHOTO_ORIENT_270; + break; - case EPHOTO_ORIENT_FLIP_VERT: - sb->orient = EPHOTO_ORIENT_0; - break; + case EPHOTO_ORIENT_FLIP_VERT: + sb->orient = EPHOTO_ORIENT_0; + break; - case EPHOTO_ORIENT_FLIP_HORIZ_90: - sb->orient = EPHOTO_ORIENT_90; - break; + case EPHOTO_ORIENT_FLIP_HORIZ_90: + sb->orient = EPHOTO_ORIENT_90; + break; - default: - sb->orient = EPHOTO_ORIENT_0; - break; + default: + sb->orient = EPHOTO_ORIENT_0; + break; } _orient_apply(sb); } @@ -738,7 +738,7 @@ static void _zoom_set(Ephoto_Single_Browser *sb, double zoom) { if (zoom <= 0.0) - return; + return; _viewer_zoom_set(sb->viewer, zoom); } @@ -746,7 +746,7 @@ static void _zoom_fit(Ephoto_Single_Browser *sb) { if (sb->viewer) - _viewer_zoom_fit(sb->viewer); + _viewer_zoom_fit(sb->viewer); } static void @@ -767,7 +767,7 @@ _zoom_out(Ephoto_Single_Browser *sb) static void _zoom_in_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -778,7 +778,7 @@ _zoom_in_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _zoom_out_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -789,7 +789,7 @@ _zoom_out_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _zoom_1_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -800,36 +800,36 @@ _zoom_1_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _zoom_fit_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); Eina_Bool first_click; if (v->zoom_first) - first_click = EINA_TRUE; + first_click = EINA_TRUE; else - first_click = EINA_FALSE; + first_click = EINA_FALSE; v->zoom_first = EINA_FALSE; if (first_click) - v->fit = EINA_FALSE; + v->fit = EINA_FALSE; _zoom_fit(sb); } static void _mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Single_Browser *sb = data; Evas_Event_Mouse_Wheel *ev = event_info; if (!evas_key_modifier_is_set(ev->modifiers, "Control")) - return; + return; if (ev->z > 0) - _zoom_out(sb); + _zoom_out(sb); else - _zoom_in(sb); + _zoom_in(sb); } static void @@ -840,14 +840,14 @@ _next_entry(Ephoto_Single_Browser *sb) node = eina_list_data_find_list(sb->entries, sb->entry); if (!node) - return; + return; if ((node = node->next)) - entry = node->data; + entry = node->data; if (!entry) - entry = _first_entry_find(sb); + entry = _first_entry_find(sb); if (entry) { - ephoto_single_browser_entry_set(sb->main, entry); + ephoto_single_browser_entry_set(sb->main, entry); } } @@ -858,14 +858,14 @@ _prev_entry(Ephoto_Single_Browser *sb) Ephoto_Entry *entry = NULL; node = eina_list_data_find_list(sb->entries, sb->entry); if (!node) - return; + return; if ((node = node->prev)) - entry = node->data; + entry = node->data; if (!entry) - entry = _last_entry_find(sb); + entry = _last_entry_find(sb); if (entry) { - ephoto_single_browser_entry_set(sb->main, entry); + ephoto_single_browser_entry_set(sb->main, entry); } } @@ -875,7 +875,7 @@ _first_entry(Ephoto_Single_Browser *sb) Ephoto_Entry *entry = _first_entry_find(sb); if (!entry) - return; + return; ephoto_single_browser_entry_set(sb->main, entry); } @@ -886,14 +886,14 @@ _last_entry(Ephoto_Single_Browser *sb) Ephoto_Entry *entry = _last_entry_find(sb); if (!entry) - return; + return; ephoto_single_browser_entry_set(sb->main, entry); } static void _undo_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -928,7 +928,7 @@ _undo_image(void *data, Evas_Object *obj EINA_UNUSED, static void _redo_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -937,7 +937,7 @@ _redo_image(void *data, Evas_Object *obj EINA_UNUSED, if (!v) return; - if (sb->history && sb->history_pos < (eina_list_count(sb->history)-1)) + if (sb->history && sb->history_pos < (eina_list_count(sb->history) - 1)) { sb->history_pos++; eh = eina_list_nth(sb->history, sb->history_pos); @@ -963,7 +963,7 @@ _redo_image(void *data, Evas_Object *obj EINA_UNUSED, static void _reset_yes(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto_Single_Browser *sb = evas_object_data_get(popup, "single_browser"); @@ -979,7 +979,7 @@ _reset_yes(void *data, Evas_Object *obj EINA_UNUSED, static void _reset_no(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *popup = data; Ephoto_Single_Browser *sb = evas_object_data_get(popup, "single_browser"); @@ -993,7 +993,7 @@ _reset_no(void *data, Evas_Object *obj EINA_UNUSED, static void _reset_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Evas_Object *popup, *box, *label, *ic, *button; @@ -1010,7 +1010,7 @@ _reset_image(void *data, Evas_Object *obj EINA_UNUSED, label = elm_label_add(box); elm_object_text_set(label, - _("Are you sure you want to reset your changes?")); + _("Are you sure you want to reset your changes?")); EPHOTO_EXPAND(label); EPHOTO_FILL(label); elm_box_pack_end(box, label); @@ -1045,7 +1045,7 @@ _reset_image(void *data, Evas_Object *obj EINA_UNUSED, static void _close_editor(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1062,7 +1062,7 @@ _close_editor(void *data, Evas_Object *obj EINA_UNUSED, static void _save_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -1072,7 +1072,7 @@ _save_image(void *data, Evas_Object *obj EINA_UNUSED, static void _save_image_as(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); @@ -1082,7 +1082,7 @@ _save_image_as(void *data, Evas_Object *obj EINA_UNUSED, static void _upload_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1091,7 +1091,7 @@ _upload_image(void *data, Evas_Object *obj EINA_UNUSED, static void _delete_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Eina_List *files = NULL; @@ -1102,7 +1102,7 @@ _delete_image(void *data, Evas_Object *obj EINA_UNUSED, static void _rename_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1111,7 +1111,7 @@ _rename_image(void *data, Evas_Object *obj EINA_UNUSED, static void _go_prev(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1120,7 +1120,7 @@ _go_prev(void *data, Evas_Object *obj EINA_UNUSED, static void _go_next(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1129,7 +1129,7 @@ _go_next(void *data, Evas_Object *obj EINA_UNUSED, static void _go_rotate_counterclock(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1138,7 +1138,7 @@ _go_rotate_counterclock(void *data, Evas_Object *obj EINA_UNUSED, static void _go_rotate_clock(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1147,7 +1147,7 @@ _go_rotate_clock(void *data, Evas_Object *obj EINA_UNUSED, static void _go_flip_horiz(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1156,7 +1156,7 @@ _go_flip_horiz(void *data, Evas_Object *obj EINA_UNUSED, static void _go_flip_vert(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1165,20 +1165,20 @@ _go_flip_vert(void *data, Evas_Object *obj EINA_UNUSED, static void _crop_image(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - sb->cropping = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + sb->cropping = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); evas_object_del(sb->edit_main); sb->edit_main = NULL; - elm_table_unpack(v->table, v->image); - ephoto_cropper_add(sb->ephoto, sb->main, sb->mhbox, v->table, v->image); + elm_table_unpack(v->table, v->image); + ephoto_cropper_add(sb->ephoto, sb->main, sb->mhbox, v->table, v->image); } } @@ -1191,7 +1191,7 @@ _scale_image(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNU { sb->editing = EINA_TRUE; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - + evas_object_del(sb->edit_main); sb->edit_main = NULL; ephoto_scale_add(sb->ephoto, sb->main, sb->mhbox, v->image, sb->entry->path); @@ -1205,12 +1205,12 @@ _go_bcg(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) if (sb->viewer) { - sb->editing = EINA_TRUE; + sb->editing = EINA_TRUE; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); evas_object_del(sb->edit_main); sb->edit_main = NULL; - ephoto_bcg_add(sb->ephoto, sb->main, sb->mhbox, v->image); + ephoto_bcg_add(sb->ephoto, sb->main, sb->mhbox, v->image); } } @@ -1221,35 +1221,35 @@ _go_hsv(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); evas_object_del(sb->edit_main); sb->edit_main = NULL; - ephoto_hsv_add(sb->ephoto, sb->main, sb->mhbox, v->image); + ephoto_hsv_add(sb->ephoto, sb->main, sb->mhbox, v->image); } } static void _go_color(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); evas_object_del(sb->edit_main); sb->edit_main = NULL; - ephoto_color_add(sb->ephoto, sb->main, sb->mhbox, v->image); + ephoto_color_add(sb->ephoto, sb->main, sb->mhbox, v->image); } } static void _go_reye(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1266,52 +1266,52 @@ _go_reye(void *data, Evas_Object *obj EINA_UNUSED, static void _go_auto_eq(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - ephoto_filter_histogram_eq(sb->ephoto, v->image); + ephoto_filter_histogram_eq(sb->ephoto, v->image); } } static void _go_blur(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - ephoto_filter_blur(sb->ephoto, v->image); + ephoto_filter_blur(sb->ephoto, v->image); } } static void _go_sharpen(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - ephoto_filter_sharpen(sb->ephoto, v->image); + ephoto_filter_sharpen(sb->ephoto, v->image); } } static void _go_dither(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1326,37 +1326,37 @@ _go_dither(void *data, Evas_Object *obj EINA_UNUSED, static void _go_black_and_white(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; + sb->editing = EINA_TRUE; Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - ephoto_filter_black_and_white(sb->ephoto, v->image); + ephoto_filter_black_and_white(sb->ephoto, v->image); } } static void _go_old_photo(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (sb->viewer) { - sb->editing = EINA_TRUE; - Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); + sb->editing = EINA_TRUE; + Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - ephoto_filter_old_photo(sb->ephoto, v->image); + ephoto_filter_old_photo(sb->ephoto, v->image); } } static void _go_posterize(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1371,7 +1371,7 @@ _go_posterize(void *data, Evas_Object *obj EINA_UNUSED, static void _go_painting(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1386,7 +1386,7 @@ _go_painting(void *data, Evas_Object *obj EINA_UNUSED, static void _go_invert(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1401,7 +1401,7 @@ _go_invert(void *data, Evas_Object *obj EINA_UNUSED, static void _go_sketch(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1416,7 +1416,7 @@ _go_sketch(void *data, Evas_Object *obj EINA_UNUSED, static void _go_edge(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1431,7 +1431,7 @@ _go_edge(void *data, Evas_Object *obj EINA_UNUSED, static void _go_emboss(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1455,7 +1455,7 @@ _animate_cb(void *data) v->cur_frame = 1; evas_object_image_animated_frame_set(v->image, v->cur_frame); v->duration = evas_object_image_animated_frame_duration_get(v->image, - v->cur_frame, 0); + v->cur_frame, 0); if (v->duration > 0) ecore_timer_interval_set(v->anim_timer, v->duration); @@ -1486,9 +1486,9 @@ _viewer_add(Evas_Object *parent, const char *path, Ephoto_Single_Browser *sb) EPHOTO_FILL(v->scroller); evas_object_data_set(v->scroller, "viewer", v); evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_MOUSE_UP, - _scroller_mouse_up_cb, sb); + _scroller_mouse_up_cb, sb); evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_DEL, _viewer_del, - v); + v); evas_object_show(v->scroller); v->table = elm_table_add(v->scroller); @@ -1509,13 +1509,13 @@ _viewer_add(Evas_Object *parent, const char *path, Ephoto_Single_Browser *sb) goto error; evas_object_image_size_get(v->image, &w, &h); elm_drop_target_add(v->image, ELM_SEL_FORMAT_IMAGE, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL); evas_object_size_hint_min_set(v->image, w, h); evas_object_size_hint_max_set(v->image, w, h); evas_object_event_callback_add(v->image, EVAS_CALLBACK_MOUSE_DOWN, - _image_mouse_down_cb, sb); + _image_mouse_down_cb, sb); evas_object_event_callback_add(v->image, EVAS_CALLBACK_MOUSE_UP, - _image_mouse_up_cb, sb); + _image_mouse_up_cb, sb); elm_table_pack(v->table, v->image, 0, 0, 1, 1); evas_object_show(v->image); if (evas_object_image_animated_get(v->image)) @@ -1524,22 +1524,22 @@ _viewer_add(Evas_Object *parent, const char *path, Ephoto_Single_Browser *sb) v->cur_frame = 1; evas_object_image_animated_frame_set(v->image, v->cur_frame); v->duration = evas_object_image_animated_frame_duration_get(v->image, - v->cur_frame, 0); + v->cur_frame, 0); v->anim_timer = ecore_timer_loop_add(v->duration, _animate_cb, v); } v->monitor = eio_monitor_add(path); v->monitor_handlers = - eina_list_append(v->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, - _monitor_cb, sb)); + eina_list_append(v->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, + _monitor_cb, sb)); v->monitor_handlers = - eina_list_append(v->monitor_handlers, - ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, - _monitor_cb, sb)); + eina_list_append(v->monitor_handlers, + ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, + _monitor_cb, sb)); return v->scroller; - error: +error: evas_object_event_callback_del(v->scroller, EVAS_CALLBACK_DEL, _viewer_del); evas_object_data_del(v->scroller, "viewer"); free(v); @@ -1550,20 +1550,20 @@ _viewer_add(Evas_Object *parent, const char *path, Ephoto_Single_Browser *sb) static Eina_Bool _ephoto_single_populate_end(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Single_Browser *sb = data; if (!sb->entry && sb->ephoto->state == EPHOTO_STATE_SINGLE) ephoto_single_browser_entry_set(sb->main, - _first_entry_find(sb)); + _first_entry_find(sb)); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _ephoto_single_entry_create(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Single_Browser *sb = data; Ephoto_Event_Entry_Create *ev = event; @@ -1572,8 +1572,8 @@ _ephoto_single_entry_create(void *data, int type EINA_UNUSED, e = ev->entry; if (sb->pending_path && !strcmp(e->path, sb->pending_path)) { - eina_stringshare_del(sb->pending_path); - ephoto_single_browser_entry_set(sb->main, e); + eina_stringshare_del(sb->pending_path); + ephoto_single_browser_entry_set(sb->main, e); } return ECORE_CALLBACK_PASS_ON; @@ -1584,60 +1584,60 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb) { if (sb->viewer) { - evas_object_del(sb->viewer); - sb->viewer = NULL; + evas_object_del(sb->viewer); + sb->viewer = NULL; } if (sb->nolabel) { - evas_object_del(sb->nolabel); - sb->nolabel = NULL; + evas_object_del(sb->nolabel); + sb->nolabel = NULL; } if (sb->entry) { - const char *bname = NULL; + const char *bname = NULL; if (ecore_file_exists(sb->entry->path)) bname = ecore_file_file_get(sb->entry->path); if (bname) - sb->viewer = _viewer_add(sb->main, sb->entry->path, sb); - if (sb->viewer) - { - elm_box_pack_start(sb->mhbox, sb->viewer); - evas_object_show(sb->viewer); - evas_object_event_callback_add(sb->viewer, - EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb); + sb->viewer = _viewer_add(sb->main, sb->entry->path, sb); + if (sb->viewer) + { + elm_box_pack_start(sb->mhbox, sb->viewer); + evas_object_show(sb->viewer); + evas_object_event_callback_add(sb->viewer, + EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb); _ephoto_update_bottom_bar(sb); - ephoto_title_set(sb->ephoto, bname); + ephoto_title_set(sb->ephoto, bname); - if (!_ephoto_file_image_can_save(strrchr(bname, '.')+1)) + if (!_ephoto_file_image_can_save(strrchr(bname, '.') + 1)) elm_object_item_disabled_set(sb->save, EINA_TRUE); else elm_object_item_disabled_set(sb->save, EINA_FALSE); - } + } else - { - sb->nolabel = elm_label_add(sb->mhbox); - elm_label_line_wrap_set(sb->nolabel, ELM_WRAP_WORD); - elm_object_text_set(sb->nolabel, - _("This image does not exist or is corrupted!")); + { + sb->nolabel = elm_label_add(sb->mhbox); + elm_label_line_wrap_set(sb->nolabel, ELM_WRAP_WORD); + elm_object_text_set(sb->nolabel, + _("This image does not exist or is corrupted!")); EPHOTO_EXPAND(sb->nolabel); EPHOTO_FILL(sb->nolabel); - elm_box_pack_start(sb->mhbox, sb->nolabel); - evas_object_show(sb->nolabel); - ephoto_title_set(sb->ephoto, _("Bad Image")); - } + elm_box_pack_start(sb->mhbox, sb->nolabel); + evas_object_show(sb->nolabel); + ephoto_title_set(sb->ephoto, _("Bad Image")); + } } } static void _edit_function_item_add(Evas_Object *parent, const char *icon, const char *label, - Evas_Smart_Cb callback, void *data) + Evas_Smart_Cb callback, void *data) { Evas_Object *button, *ic; ic = elm_icon_add(parent); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, icon); @@ -1646,8 +1646,8 @@ _edit_function_item_add(Evas_Object *parent, const char *icon, const char *label elm_object_tooltip_orient_set(button, ELM_TOOLTIP_ORIENT_LEFT); elm_object_tooltip_window_mode_set(button, EINA_TRUE); elm_object_part_content_set(button, "icon", ic); - evas_object_size_hint_min_set(button, 30*elm_config_scale_get(), - 30*elm_config_scale_get()); + evas_object_size_hint_min_set(button, 30 * elm_config_scale_get(), + 30 * elm_config_scale_get()); evas_object_smart_callback_add(button, "clicked", callback, data); EPHOTO_WEIGHT(button, EVAS_HINT_FILL, EVAS_HINT_FILL); EPHOTO_FILL(button); @@ -1702,7 +1702,7 @@ _item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part) static void _edit_item_add(Evas_Object *parent, Elm_Object_Item *par, const char *icon, const char *label, - Evas_Smart_Cb callback, void *data) + Evas_Smart_Cb callback, void *data) { Evas_Object *ic; Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); @@ -1725,19 +1725,19 @@ _edit_item_add(Evas_Object *parent, Elm_Object_Item *par, const char *icon, cons if (icon) { ic = elm_icon_add(parent); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_standard_set(ic, icon); evas_object_data_set(ic, "label", label); elm_genlist_item_append(parent, itc, ic, par, - ELM_GENLIST_ITEM_NONE, callback, data); + ELM_GENLIST_ITEM_NONE, callback, data); } else { elm_genlist_item_append(parent, itc2, label, par, - ELM_GENLIST_ITEM_NONE, callback, data); + ELM_GENLIST_ITEM_NONE, callback, data); } } @@ -1800,56 +1800,56 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU evas_object_show(list); par = elm_genlist_item_append(list, itc, _("Transform"), NULL, ELM_GENLIST_ITEM_GROUP, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(par, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); _edit_item_add(list, par, "edit-cut", _("Crop"), _crop_image, sb); _edit_item_add(list, par, "zoom-in", _("Scale"), _scale_image, sb); _edit_item_add(list, par, "object-rotate-left", _("Rotate Left"), - _go_rotate_counterclock, sb); + _go_rotate_counterclock, sb); _edit_item_add(list, par, "object-rotate-right", _("Rotate Right"), - _go_rotate_clock, sb); + _go_rotate_clock, sb); _edit_item_add(list, par, "object-flip-horizontal", _("Flip Horizontal"), - _go_flip_horiz, sb); + _go_flip_horiz, sb); _edit_item_add(list, par, "object-flip-vertical", _("Flip Vertical"), - _go_flip_vert, sb); + _go_flip_vert, sb); par = elm_genlist_item_append(list, itc, _("Adjustable Filters"), NULL, ELM_GENLIST_ITEM_GROUP, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(par, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); _edit_item_add(list, par, NULL, _("Brightness/Contrast/Gamma"), - _go_bcg, sb); + _go_bcg, sb); _edit_item_add(list, par, NULL, _("Hue/Saturation/Value"), - _go_hsv, sb); + _go_hsv, sb); _edit_item_add(list, par, NULL, _("Color Levels"), - _go_color, sb); + _go_color, sb); _edit_item_add(list, par, NULL, _("Red Eye Removal"), - _go_reye, sb); + _go_reye, sb); par = elm_genlist_item_append(list, itc, _("Quick Filters"), NULL, ELM_GENLIST_ITEM_GROUP, - NULL, NULL); + NULL, NULL); elm_genlist_item_select_mode_set(par, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); _edit_item_add(list, par, NULL, _("Auto Equalize"), - _go_auto_eq, sb); + _go_auto_eq, sb); _edit_item_add(list, par, NULL, _("Black and White"), - _go_black_and_white, sb); + _go_black_and_white, sb); _edit_item_add(list, par, NULL, _("Blur"), - _go_blur, sb); + _go_blur, sb); _edit_item_add(list, par, NULL, _("Dither"), - _go_dither, sb); + _go_dither, sb); _edit_item_add(list, par, NULL, _("Edge Detect"), - _go_edge, sb); + _go_edge, sb); _edit_item_add(list, par, NULL, _("Emboss"), - _go_emboss, sb); + _go_emboss, sb); _edit_item_add(list, par, NULL, _("Invert Colors"), - _go_invert, sb); + _go_invert, sb); _edit_item_add(list, par, NULL, _("Old Photo"), - _go_old_photo, sb); + _go_old_photo, sb); _edit_item_add(list, par, NULL, _("Painting"), - _go_painting, sb); + _go_painting, sb); _edit_item_add(list, par, NULL, _("Posterize"), - _go_posterize, sb); + _go_posterize, sb); _edit_item_add(list, par, NULL, _("Sharpen"), - _go_sharpen, sb); + _go_sharpen, sb); _edit_item_add(list, par, NULL, _("Sketch"), - _go_sketch, sb); + _go_sketch, sb); vbox = elm_box_add(box); elm_box_horizontal_set(vbox, EINA_FALSE); @@ -1862,9 +1862,9 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU _edit_function_item_add(vbox, "document-save", _("Save"), _save_image, sb); _edit_function_item_add(vbox, "document-save-as", _("Save As"), - _save_image_as, sb); + _save_image_as, sb); _edit_function_item_add(vbox, "document-send", _("Upload"), _upload_image, - sb); + sb); _edit_function_item_add(vbox, "edit-undo", _("Undo"), _undo_image, sb); _edit_function_item_add(vbox, "edit-redo", _("Redo"), _redo_image, sb); _edit_function_item_add(vbox, "edit-clear", _("Reset"), _reset_image, sb); @@ -1875,7 +1875,7 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU static Eina_Bool _show_edit_main(void *data, int type EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -1895,22 +1895,22 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu) elm_menu_item_add(menu, menu_it, "edit-clear", _("Reset"), _reset_image, sb); elm_menu_item_add(menu, menu_it, "document-save", _("Save"), _save_image, sb); elm_menu_item_add(menu, menu_it, "document-save-as", _("Save As"), - _save_image_as, sb); + _save_image_as, sb); elm_menu_item_add(menu, menu_it, "edit", _("Rename"), - _rename_image, sb); + _rename_image, sb); elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete"), - _delete_image, sb); + _delete_image, sb); elm_menu_item_add(menu, menu_it, "document-send", _("Upload"), _upload_image, - sb); + sb); elm_menu_item_separator_add(menu, NULL); elm_menu_item_add(menu, NULL, "zoom-fit", _("Zoom Fit"), _zoom_fit_cb, - sb); + sb); elm_menu_item_add(menu, NULL, "zoom-original", _("Zoom 1:1"), _zoom_1_cb, - sb); + sb); elm_menu_item_add(menu, NULL, "object-flip-horizontal", _("Flip Horizontal"), _go_flip_horiz, - sb); + sb); elm_menu_item_add(menu, NULL, "object-flip-vertical", _("Flip Vertical"), _go_flip_vert, - sb); + sb); } static void @@ -1926,13 +1926,13 @@ _ephoto_main_edit_menu(Ephoto_Single_Browser *sb) _add_edit_menu_items(sb, menu); evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, - sb); + sb); evas_object_show(menu); } static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Single_Browser *sb = data; Evas_Event_Key_Down *ev = event_info; @@ -1945,17 +1945,17 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU if (ctrl) { - if ((!strcmp(k, "plus")) || (!strcmp(k, "equal"))) - _zoom_in(sb); - else if (!strcmp(k, "minus")) - _zoom_out(sb); - else if (!strcmp(k, "0")) - { - if (shift) - _zoom_fit(sb); - else - _zoom_set(sb, 1.0); - } + if ((!strcmp(k, "plus")) || (!strcmp(k, "equal"))) + _zoom_in(sb); + else if (!strcmp(k, "minus")) + _zoom_out(sb); + else if (!strcmp(k, "0")) + { + if (shift) + _zoom_fit(sb); + else + _zoom_set(sb, 1.0); + } else if (!strcmp(k, "f") && !sb->editing) { if (shift) @@ -2001,28 +2001,28 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU { _redo_image(sb, NULL, NULL); } - return; + return; } if (!strcmp(k, "Escape") && !sb->editing && !sb->edit_main) { - if (sb->event) - { - evas_object_del(sb->event); - sb->event = NULL; - } - evas_object_smart_callback_call(sb->main, "back", sb->entry); + if (sb->event) + { + evas_object_del(sb->event); + sb->event = NULL; + } + evas_object_smart_callback_call(sb->main, "back", sb->entry); } else if (!strcmp(k, "Left") && !sb->editing) - _prev_entry(sb); + _prev_entry(sb); else if (!strcmp(k, "Right") && !sb->editing) - _next_entry(sb); + _next_entry(sb); else if (!strcmp(k, "space") && !sb->editing) - _next_entry(sb); + _next_entry(sb); else if (!strcmp(k, "Home") && !sb->editing) - _first_entry(sb); + _first_entry(sb); else if (!strcmp(k, "End") && !sb->editing) - _last_entry(sb); + _last_entry(sb); else if (!strcmp(k, "F1")) { _ephoto_show_settings(sb, NULL, NULL); @@ -2033,19 +2033,19 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU } else if (!strcmp(k, "F5") && !sb->editing) { - if (sb->entry) - { - if (sb->event) - { - evas_object_del(sb->event); - sb->event = NULL; - } - evas_object_smart_callback_call(sb->main, "slideshow", sb->entry); - } + if (sb->entry) + { + if (sb->event) + { + evas_object_del(sb->event); + sb->event = NULL; + } + evas_object_smart_callback_call(sb->main, "slideshow", sb->entry); + } } else if (!strcmp(k, "F11")) { - if (!elm_win_fullscreen_get(sb->ephoto->win)) + if (!elm_win_fullscreen_get(sb->ephoto->win)) { elm_win_fullscreen_set(sb->ephoto->win, EINA_TRUE); elm_box_pack_end(sb->ephoto->statusbar, sb->ephoto->exit); @@ -2078,7 +2078,7 @@ ephoto_single_browser_slideshow(Evas_Object *obj) static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Single_Browser *sb = data; @@ -2102,7 +2102,7 @@ _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN static void _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_Single_Browser *sb = data; Ecore_Event_Handler *handler; @@ -2119,12 +2119,12 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, sb->edit_main = NULL; tmps = eina_file_stat_ls(sb->ephoto->config_path); EINA_ITERATOR_FOREACH(tmps, info) - { - const char *bname = info->path + info->name_start; + { + const char *bname = info->path + info->name_start; - if (!strncmp(bname, "tmp", 3)) - ecore_file_unlink(info->path); - } + if (!strncmp(bname, "tmp", 3)) + ecore_file_unlink(info->path); + } eina_iterator_free(tmps); if (sb->history) { @@ -2160,22 +2160,22 @@ ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries) elm_image_file_get(v->image, &image, NULL); dir = ecore_file_dir_get(image); - if (!dir) + if (!dir) { ephoto_single_browser_entry_set(sb->main, - _first_entry_find(sb)); + _first_entry_find(sb)); } else { if (strcmp(sb->ephoto->config->directory, dir)) ephoto_single_browser_entry_set(sb->main, - _first_entry_find(sb)); + _first_entry_find(sb)); free(dir); - } + } } else ephoto_single_browser_entry_set(sb->main, - _first_entry_find(sb)); + _first_entry_find(sb)); } } else @@ -2213,7 +2213,7 @@ ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry) eh = calloc(1, sizeof(Ephoto_History)); eh->im_data = malloc(sizeof(unsigned int) * w * h); memcpy(eh->im_data, evas_object_image_data_get(v->image, EINA_FALSE), - sizeof(unsigned int) * w * h); + sizeof(unsigned int) * w * h); eh->w = w; eh->h = h; eh->orient = sb->orient; @@ -2222,8 +2222,8 @@ ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry) } if (sb->event) { - evas_object_del(sb->event); - sb->event = NULL; + evas_object_del(sb->event); + sb->event = NULL; } sb->event = evas_object_rectangle_add(sb->ephoto->win); evas_object_smart_member_add(sb->event, sb->ephoto->win); @@ -2231,7 +2231,7 @@ ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry) evas_object_repeat_events_set(sb->event, EINA_TRUE); evas_object_show(sb->event); evas_object_event_callback_add(sb->event, EVAS_CALLBACK_KEY_DOWN, _ephoto_main_key_down, - sb); + sb); evas_object_raise(sb->event); elm_object_focus_set(sb->event, EINA_TRUE); } @@ -2285,21 +2285,21 @@ ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry) void ephoto_single_browser_image_data_update(Evas_Object *main, Evas_Object *image, - unsigned int *image_data, Evas_Coord w, Evas_Coord h) + unsigned int *image_data, Evas_Coord w, Evas_Coord h) { Ephoto_Single_Browser *sb = evas_object_data_get(main, "single_browser"); if (sb->editing) { - evas_object_image_data_set(image, image_data); - evas_object_image_data_update_add(image, 0, 0, w, - h); + evas_object_image_data_set(image, image_data); + evas_object_image_data_update_add(image, 0, 0, w, + h); } } 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) { Ephoto_Single_Browser *sb = evas_object_data_get(main, "single_browser"); Ephoto_History *eh; @@ -2313,12 +2313,12 @@ ephoto_single_browser_image_data_done(Evas_Object *main, _ephoto_single_browser_recalc(sb); Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); if (sb->cropping) - sb->cropping = EINA_FALSE; + sb->cropping = EINA_FALSE; evas_object_image_size_set(v->image, w, h); evas_object_image_data_set(v->image, image_data); evas_object_image_data_update_add(v->image, 0, 0, w, - h); - if (sb->history_pos < (eina_list_count(sb->history)-1)) + h); + if (sb->history_pos < (eina_list_count(sb->history) - 1)) { int count; @@ -2337,7 +2337,7 @@ ephoto_single_browser_image_data_done(Evas_Object *main, eh = calloc(1, sizeof(Ephoto_History)); eh->im_data = malloc(sizeof(unsigned int) * w * h); memcpy(eh->im_data, image_data, - sizeof(unsigned int) * w * h); + sizeof(unsigned int) * w * h); eh->w = w; eh->h = h; eh->orient = sb->orient; @@ -2360,20 +2360,20 @@ ephoto_single_browser_cancel_editing(Evas_Object *main) { _ephoto_single_browser_recalc(sb); Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer"); - if (sb->cropping) - sb->cropping = EINA_FALSE; - if (sb->history_pos) - { + if (sb->cropping) + sb->cropping = EINA_FALSE; + if (sb->history_pos) + { Ephoto_History *eh = eina_list_nth(sb->history, sb->history_pos); - evas_object_image_size_set(v->image, eh->w, - eh->h); - evas_object_image_data_set(v->image, - eh->im_data); - evas_object_image_data_update_add(v->image, 0, - 0, eh->w, eh->h); - } - sb->editing = EINA_FALSE; - _zoom_fit(sb); + evas_object_image_size_set(v->image, eh->w, + eh->h); + evas_object_image_data_set(v->image, + eh->im_data); + evas_object_image_data_update_add(v->image, 0, + 0, eh->w, eh->h); + } + sb->editing = EINA_FALSE; + _zoom_fit(sb); } } @@ -2381,15 +2381,15 @@ void ephoto_single_browser_show_controls(Ephoto *ephoto) { Ephoto_Single_Browser *sb = evas_object_data_get(ephoto->single_browser, - "single_browser"); + "single_browser"); Evas_Object *but, *ic; int ret; evas_object_del(ephoto->view_button); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "view-list-icons"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2406,8 +2406,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) ephoto->view_button = but; ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "zoom-in"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2422,8 +2422,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); elm_icon_standard_set(ic, "zoom-out"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2438,8 +2438,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "go-previous"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2454,8 +2454,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "go-next"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2470,8 +2470,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_right); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "object-rotate-left"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2486,8 +2486,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_right); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "object-rotate-right"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2502,8 +2502,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_right); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "edit-cut"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2518,8 +2518,8 @@ ephoto_single_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_right); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "document-save-as"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2556,7 +2556,7 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) elm_box_horizontal_set(sb->main, EINA_FALSE); evas_object_event_callback_add(sb->main, EVAS_CALLBACK_DEL, _ephoto_main_del, sb); evas_object_event_callback_add(sb->main, EVAS_CALLBACK_KEY_DOWN, _ephoto_main_key_down, - sb); + sb); EPHOTO_EXPAND(sb->main); EPHOTO_FILL(sb->main); evas_object_data_set(sb->main, "single_browser", sb); @@ -2569,25 +2569,25 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) evas_object_show(sb->mhbox); sb->handlers = - eina_list_append(sb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, - _ephoto_single_populate_end, sb)); + eina_list_append(sb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, + _ephoto_single_populate_end, sb)); sb->handlers = - eina_list_append(sb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, - _ephoto_single_entry_create, sb)); + eina_list_append(sb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, + _ephoto_single_entry_create, sb)); sb->handlers = - eina_list_append(sb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_EDITOR_BACK, - _show_edit_main, sb)); + eina_list_append(sb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_EDITOR_BACK, + _show_edit_main, sb)); sb->orient = EPHOTO_ORIENT_0; return sb->main; - error: +error: evas_object_del(sb->main); return NULL; } diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c index aaa632a..2e49138 100644 --- a/src/bin/ephoto_slideshow.c +++ b/src/bin/ephoto_slideshow.c @@ -1,7 +1,7 @@ #include "ephoto.h" typedef enum _Ephoto_Slideshow_Move Ephoto_Slideshow_Move; -typedef struct _Ephoto_Slideshow Ephoto_Slideshow; +typedef struct _Ephoto_Slideshow Ephoto_Slideshow; enum _Ephoto_Slideshow_Move { @@ -33,39 +33,39 @@ enum _Ephoto_Slideshow_Move struct _Ephoto_Slideshow { - Ephoto *ephoto; - Evas_Object *current_item; - Evas_Object *old_item; - Evas_Object *slideshow; - Evas_Object *event; - Evas_Object *notify; - Evas_Object *notify_box; - Eina_List *entries; - Evas_Object *pause; - Evas_Object *pause_after; - Evas_Object *fullscreen; - Evas_Object *fullscreen_after; - Evas_Object *exit; - Ephoto_Entry *entry; - Eina_Bool playing; - Eina_Bool timer_end; - Ecore_Timer *timer; + Ephoto *ephoto; + Evas_Object *current_item; + Evas_Object *old_item; + Evas_Object *slideshow; + Evas_Object *event; + Evas_Object *notify; + Evas_Object *notify_box; + Eina_List *entries; + Evas_Object *pause; + Evas_Object *pause_after; + Evas_Object *fullscreen; + Evas_Object *fullscreen_after; + Evas_Object *exit; + Ephoto_Entry *entry; + Eina_Bool playing; + Eina_Bool timer_end; + Ecore_Timer *timer; Ephoto_Slideshow_Move move; - float timeout; - int current; + float timeout; + int current; }; static Evas_Object *_slideshow_item_get(Ephoto_Slideshow *ss, - Ephoto_Entry *entry, Evas_Object *parent); -static Eina_Bool _slideshow_transition(void *data); -static void _slideshow_play(Ephoto_Slideshow *ss); -static void _slideshow_pause(Ephoto_Slideshow *ss); + Ephoto_Entry *entry, Evas_Object *parent); +static Eina_Bool _slideshow_transition(void *data); +static void _slideshow_play(Ephoto_Slideshow *ss); +static void _slideshow_pause(Ephoto_Slideshow *ss); 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 _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; @@ -77,55 +77,79 @@ _slideshow_move_end_get(Ephoto_Slideshow *ss) { switch (ss->move) { - case 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_TOP_TO_BOTTOM: - return "ephoto,slideshow,move,top,to,bottom"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: - return "ephoto,slideshow,move,bottom,to,top"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_IN: - return "ephoto,slideshow,move,left,in"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: - return "ephoto,slideshow,move,right,in"; - case EPHOTO_SLIDESHOW_MOVE_TOP_IN: - return "ephoto,slideshow,move,top,in"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN: - return "ephoto,slideshow,move,bottom,in"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: - return "ephoto,slideshow,move,left,out"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: - return "ephoto,slideshow,move,right,out"; - case EPHOTO_SLIDESHOW_MOVE_TOP_OUT: - return "ephoto,slideshow,move,top,out"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: - return "ephoto,slideshow,move,bottom,out"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: - return "ephoto,slideshow,move,left,top,corner"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER: - return "ephoto,slideshow,move,right,top,corner"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: - return "ephoto,slideshow,move,right,bottom,corner"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: - return "ephoto,slideshow,move,left,bottom,corner"; - 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"; + case 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_TOP_TO_BOTTOM: + return "ephoto,slideshow,move,top,to,bottom"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: + return "ephoto,slideshow,move,bottom,to,top"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_IN: + return "ephoto,slideshow,move,left,in"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: + return "ephoto,slideshow,move,right,in"; + + case EPHOTO_SLIDESHOW_MOVE_TOP_IN: + return "ephoto,slideshow,move,top,in"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN: + return "ephoto,slideshow,move,bottom,in"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: + return "ephoto,slideshow,move,left,out"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: + return "ephoto,slideshow,move,right,out"; + + case EPHOTO_SLIDESHOW_MOVE_TOP_OUT: + return "ephoto,slideshow,move,top,out"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: + return "ephoto,slideshow,move,bottom,out"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: + return "ephoto,slideshow,move,left,top,corner"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER: + return "ephoto,slideshow,move,right,top,corner"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: + return "ephoto,slideshow,move,right,bottom,corner"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: + return "ephoto,slideshow,move,left,bottom,corner"; + + 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) { - case EPHOTO_SLIDESHOW_MOVE_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_TOP_TO_BOTTOM: - return "ephoto,slideshow,default,top,to,bottom"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: - return "ephoto,slideshow,default,bottom,to,top"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_IN: - return "ephoto,slideshow,default,left,in"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: - return "ephoto,slideshow,default,right,in"; - case EPHOTO_SLIDESHOW_MOVE_TOP_IN: - return "ephoto,slideshow,default,top,in"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN: - return "ephoto,slideshow,default,bottom,in"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: - return "ephoto,slideshow,default,left,out"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: - return "ephoto,slideshow,default,right,out"; - case EPHOTO_SLIDESHOW_MOVE_TOP_OUT: - return "ephoto,slideshow,default,top,out"; - case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: - return "ephoto,slideshow,default,bottom,out"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: - return "ephoto,slideshow,default,left,top,corner"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER: - return "ephoto,slideshow,default,right,top,corner"; - case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: - return "ephoto,slideshow,default,right,bottom,corner"; - case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: - return "ephoto,slideshow,default,left,bottom,corner"; - 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"; + case EPHOTO_SLIDESHOW_MOVE_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_TOP_TO_BOTTOM: + return "ephoto,slideshow,default,top,to,bottom"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP: + return "ephoto,slideshow,default,bottom,to,top"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_IN: + return "ephoto,slideshow,default,left,in"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_IN: + return "ephoto,slideshow,default,right,in"; + + case EPHOTO_SLIDESHOW_MOVE_TOP_IN: + return "ephoto,slideshow,default,top,in"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN: + return "ephoto,slideshow,default,bottom,in"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_OUT: + return "ephoto,slideshow,default,left,out"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT: + return "ephoto,slideshow,default,right,out"; + + case EPHOTO_SLIDESHOW_MOVE_TOP_OUT: + return "ephoto,slideshow,default,top,out"; + + case EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT: + return "ephoto,slideshow,default,bottom,out"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER: + return "ephoto,slideshow,default,left,top,corner"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER: + return "ephoto,slideshow,default,right,top,corner"; + + case EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER: + return "ephoto,slideshow,default,right,bottom,corner"; + + case EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER: + return "ephoto,slideshow,default,left,bottom,corner"; + + 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) { - case 0: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT; - break; - case 1: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT; - break; - case 2: - ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM; - break; - case 3: - ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP; - break; - case 4: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_IN; - break; - case 5: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_IN; - break; - case 6: - ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_IN; - break; - case 7: - ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN; - break; - case 8: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_OUT; - break; - case 9: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT; - break; - case 10: - ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_OUT; - break; - case 11: - ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT; - break; - case 12: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER; - break; - case 13: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER; - break; - case 14: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER; - break; - case 15: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER; - break; - case 16: - ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN; - break; - case 17: - ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN; - break; - 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; + case 0: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TO_RIGHT; + break; + + case 1: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TO_LEFT; + break; + + case 2: + ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_TO_BOTTOM; + break; + + case 3: + ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_TO_TOP; + break; + + case 4: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_IN; + break; + + case 5: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_IN; + break; + + case 6: + ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_IN; + break; + + case 7: + ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_IN; + break; + + case 8: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_OUT; + break; + + case 9: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_OUT; + break; + + case 10: + ss->move = EPHOTO_SLIDESHOW_MOVE_TOP_OUT; + break; + + case 11: + ss->move = EPHOTO_SLIDESHOW_MOVE_BOTTOM_OUT; + break; + + case 12: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER; + break; + + case 13: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER; + break; + + case 14: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_BOTTOM_CORNER; + break; + + case 15: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_BOTTOM_CORNER; + break; + + case 16: + ss->move = EPHOTO_SLIDESHOW_MOVE_LEFT_TOP_CORNER_IN; + break; + + case 17: + ss->move = EPHOTO_SLIDESHOW_MOVE_RIGHT_TOP_CORNER_IN; + break; + + 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 _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; @@ -290,7 +362,7 @@ _on_transition_raise(void *data, Evas_Object *obj EINA_UNUSED, static void _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; @@ -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_set(ss->slideshow, "ephoto.swallow.slideshow.item", - ss->current_item); + ss->current_item); evas_object_raise(ss->current_item); evas_object_show(ss->current_item); 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) { - ext++; - if ((strcasecmp(ext, "edj") == 0)) - { - if (edje_file_group_exists(entry->path, "e/desktop/background")) - group = "e/desktop/background"; - else - { - Eina_List *g = edje_file_collection_list(entry->path); + ext++; + if ((strcasecmp(ext, "edj") == 0)) + { + if (edje_file_group_exists(entry->path, "e/desktop/background")) + group = "e/desktop/background"; + else + { + Eina_List *g = edje_file_collection_list(entry->path); - group = eina_list_data_get(g); - edje_file_collection_list_free(g); - } - } + group = eina_list_data_get(g); + edje_file_collection_list_free(g); + } + } } layout = elm_layout_add(parent); elm_layout_file_set(layout, PACKAGE_DATA_DIR "/themes/ephoto.edj", - "ephoto,slideshow,item"); + "ephoto,slideshow,item"); EPHOTO_EXPAND(layout); EPHOTO_FILL(layout); 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_FILL(image); 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_geometry_get(parent, 0, 0, &sw, &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->val[0] = (float)ss->timeout; edje_object_message_send(elm_layout_edje_get(layout), - EDJE_MESSAGE_FLOAT_SET, 1, msg); + EDJE_MESSAGE_FLOAT_SET, 1, msg); return layout; } @@ -393,9 +465,9 @@ _slideshow_transition(void *data) ss->old_item = ss->current_item; 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", - ss->current_item); + ss->current_item); evas_object_show(ss->current_item); 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)) ss->current = 0; 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", - ss->current_item); + ss->current_item); evas_object_raise(ss->current_item); evas_object_show(ss->current_item); } @@ -435,7 +507,7 @@ _slideshow_play(Ephoto_Slideshow *ss) msg->count = 1; msg->val[0] = (float)ss->timeout; 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) { @@ -459,7 +531,7 @@ _slideshow_pause(Ephoto_Slideshow *ss) static void _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_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); } if (ss->current_item) - entry = evas_object_data_get(ss->current_item, "entry"); + entry = evas_object_data_get(ss->current_item, "entry"); else - entry = ss->entry; + entry = ss->entry; if (ss->event) { - evas_object_del(ss->event); - ss->event = NULL; + evas_object_del(ss->event); + ss->event = NULL; } evas_object_del(ss->notify_box); evas_object_del(ss->notify); @@ -517,12 +589,12 @@ _entry_free(void *data, const Ephoto_Entry *entry EINA_UNUSED) static void _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; 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); } @@ -543,13 +615,13 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) evas_object_hide(ss->ephoto->exit); } if (ss->current_item) - entry = evas_object_data_get(ss->current_item, "entry"); + entry = evas_object_data_get(ss->current_item, "entry"); else - entry = ss->entry; + entry = ss->entry; if (ss->event) { - evas_object_del(ss->event); - ss->event = NULL; + evas_object_del(ss->event); + ss->event = NULL; } evas_object_del(ss->notify_box); 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) { _slideshow_pause(ss); - ss->pause = - _add_icon(ss->notify_box, "media-playback-start", _("Play"), - ss->pause_after); + ss->pause = + _add_icon(ss->notify_box, "media-playback-start", _("Play"), + ss->pause_after); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); - ss->playing = 0; + ss->playing = 0; } else { _slideshow_play(ss); ss->pause = - _add_icon(ss->notify_box, "media-playback-pause", _("Pause"), - ss->pause_after); + _add_icon(ss->notify_box, "media-playback-pause", _("Pause"), + ss->pause_after); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); - ss->playing = 1; + ss->playing = 1; } } static void _previous(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Slideshow *ss = data; @@ -665,7 +737,7 @@ _last(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) static void _fullscreen(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Slideshow *ss = data; @@ -673,22 +745,22 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED, if (elm_win_fullscreen_get(ss->ephoto->win)) { - ss->fullscreen = - _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), - ss->fullscreen_after); + ss->fullscreen = + _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), + ss->fullscreen_after); evas_object_smart_callback_add(ss->fullscreen, "clicked", - _fullscreen, ss); + _fullscreen, ss); elm_win_fullscreen_set(ss->ephoto->win, EINA_FALSE); elm_box_unpack(ss->notify_box, ss->exit); evas_object_hide(ss->exit); } else { - ss->fullscreen = - _add_icon(ss->notify_box, "view-restore", _("Normal"), - ss->fullscreen_after); + ss->fullscreen = + _add_icon(ss->notify_box, "view-restore", _("Normal"), + ss->fullscreen_after); evas_object_smart_callback_add(ss->fullscreen, "clicked", - _fullscreen, ss); + _fullscreen, ss); elm_win_fullscreen_set(ss->ephoto->win, EINA_TRUE); elm_box_pack_end(ss->notify_box, ss->exit); evas_object_show(ss->exit); @@ -697,7 +769,7 @@ _fullscreen(void *data, Evas_Object *obj EINA_UNUSED, static void _settings(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Slideshow *ss = data; @@ -706,7 +778,7 @@ _settings(void *data, Evas_Object *obj EINA_UNUSED, static void _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Slideshow *ss = data; 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")) { - _back(ss, NULL, NULL); + _back(ss, NULL, NULL); } 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")) { - _fullscreen(ss, NULL, NULL); + _fullscreen(ss, NULL, NULL); } else if (!strcmp(k, "space")) { - _pause(ss, NULL, NULL); + _pause(ss, NULL, NULL); } else if (!strcmp(k, "Home")) { - _first(ss, NULL, NULL); + _first(ss, NULL, NULL); } else if (!strcmp(k, "End")) { - _last(ss, NULL, NULL); + _last(ss, NULL, NULL); } else if (!strcmp(k, "Left")) { - _previous(ss, NULL, NULL); + _previous(ss, NULL, NULL); } 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; ic = elm_icon_add(parent); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, icon); 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 _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; @@ -792,7 +864,7 @@ _mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, static void _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; @@ -802,7 +874,7 @@ _mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, static void _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; @@ -826,9 +898,9 @@ ephoto_slideshow_show_controls(Ephoto *ephoto) elm_box_horizontal_set(ss->notify_box, EINA_TRUE); EPHOTO_WEIGHT(ss->notify, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 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, - ss); + ss); elm_object_content_set(ss->notify, 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); evas_object_smart_callback_add(but, "clicked", _previous, ss); 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); 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, - ss); + ss); but = _add_icon(ss->notify_box, "go-last", _("Last"), NULL); evas_object_smart_callback_add(but, "clicked", _last, ss); 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); 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); 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); 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; 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, - ss); + ss); evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN, - _mouse_down, ss); + _mouse_down, ss); evas_object_data_set(slideshow, "slideshow", ss); EPHOTO_EXPAND(slideshow); EPHOTO_FILL(slideshow); 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), - "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), - "ephoto,transition,end", "ephoto", _on_transition_end, ss); + "ephoto,transition,end", "ephoto", _on_transition_end, ss); return ss->slideshow; - error: +error: evas_object_del(slideshow); 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"); if (!entry) - return; + return; 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->current = eina_list_data_idx(ss->entries, ss->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; _slideshow_play(ss); if (ss->pause) { - evas_object_del(ss->pause); - ss->pause = - _add_icon(ss->notify_box, "media-playback-pause", _("Pause"), - ss->pause_after); + evas_object_del(ss->pause); + ss->pause = + _add_icon(ss->notify_box, "media-playback-pause", _("Pause"), + ss->pause_after); evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss); - ss->playing = 1; + ss->playing = 1; } 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)) { ss->fullscreen = - _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), - ss->fullscreen_after); + _add_icon(ss->notify_box, "view-fullscreen", _("Fullscreen"), + ss->fullscreen_after); evas_object_smart_callback_add(ss->fullscreen, "clicked", - _fullscreen, ss); + _fullscreen, ss); elm_box_unpack(ss->notify_box, ss->exit); evas_object_hide(ss->exit); } else { ss->fullscreen = - _add_icon(ss->notify_box, "view-restore", _("Normal"), - ss->fullscreen_after); + _add_icon(ss->notify_box, "view-restore", _("Normal"), + ss->fullscreen_after); evas_object_smart_callback_add(ss->fullscreen, "clicked", - _fullscreen, ss); + _fullscreen, ss); elm_box_pack_end(ss->notify_box, ss->exit); evas_object_show(ss->exit); } } if (ss->event) { - evas_object_del(ss->event); - ss->event = NULL; + evas_object_del(ss->event); + ss->event = NULL; } ss->event = evas_object_rectangle_add(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_show(ss->event); evas_object_event_callback_add(ss->event, EVAS_CALLBACK_KEY_DOWN, _key_down, - ss); + ss); evas_object_raise(ss->event); elm_object_focus_set(ss->event, EINA_TRUE); } + diff --git a/src/bin/ephoto_thumb.c b/src/bin/ephoto_thumb.c index ac901ee..76b403c 100644 --- a/src/bin/ephoto_thumb.c +++ b/src/bin/ephoto_thumb.c @@ -61,7 +61,7 @@ e_thumb_shutdown(void) _exe_del_handler = NULL; _thumbnailers = eina_list_free(_thumbnailers); EINA_LIST_FREE(_thumbnailers_exe, exe_free) - ecore_exe_free(exe_free); + ecore_exe_free(exe_free); _thumb_queue = eina_list_free(_thumb_queue); _objid = 0; 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; } + diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index f7fb408..46625a5 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -19,71 +19,71 @@ typedef struct _Ephoto_Thumb_Browser Ephoto_Thumb_Browser; struct _Ephoto_Thumb_Browser { - Ephoto *ephoto; - Evas_Object *main; - Evas_Object *table; - Evas_Object *gridbox; - Evas_Object *grid; - Evas_Object *original_grid; - Evas_Object *nolabel; - Evas_Object *search; - Evas_Object *menu; - Evas_Object *hover; + Ephoto *ephoto; + Evas_Object *main; + Evas_Object *table; + Evas_Object *gridbox; + Evas_Object *grid; + Evas_Object *original_grid; + Evas_Object *nolabel; + Evas_Object *search; + Evas_Object *menu; + Evas_Object *hover; Elm_Object_Item *similarity; Elm_Object_Item *last_sel; - Ephoto_Sort sort; - Eio_File *ls; - Eina_Bool dirs_only; - Eina_Bool thumbs_only; - Eina_List *cut_items; - Eina_List *copy_items; - Eina_List *handlers; - Eina_List *todo_items; - Eina_List *entries; - Eina_List *searchentries; - double totsize; - double totsize_old; - int totimages; - int totimages_old; - Eina_Bool dragging; - Eina_Bool searching; - Eina_Bool processing; + Ephoto_Sort sort; + Eio_File *ls; + Eina_Bool dirs_only; + Eina_Bool thumbs_only; + Eina_List *cut_items; + Eina_List *copy_items; + Eina_List *handlers; + Eina_List *todo_items; + Eina_List *entries; + Eina_List *searchentries; + double totsize; + double totsize_old; + int totimages; + int totimages_old; + Eina_Bool dragging; + Eina_Bool searching; + Eina_Bool processing; struct { Ecore_Animator *todo_items; - int count; - int processed; + int count; + int processed; } animator; - Eina_Bool main_deleted:1; + Eina_Bool main_deleted : 1; }; /*Item Classes*/ static Elm_Gengrid_Item_Class _ephoto_thumb_file_class; /*Main Callbacks*/ -static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); -static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); +static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); /*Thumb Pane Functions*/ -static void _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info); -static void _ephoto_thumb_zoom_set(Ephoto_Thumb_Browser *tb, int zoom); -static void _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static void _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static void _ephoto_thumb_search_start(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED); -static char * _drag_data_extract(char **drag_data); +static void _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info); +static void _ephoto_thumb_zoom_set(Ephoto_Thumb_Browser *tb, int zoom); +static void _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static void _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static void _ephoto_thumb_search_start(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED); +static char *_drag_data_extract(char **drag_data); /*Common Callbacks*/ static void _menu_dismissed_cb(void *data, Evas_Object *obj, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; @@ -93,7 +93,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj, static void _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Eina_List *paths = NULL; @@ -122,7 +122,7 @@ _5s_timeout_gone(void *data) static Eina_Bool _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it EINA_UNUSED, - Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED) + Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret EINA_UNUSED) { Eina_List *files = NULL; Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser"); @@ -130,16 +130,16 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it EINA_ char *dir; if (!ev->data) - return EINA_FALSE; + return EINA_FALSE; if (ev->len <= 0) - return EINA_FALSE; + return EINA_FALSE; if (!path) - return EINA_FALSE; + return EINA_FALSE; char *dd = strdup(ev->data); if (!dd) - return EINA_FALSE; + return EINA_FALSE; char *s = _drag_data_extract(&dd); @@ -169,7 +169,7 @@ _drop_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it EINA_ static Elm_Object_Item * _drop_item_getcb(Evas_Object *obj EINA_UNUSED, Evas_Coord x EINA_UNUSED, - Evas_Coord y EINA_UNUSED,int *xposret EINA_UNUSED, int *yposret EINA_UNUSED) + Evas_Coord y EINA_UNUSED, int *xposret EINA_UNUSED, int *yposret EINA_UNUSED) { return NULL; } @@ -188,9 +188,9 @@ _drop_leave(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED) static void _drop_pos(void *data EINA_UNUSED, Evas_Object *cont EINA_UNUSED, - Elm_Object_Item *it EINA_UNUSED, Evas_Coord x EINA_UNUSED, - Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, - int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) + Elm_Object_Item *it EINA_UNUSED, Evas_Coord x EINA_UNUSED, + Evas_Coord y EINA_UNUSED, int xposret EINA_UNUSED, + int yposret EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) { return; } @@ -201,16 +201,16 @@ _drag_data_extract(char **drag_data) char *uri = NULL; if (!drag_data) - return uri; + return uri; char *p = *drag_data; if (!p) - return uri; + return uri; char *s = strstr(p, FILESEP); if (s) - p += FILESEP_LEN; + p += FILESEP_LEN; s = strchr(p, '\n'); uri = p; if (s) @@ -220,7 +220,7 @@ _drag_data_extract(char **drag_data) char *s1 = s - 1; if (s1[0] == '\r') - s1[0] = '\0'; + s1[0] = '\0'; else { char *s2 = s + 1; @@ -231,11 +231,11 @@ _drag_data_extract(char **drag_data) s++; } else - s[0] = '\0'; + s[0] = '\0'; } } else - s[0] = '\0'; + s[0] = '\0'; s++; } else @@ -256,7 +256,7 @@ _dnd_drag_start(void *data EINA_UNUSED, Evas_Object *obj) return; } if (_5s_cancel) - _5s_timeout = ecore_timer_loop_add(5.0, _5s_timeout_gone, obj); + _5s_timeout = ecore_timer_loop_add(5.0, _5s_timeout_gone, obj); elm_object_cursor_set(tb->main, ELM_CURSOR_HAND2); ephoto_show_folders(tb->ephoto, EINA_FALSE); @@ -266,14 +266,14 @@ _dnd_drag_start(void *data EINA_UNUSED, Evas_Object *obj) static void _dnd_drag_done(void *data, Evas_Object *obj, - Eina_Bool doaccept EINA_UNUSED) + Eina_Bool doaccept EINA_UNUSED) { Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser"); if (_5s_cancel) { - ecore_timer_del(_5s_timeout); - _5s_timeout = NULL; + ecore_timer_del(_5s_timeout); + _5s_timeout = NULL; } if (eina_list_count(data)) eina_list_free(data); @@ -289,62 +289,62 @@ _dnd_drag_data_build(Eina_List **items) if (*items) { - Eina_List *l; - Elm_Object_Item *it; - Ephoto_Entry *e; - unsigned int len = 0; + Eina_List *l; + Elm_Object_Item *it; + Ephoto_Entry *e; + unsigned int len = 0; - EINA_LIST_FOREACH(*items, l, it) - { - e = elm_object_item_data_get(it); - if (e->path) - len += strlen(e->path); - } + EINA_LIST_FOREACH(*items, l, it) + { + e = elm_object_item_data_get(it); + if (e->path) + len += strlen(e->path); + } - drag_data = - malloc(len + eina_list_count(*items) * (FILESEP_LEN + 1) + 1); - strcpy((char *) drag_data, ""); + drag_data = + malloc(len + eina_list_count(*items) * (FILESEP_LEN + 1) + 1); + strcpy((char *)drag_data, ""); - EINA_LIST_FOREACH(*items, l, it) - { - e = elm_object_item_data_get(it); - if (e->path) - { - strcat((char *) drag_data, FILESEP); - strcat((char *) drag_data, e->path); - strcat((char *) drag_data, "\n"); - } - } + EINA_LIST_FOREACH(*items, l, it) + { + e = elm_object_item_data_get(it); + if (e->path) + { + strcat((char *)drag_data, FILESEP); + strcat((char *)drag_data, e->path); + strcat((char *)drag_data, "\n"); + } + } } return drag_data; } static Evas_Object * _dnd_create_icon(void *data, Evas_Object *win, Evas_Coord *xoff, - Evas_Coord *yoff) + Evas_Coord *yoff) { Evas_Object *icon = NULL; Evas_Object *o = elm_object_item_part_content_get(data, "elm.swallow.icon"); if (o) { - int xm, ym, w = 30, h = 30; - const char *f; - const char *g; + int xm, ym, w = 30, h = 30; + const char *f; + const char *g; - elm_image_file_get(o, &f, &g); - evas_pointer_canvas_xy_get(evas_object_evas_get(o), &xm, &ym); - if (xoff) - *xoff = xm - (w / 2); - if (yoff) - *yoff = ym - (h / 2); - icon = elm_icon_add(win); - elm_image_file_set(icon, f, g); + elm_image_file_get(o, &f, &g); + evas_pointer_canvas_xy_get(evas_object_evas_get(o), &xm, &ym); + if (xoff) + *xoff = xm - (w / 2); + if (yoff) + *yoff = ym - (h / 2); + icon = elm_icon_add(win); + elm_image_file_set(icon, f, g); EPHOTO_EXPAND(icon); EPHOTO_FILL(icon); - if (xoff && yoff) - evas_object_move(icon, *xoff, *yoff); - evas_object_resize(icon, w, h); + if (xoff && yoff) + evas_object_move(icon, *xoff, *yoff); + evas_object_resize(icon, w, h); } return icon; @@ -358,8 +358,8 @@ _dnd_get_drag_data(Evas_Object *obj, Elm_Object_Item *it, Eina_List **items) *items = eina_list_clone(elm_gengrid_selected_items_get(obj)); if (it) { - if (!elm_gengrid_item_selected_get(it)) - *items = eina_list_append(*items, it); + if (!elm_gengrid_item_selected_get(it)) + *items = eina_list_append(*items, it); } drag_data = _dnd_drag_data_build(items); @@ -368,7 +368,7 @@ _dnd_get_drag_data(Evas_Object *obj, Elm_Object_Item *it, Eina_List **items) static Elm_Object_Item * _dnd_item_get(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, - int *yposret) + int *yposret) { Elm_Object_Item *item; @@ -378,7 +378,7 @@ _dnd_item_get(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, static Eina_Bool _dnd_item_data_get(Evas_Object *obj, Elm_Object_Item *it, - Elm_Drag_User_Info *info) + Elm_Drag_User_Info *info) { Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser"); if (tb->ephoto->state != EPHOTO_STATE_THUMB) @@ -392,30 +392,30 @@ _dnd_item_data_get(Evas_Object *obj, Elm_Object_Item *it, info->dragstart = _dnd_drag_start; info->icons = NULL; info->dragdone = _dnd_drag_done; - info->data = _dnd_get_drag_data(obj, it, (Eina_List **) & info->donecbdata); + info->data = _dnd_get_drag_data(obj, it, (Eina_List **)&info->donecbdata); info->acceptdata = info->donecbdata; if (info->data) - return EINA_TRUE; + return EINA_TRUE; else - return EINA_FALSE; + return EINA_FALSE; } /*Thumb Pane Callbacks*/ static char * _thumb_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, - const char *part EINA_UNUSED) + const char *part EINA_UNUSED) { Ephoto_Entry *e = data; EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL); if (!e->label) - return NULL; + return NULL; return strdup(e->label); } static Evas_Object * _thumb_file_icon_get(void *data, Evas_Object *obj, - const char *part) + const char *part) { Ephoto_Entry *e = data; Evas_Object *thumb = NULL; @@ -530,7 +530,7 @@ _entry_cmp_grid_similarity(const void *pa, const void *pb) static void _sort_alpha_asc(void *data, Evas_Object *obj, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *ic; @@ -544,13 +544,13 @@ _sort_alpha_asc(void *data, Evas_Object *obj, elm_object_part_content_set(obj, "icon", ic); evas_object_show(ic); ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, - NULL, tb->dirs_only, tb->thumbs_only); + NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); } static void _sort_alpha_desc(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *ic; @@ -564,13 +564,13 @@ _sort_alpha_desc(void *data, Evas_Object *obj EINA_UNUSED, elm_object_part_content_set(obj, "icon", ic); evas_object_show(ic); ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, - NULL, tb->dirs_only, tb->thumbs_only); + NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); } static void _sort_mod_asc(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *ic; @@ -584,13 +584,13 @@ _sort_mod_asc(void *data, Evas_Object *obj EINA_UNUSED, elm_object_part_content_set(obj, "icon", ic); evas_object_show(ic); ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, - NULL, tb->dirs_only, tb->thumbs_only); + NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); } static void _sort_mod_desc(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *ic; @@ -604,13 +604,13 @@ _sort_mod_desc(void *data, Evas_Object *obj EINA_UNUSED, elm_object_part_content_set(obj, "icon", ic); evas_object_show(ic); ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, - NULL, tb->dirs_only, tb->thumbs_only); + NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); } static void _sort_similarity(void *data, Evas_Object *obj EINA_UNUSED, - void *event_data EINA_UNUSED) + void *event_data EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *ic; @@ -624,13 +624,13 @@ _sort_similarity(void *data, Evas_Object *obj EINA_UNUSED, elm_object_part_content_set(obj, "icon", ic); evas_object_show(ic); ephoto_directory_set(tb->ephoto, tb->ephoto->config->directory, - NULL, tb->dirs_only, tb->thumbs_only); + NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); } static void _zoom_in(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; int zoom = tb->ephoto->config->thumb_size + ZOOM_STEP; @@ -640,7 +640,7 @@ _zoom_in(void *data, Evas_Object *obj EINA_UNUSED, static void _zoom_out(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; int zoom = tb->ephoto->config->thumb_size - ZOOM_STEP; @@ -650,7 +650,7 @@ _zoom_out(void *data, Evas_Object *obj EINA_UNUSED, static void _view_single(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Elm_Object_Item *it = elm_gengrid_selected_item_get(tb->grid); @@ -663,23 +663,23 @@ _view_single(void *data, Evas_Object *obj EINA_UNUSED, else entry = eina_list_nth(tb->entries, 0); selected = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); if (eina_list_count(selected) <= 1 && tb->searchentries) { if (eina_list_count(tb->ephoto->selentries)) eina_list_free(tb->ephoto->selentries); tb->ephoto->selentries = NULL; tb->ephoto->searchentries = - eina_list_clone(tb->searchentries); + eina_list_clone(tb->searchentries); } else if (eina_list_count(selected) > 1) { - EINA_LIST_FOREACH(selected, s, item) - { - tb->ephoto->selentries = - eina_list_append(tb->ephoto->selentries, - elm_object_item_data_get(item)); - } + EINA_LIST_FOREACH(selected, s, item) + { + tb->ephoto->selentries = + eina_list_append(tb->ephoto->selentries, + elm_object_item_data_get(item)); + } } else { @@ -698,7 +698,7 @@ _view_single(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_menu_select_all_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Elm_Object_Item *item; @@ -706,14 +706,14 @@ _grid_menu_select_all_cb(void *data, Evas_Object *obj EINA_UNUSED, item = elm_gengrid_first_item_get(tb->grid); while (item) { - elm_gengrid_item_selected_set(item, EINA_TRUE); - item = elm_gengrid_item_next_get(item); + elm_gengrid_item_selected_set(item, EINA_TRUE); + item = elm_gengrid_item_next_get(item); } } static void _grid_menu_clear_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Elm_Object_Item *item; @@ -721,18 +721,18 @@ _grid_menu_clear_cb(void *data, Evas_Object *obj EINA_UNUSED, item = elm_gengrid_first_item_get(tb->grid); while (item) { - elm_gengrid_item_selected_set(item, EINA_FALSE); - item = elm_gengrid_item_next_get(item); + elm_gengrid_item_selected_set(item, EINA_FALSE); + item = elm_gengrid_item_next_get(item); } } static void _grid_menu_cut_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Eina_List *selection = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); Eina_List *f; Elm_Object_Item *item; Ephoto_Entry *file; @@ -742,13 +742,13 @@ _grid_menu_cut_cb(void *data, Evas_Object *obj EINA_UNUSED, if (tb->cut_items) { - eina_list_free(tb->cut_items); - tb->cut_items = NULL; + eina_list_free(tb->cut_items); + tb->cut_items = NULL; } if (tb->copy_items) { - eina_list_free(tb->copy_items); - tb->copy_items = NULL; + eina_list_free(tb->copy_items); + tb->copy_items = NULL; } EINA_LIST_FOREACH(selection, f, item) { @@ -761,11 +761,11 @@ _grid_menu_cut_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_menu_copy_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Eina_List *selection = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); Eina_List *f; Elm_Object_Item *item; Ephoto_Entry *file; @@ -775,13 +775,13 @@ _grid_menu_copy_cb(void *data, Evas_Object *obj EINA_UNUSED, if (eina_list_count(tb->cut_items)) { - eina_list_free(tb->cut_items); - tb->cut_items = NULL; + eina_list_free(tb->cut_items); + tb->cut_items = NULL; } if (eina_list_count(tb->copy_items)) { - eina_list_free(tb->copy_items); - tb->copy_items = NULL; + eina_list_free(tb->copy_items); + tb->copy_items = NULL; } EINA_LIST_FOREACH(selection, f, item) { @@ -794,21 +794,21 @@ _grid_menu_copy_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; if (eina_list_count(tb->cut_items)) { ephoto_file_paste(tb->ephoto, eina_list_clone(tb->cut_items), EINA_FALSE, - tb->ephoto->config->directory); + tb->ephoto->config->directory); eina_list_free(tb->cut_items); tb->cut_items = NULL; } else if (eina_list_count(tb->copy_items)) { ephoto_file_paste(tb->ephoto, eina_list_clone(tb->copy_items), EINA_TRUE, - tb->ephoto->config->directory); + tb->ephoto->config->directory); eina_list_free(tb->copy_items); tb->copy_items = NULL; } @@ -816,7 +816,7 @@ _grid_menu_paste_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Elm_Object_Item *item = evas_object_data_get(tb->main, "rename_item"); @@ -829,12 +829,12 @@ _grid_menu_rename_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Eina_List *paths = NULL, *f; Eina_List *selection = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); Elm_Object_Item *item; Ephoto_Entry *file; @@ -854,7 +854,7 @@ _grid_menu_delete_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _grid_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_Thumb_Browser *tb = data; Evas_Object *menu; @@ -885,7 +885,7 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED, two = elm_gengrid_item_index_get(item); if (two < one) { - for (i = one; i > (two+1); i--) + for (i = one; i > (two + 1); i--) { it = elm_gengrid_item_prev_get(cur); elm_gengrid_item_selected_set(it, EINA_TRUE); @@ -894,7 +894,7 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED, } else if (two > one) { - for (i = one; i < (two-1); i++) + for (i = one; i < (two - 1); i++) { it = elm_gengrid_item_next_get(cur); elm_gengrid_item_selected_set(it, EINA_TRUE); @@ -935,7 +935,7 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED, } } if (info->button != 3) - return; + return; if (!elm_gengrid_first_item_get(tb->grid) && !tb->cut_items) { @@ -957,52 +957,53 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED, if (elm_gengrid_first_item_get(tb->grid)) { elm_menu_item_add(menu, NULL, "system-search", _("Search"), - _ephoto_thumb_search_start, tb); + _ephoto_thumb_search_start, tb); elm_menu_item_add(menu, NULL, "edit-select-all", _("Select All"), - _grid_menu_select_all_cb, tb); + _grid_menu_select_all_cb, tb); if (eina_list_count(selected) || item) elm_menu_item_add(menu, NULL, "edit-clear", _("Select None"), - _grid_menu_clear_cb, tb); + _grid_menu_clear_cb, tb); if (item) { elm_menu_item_add(menu, NULL, "edit", _("Rename"), - _grid_menu_rename_cb, tb); + _grid_menu_rename_cb, tb); evas_object_data_del(tb->main, "rename_item"); evas_object_data_set(tb->main, "rename_item", item); } if (eina_list_count(selected)) { elm_menu_item_add(menu, NULL, "edit-cut", _("Cut"), - _grid_menu_cut_cb, tb); + _grid_menu_cut_cb, tb); elm_menu_item_add(menu, NULL, "edit-copy", _("Copy"), - _grid_menu_copy_cb, tb); + _grid_menu_copy_cb, tb); } } if (tb->cut_items || tb->copy_items) { elm_menu_item_add(menu, NULL, "edit-paste", _("Paste"), - _grid_menu_paste_cb, tb); + _grid_menu_paste_cb, tb); } if (elm_gengrid_first_item_get(tb->grid)) { if (!strcmp(tb->ephoto->config->directory, tb->ephoto->trash_path)) { - elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"), - _menu_empty_cb, tb); + elm_menu_item_add(menu, NULL, "edit-delete", _("Empty Trash"), + _menu_empty_cb, tb); } else { elm_menu_item_add(menu, NULL, "edit-delete", _("Delete"), - _grid_menu_delete_cb, tb); + _grid_menu_delete_cb, tb); } } evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, - tb); + tb); evas_object_show(menu); } + static void _grid_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Thumb_Browser *tb = data; Evas_Event_Mouse_Wheel *ev = event_info; @@ -1011,15 +1012,15 @@ _grid_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, if (ctrl) { if (ev->z > 0) - _zoom_out(tb, NULL, NULL); + _zoom_out(tb, NULL, NULL); else - _zoom_in(tb, NULL, NULL); + _zoom_in(tb, NULL, NULL); } } static void _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Thumb_Browser *tb = data; Eina_List *selected, *s; @@ -1029,7 +1030,7 @@ _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, elm_gengrid_item_selected_set(it, EINA_TRUE); selected = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); if (eina_list_count(selected) <= 1 && tb->searchentries) { if (eina_list_count(tb->ephoto->selentries)) @@ -1043,7 +1044,7 @@ _ephoto_thumb_activated(void *data, Evas_Object *obj EINA_UNUSED, { elm_gengrid_item_selected_set(item, EINA_TRUE); tb->ephoto->selentries = eina_list_append(tb->ephoto->selentries, - elm_object_item_data_get(item)); + elm_object_item_data_get(item)); } } else @@ -1069,19 +1070,19 @@ ephoto_thumb_browser_update_info_label(Ephoto *ephoto) char image_info[PATH_MAX]; double totsize; Ephoto_Thumb_Browser *tb = evas_object_data_get(ephoto->thumb_browser, - "thumb_browser"); + "thumb_browser"); if (!tb->totimages) { if (tb->searching) elm_object_text_set(tb->nolabel, - _("No images matched your search")); + _("No images matched your search")); else elm_object_text_set(tb->nolabel, - _("There are no images in this directory")); + _("There are no images in this directory")); snprintf(buf, PATH_MAX, "%s: 0 %s %s: 0%s", - _("Total"), ngettext("image", "images", 0), _("Size"), - ngettext("B", "B", 0)); + _("Total"), ngettext("image", "images", 0), _("Size"), + ngettext("B", "B", 0)); elm_object_text_set(tb->ephoto->infolabel, buf); } else @@ -1090,38 +1091,38 @@ ephoto_thumb_browser_update_info_label(Ephoto *ephoto) elm_object_text_set(tb->nolabel, " "); totsize = tb->totsize; if (totsize < 1024.0) - snprintf(isize, sizeof(isize), "%'.0f%s", totsize, ngettext("B", - "B", totsize)); + snprintf(isize, sizeof(isize), "%'.0f%s", totsize, ngettext("B", + "B", totsize)); else { totsize /= 1024.0; if (totsize < 1024) - snprintf(isize, sizeof(isize), "%'.0f%s", totsize, - ngettext("KB", "KB", totsize)); + snprintf(isize, sizeof(isize), "%'.0f%s", totsize, + ngettext("KB", "KB", totsize)); else { totsize /= 1024.0; if (totsize < 1024) - snprintf(isize, sizeof(isize), "%'.1f%s", totsize, - ngettext("MB", "MB", totsize)); + snprintf(isize, sizeof(isize), "%'.1f%s", totsize, + ngettext("MB", "MB", totsize)); else { totsize /= 1024.0; if (totsize < 1024) - snprintf(isize, sizeof(isize), "%'.1f%s", totsize, - ngettext("GB", "GB", totsize)); + snprintf(isize, sizeof(isize), "%'.1f%s", totsize, + ngettext("GB", "GB", totsize)); else { totsize /= 1024.0; snprintf(isize, sizeof(isize), "%'.1f%s", - totsize, ngettext("TB", "TB", totsize)); + totsize, ngettext("TB", "TB", totsize)); } } } } snprintf(image_info, PATH_MAX, "%s: %d %s %s: %s", - _("Total"), tb->totimages, ngettext("image", "images", - tb->totimages), _("Size"), isize); + _("Total"), tb->totimages, ngettext("image", "images", + tb->totimages), _("Size"), isize); elm_object_text_set(tb->ephoto->infolabel, image_info); } } @@ -1132,16 +1133,16 @@ _ephoto_thumb_zoom_set(Ephoto_Thumb_Browser *tb, int zoom) double scale = elm_config_scale_get(); if (zoom > ZOOM_MAX) - zoom = ZOOM_MAX; + zoom = ZOOM_MAX; else if (zoom < ZOOM_MIN) - zoom = ZOOM_MIN; + zoom = ZOOM_MIN; ephoto_thumb_size_set(tb->ephoto, zoom); elm_gengrid_item_size_set(tb->grid, zoom * scale, zoom * scale); } static void _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *search = data; Ephoto_Thumb_Browser *tb = evas_object_data_get(search, "thumb_browser"); @@ -1171,7 +1172,7 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, elm_gengrid_item_selected_set(o, EINA_FALSE); } found = elm_gengrid_search_by_text_item_get(tb->grid, next, NULL, pattern, - ELM_GLOB_MATCH_NOCASE); + ELM_GLOB_MATCH_NOCASE); while (found) { results = eina_list_append(results, found); @@ -1179,7 +1180,7 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, break; next = elm_gengrid_item_next_get(found); found = elm_gengrid_search_by_text_item_get(tb->grid, next, NULL, - pattern, ELM_GLOB_MATCH_NOCASE); + pattern, ELM_GLOB_MATCH_NOCASE); } tb->original_grid = tb->grid; elm_box_unpack(tb->gridbox, tb->original_grid); @@ -1191,14 +1192,14 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, elm_gengrid_align_set(tb->grid, 0.5, EVAS_HINT_FILL); elm_gengrid_multi_select_set(tb->grid, EINA_TRUE); elm_gengrid_multi_select_mode_set(tb->grid, - ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT); + ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT); elm_scroller_bounce_set(tb->grid, EINA_FALSE, EINA_TRUE); evas_object_smart_callback_add(tb->grid, "activated", - _ephoto_thumb_activated, tb); + _ephoto_thumb_activated, tb); evas_object_event_callback_add(tb->grid, EVAS_CALLBACK_MOUSE_UP, - _grid_mouse_up_cb, tb); + _grid_mouse_up_cb, tb); elm_drag_item_container_add(tb->grid, ANIM_TIME, DRAG_TIMEOUT, - _dnd_item_get, _dnd_item_data_get); + _dnd_item_get, _dnd_item_data_get); evas_object_data_set(tb->grid, "thumb_browser", tb); _ephoto_thumb_zoom_set(tb, tb->ephoto->config->thumb_size); elm_box_pack_end(tb->gridbox, tb->grid); @@ -1225,34 +1226,34 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, entry = elm_object_item_data_get(o); e = ephoto_entry_new(tb->ephoto, entry->path, entry->label, - EINA_FILE_REG); + EINA_FILE_REG); if (tb->sort == EPHOTO_SORT_ALPHABETICAL_ASCENDING) e->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, e, - _entry_cmp_grid_alpha_asc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, e, + _entry_cmp_grid_alpha_asc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_ALPHABETICAL_DESCENDING) e->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, e, - _entry_cmp_grid_alpha_desc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, e, + _entry_cmp_grid_alpha_desc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_MODTIME_ASCENDING) e->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, e, - _entry_cmp_grid_mod_asc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, e, + _entry_cmp_grid_mod_asc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_MODTIME_DESCENDING) e->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, e, - _entry_cmp_grid_mod_desc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, e, + _entry_cmp_grid_mod_desc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_SIMILARITY) e->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, e, - _entry_cmp_grid_similarity, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, e, + _entry_cmp_grid_similarity, NULL, NULL); if (e->item) { Eina_File *f; elm_object_item_data_set(e->item, e); tb->totimages++; f = eina_file_open(e->path, EINA_FALSE); - tb->totsize += (double) eina_file_size_get(f); + tb->totsize += (double)eina_file_size_get(f); eina_file_close(f); tb->searchentries = eina_list_append(tb->searchentries, e); } @@ -1278,7 +1279,7 @@ _ephoto_thumb_search_go(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Evas_Object *search = data; if (!search) @@ -1289,9 +1290,9 @@ _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED, elm_drag_item_container_del(tb->grid); tb->entries = tb->ephoto->entries; if (eina_list_count(tb->ephoto->searchentries)) - eina_list_free(tb->ephoto->searchentries); + eina_list_free(tb->ephoto->searchentries); if (eina_list_count(tb->searchentries)) - eina_list_free(tb->searchentries); + eina_list_free(tb->searchentries); tb->ephoto->searchentries = NULL; tb->searchentries = NULL; if (tb->original_grid) @@ -1324,7 +1325,7 @@ _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_thumb_search_start(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; Evas_Object *hbox, *search; @@ -1350,13 +1351,13 @@ _ephoto_thumb_search_start(void *data, Evas_Object *obj EINA_UNUSED, elm_entry_scrollable_set(search, EINA_TRUE); elm_object_part_text_set(search, "guide", _("Search")); elm_scroller_policy_set(search, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); + ELM_SCROLLER_POLICY_OFF); EPHOTO_WEIGHT(search, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_FILL(search); evas_object_data_set(search, "thumb_browser", tb); evas_object_data_set(search, "parent", hbox); evas_object_smart_callback_add(search, "activated", - _ephoto_thumb_search_go, search); + _ephoto_thumb_search_go, search); elm_box_pack_end(hbox, search); evas_object_show(search); @@ -1379,11 +1380,11 @@ _ephoto_thumb_view_add(Ephoto_Thumb_Browser *tb) tb->nolabel = elm_label_add(tb->table); elm_label_line_wrap_set(tb->nolabel, ELM_WRAP_WORD); elm_object_text_set(tb->nolabel, - _("There are no images in this directory")); + _("There are no images in this directory")); EPHOTO_EXPAND(tb->nolabel); EPHOTO_FILL(tb->nolabel); evas_object_size_hint_aspect_set(tb->nolabel, EVAS_ASPECT_CONTROL_VERTICAL, - 1, 1); + 1, 1); elm_table_pack(tb->table, tb->nolabel, 0, 0, 5, 1); evas_object_show(tb->nolabel); @@ -1399,19 +1400,19 @@ _ephoto_thumb_view_add(Ephoto_Thumb_Browser *tb) elm_gengrid_align_set(tb->grid, 0.5, EVAS_HINT_FILL); elm_gengrid_multi_select_set(tb->grid, EINA_TRUE); elm_gengrid_multi_select_mode_set(tb->grid, - ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT); + ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT); elm_scroller_bounce_set(tb->grid, EINA_FALSE, EINA_TRUE); evas_object_smart_callback_add(tb->grid, "activated", - _ephoto_thumb_activated, tb); + _ephoto_thumb_activated, tb); evas_object_event_callback_add(tb->grid, EVAS_CALLBACK_MOUSE_UP, - _grid_mouse_up_cb, tb); + _grid_mouse_up_cb, tb); evas_object_event_callback_add(tb->grid, EVAS_CALLBACK_MOUSE_WHEEL, - _grid_mouse_wheel, tb); + _grid_mouse_wheel, tb); elm_drag_item_container_add(tb->grid, ANIM_TIME, DRAG_TIMEOUT, - _dnd_item_get, _dnd_item_data_get); + _dnd_item_get, _dnd_item_data_get); elm_drop_item_container_add(tb->grid, ELM_SEL_FORMAT_TARGETS, - _drop_item_getcb, _drop_enter, tb, _drop_leave, tb, _drop_pos, tb, - _drop_dropcb, NULL); + _drop_item_getcb, _drop_enter, tb, _drop_leave, tb, _drop_pos, tb, + _drop_dropcb, NULL); evas_object_data_set(tb->grid, "thumb_browser", tb); elm_box_pack_end(tb->gridbox, tb->grid); evas_object_show(tb->grid); @@ -1442,67 +1443,66 @@ _todo_items_process(void *data) return EINA_TRUE; tb->animator.todo_items = NULL; tb->processing = 0; - return EINA_FALSE; + return EINA_FALSE; } if ((tb->ls) && (eina_list_count(tb->todo_items) < TODO_ITEM_MIN_BATCH)) - return EINA_TRUE; + return EINA_TRUE; tb->animator.todo_items = NULL; tb->processing = 1; EINA_LIST_FREE(tb->todo_items, entry) - { - i++; - if (i > TODO_ITEM_MIN_BATCH) - return EINA_TRUE; - else if (!entry->is_dir && !entry->item) - { - const Elm_Gengrid_Item_Class *ic; + { + i++; + if (i > TODO_ITEM_MIN_BATCH) + return EINA_TRUE; + else if (!entry->is_dir && !entry->item) + { + const Elm_Gengrid_Item_Class *ic; - entry->gengrid = tb->grid; + entry->gengrid = tb->grid; - if (tb->ephoto->config->thumbnail_aspect) - _ephoto_thumb_file_class.item_style = "default"; - else - _ephoto_thumb_file_class.item_style = "thumb"; - ic = &_ephoto_thumb_file_class; + if (tb->ephoto->config->thumbnail_aspect) + _ephoto_thumb_file_class.item_style = "default"; + else + _ephoto_thumb_file_class.item_style = "thumb"; + ic = &_ephoto_thumb_file_class; - if (tb->sort == EPHOTO_SORT_ALPHABETICAL_ASCENDING) - entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_alpha_asc, NULL, NULL); - else if (tb->sort == EPHOTO_SORT_ALPHABETICAL_DESCENDING) - entry->item = + if (tb->sort == EPHOTO_SORT_ALPHABETICAL_ASCENDING) + entry->item = elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_alpha_desc, NULL, NULL); - else if (tb->sort == EPHOTO_SORT_MODTIME_ASCENDING) - entry->item = + _entry_cmp_grid_alpha_asc, NULL, NULL); + else if (tb->sort == EPHOTO_SORT_ALPHABETICAL_DESCENDING) + entry->item = elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_mod_asc, NULL, NULL); - else if (tb->sort == EPHOTO_SORT_MODTIME_DESCENDING) - entry->item = + _entry_cmp_grid_alpha_desc, NULL, NULL); + else if (tb->sort == EPHOTO_SORT_MODTIME_ASCENDING) + entry->item = elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_mod_desc, NULL, NULL); - else if (tb->sort == EPHOTO_SORT_SIMILARITY) - entry->thumb = + _entry_cmp_grid_mod_asc, NULL, NULL); + else if (tb->sort == EPHOTO_SORT_MODTIME_DESCENDING) + entry->item = + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_mod_desc, NULL, NULL); + else if (tb->sort == EPHOTO_SORT_SIMILARITY) + entry->thumb = ephoto_thumb_add(entry->ephoto, tb->grid, entry); - if (entry->item) - { - elm_object_item_data_set(entry->item, entry); - - } - else if (tb->sort != EPHOTO_SORT_SIMILARITY) - { - ephoto_entry_free(tb->ephoto, entry); - } - } - tb->animator.processed++; - } + if (entry->item) + { + elm_object_item_data_set(entry->item, entry); + } + else if (tb->sort != EPHOTO_SORT_SIMILARITY) + { + ephoto_entry_free(tb->ephoto, entry); + } + } + tb->animator.processed++; + } return EINA_TRUE; } static Eina_Bool _ephoto_thumb_populate_start(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; @@ -1530,7 +1530,7 @@ _ephoto_thumb_populate_start(void *data, int type EINA_UNUSED, static Eina_Bool _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; @@ -1540,8 +1540,8 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, tb->ls = NULL; if (tb->main_deleted) { - free(tb); - return ECORE_CALLBACK_PASS_ON; + free(tb); + return ECORE_CALLBACK_PASS_ON; } if (!tb->ephoto->entries) { @@ -1555,7 +1555,7 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, } tb->entries = tb->ephoto->entries; ephoto_single_browser_entries_set(tb->ephoto->single_browser, - tb->ephoto->entries); + tb->ephoto->entries); if (eina_list_count(tb->entries) < 1 && tb->ephoto->config->folders) { ephoto_show_folders(tb->ephoto, EINA_FALSE); @@ -1568,7 +1568,7 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, static Eina_Bool _ephoto_thumb_populate_error(void *data, int type EINA_UNUSED, - void *event EINA_UNUSED) + void *event EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; @@ -1596,18 +1596,18 @@ _ephoto_thumb_entry_create(void *data, int type EINA_UNUSED, void *event) rp = ecore_file_realpath(e->path); if (!e->is_dir && !ecore_file_is_dir(rp)) { - Eina_File *f; + Eina_File *f; - tb->totimages += 1; - f = eina_file_open(e->path, EINA_FALSE); + tb->totimages += 1; + f = eina_file_open(e->path, EINA_FALSE); e->size = eina_file_size_get(f); - tb->totsize += (double) e->size; - eina_file_close(f); - tb->todo_items = eina_list_append(tb->todo_items, e); - tb->animator.count++; + tb->totsize += (double)e->size; + eina_file_close(f); + tb->todo_items = eina_list_append(tb->todo_items, e); + tb->animator.count++; } if (!tb->animator.todo_items) - tb->animator.todo_items = ecore_animator_add(_todo_items_process, tb); + tb->animator.todo_items = ecore_animator_add(_todo_items_process, tb); free(rp); return ECORE_CALLBACK_PASS_ON; @@ -1624,14 +1624,14 @@ ephoto_thumb_browser_slideshow(Evas_Object *obj) Ephoto_Entry *entry; if (it) - entry = elm_object_item_data_get(it); + entry = elm_object_item_data_get(it); else - entry = eina_list_nth(tb->entries, 0); + entry = eina_list_nth(tb->entries, 0); if (!entry) - return; + return; selected = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); - if (eina_list_count(selected) <= 1 && tb->searchentries) + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + if (eina_list_count(selected) <= 1 && tb->searchentries) { if (eina_list_count(tb->ephoto->selentries)) eina_list_free(tb->ephoto->selentries); @@ -1643,7 +1643,7 @@ ephoto_thumb_browser_slideshow(Evas_Object *obj) EINA_LIST_FOREACH(selected, s, item) { tb->ephoto->selentries = eina_list_append(tb->ephoto->selentries, - elm_object_item_data_get(item)); + elm_object_item_data_get(item)); } } else @@ -1662,7 +1662,7 @@ ephoto_thumb_browser_slideshow(Evas_Object *obj) static void _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { Ephoto_Thumb_Browser *tb = data; @@ -1671,14 +1671,14 @@ _ephoto_show_settings(void *data, Evas_Object *obj EINA_UNUSED, static void _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, - void *event_info) + void *event_info) { Ephoto_Thumb_Browser *tb = data; Evas_Event_Key_Down *ev = event_info; Eina_Bool ctrl = evas_key_modifier_is_set(ev->modifiers, "Control"); Eina_Bool shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); Eina_List *selected = - eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); + eina_list_clone(elm_gengrid_selected_items_get(tb->grid)); const char *k = ev->keyname; if (tb->ephoto->state != EPHOTO_STATE_THUMB) @@ -1687,21 +1687,21 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU if (ctrl) { if ((!strcasecmp(k, "plus")) || (!strcasecmp(k, "equal"))) - { - int zoom = tb->ephoto->config->thumb_size + ZOOM_STEP; + { + int zoom = tb->ephoto->config->thumb_size + ZOOM_STEP; - _ephoto_thumb_zoom_set(tb, zoom); - } - else if ((!strcasecmp(k, "minus")) || (!strcasecmp(k, "underscore"))) - { - int zoom = tb->ephoto->config->thumb_size - ZOOM_STEP; + _ephoto_thumb_zoom_set(tb, zoom); + } + else if ((!strcasecmp(k, "minus")) || (!strcasecmp(k, "underscore"))) + { + int zoom = tb->ephoto->config->thumb_size - ZOOM_STEP; - _ephoto_thumb_zoom_set(tb, zoom); - } - else if (!strcasecmp(k, "Tab")) - { - _view_single(tb, NULL, NULL); - } + _ephoto_thumb_zoom_set(tb, zoom); + } + else if (!strcasecmp(k, "Tab")) + { + _view_single(tb, NULL, NULL); + } else if (!strcasecmp(k, "c")) { _grid_menu_copy_cb(tb, NULL, NULL); @@ -1763,15 +1763,15 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU } else if (!strcasecmp(k, "F5")) { - Elm_Object_Item *it = elm_gengrid_selected_item_get(tb->grid); - Ephoto_Entry *entry; + Elm_Object_Item *it = elm_gengrid_selected_item_get(tb->grid); + Ephoto_Entry *entry; Eina_List *s; Elm_Object_Item *item; - if (it) - entry = elm_object_item_data_get(it); - else - entry = eina_list_nth(tb->entries, 0); + if (it) + entry = elm_object_item_data_get(it); + else + entry = eina_list_nth(tb->entries, 0); if (eina_list_count(selected) <= 1 && tb->searchentries) { if (eina_list_count(tb->ephoto->selentries)) @@ -1784,8 +1784,8 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU EINA_LIST_FOREACH(selected, s, item) { tb->ephoto->selentries = - eina_list_append(tb->ephoto->selentries, - elm_object_item_data_get(item)); + eina_list_append(tb->ephoto->selentries, + elm_object_item_data_get(item)); } } else @@ -1797,14 +1797,14 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU tb->ephoto->selentries = NULL; tb->ephoto->searchentries = NULL; } - if (entry) - evas_object_smart_callback_call(tb->main, "slideshow", entry); + if (entry) + evas_object_smart_callback_call(tb->main, "slideshow", entry); } else if (!strcasecmp(k, "F11")) { if (!elm_win_fullscreen_get(tb->ephoto->win)) { - elm_win_fullscreen_set(tb->ephoto->win, EINA_TRUE); + elm_win_fullscreen_set(tb->ephoto->win, EINA_TRUE); elm_box_pack_end(tb->ephoto->statusbar, tb->ephoto->exit); evas_object_show(tb->ephoto->exit); } @@ -1823,7 +1823,7 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU _grid_menu_clear_cb(tb, NULL, NULL); } else if (ev->compose && (((ev->compose[0] != '\\') - && (ev->compose[0] >= ' ')) || ev->compose[1])) + && (ev->compose[0] >= ' ')) || ev->compose[1])) { if (!tb->searching) { @@ -1840,7 +1840,7 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU _ephoto_thumb_search_go(tb->search, NULL, NULL); } else if (tb->searching && ((!strcasecmp(k, "Backspace")) || - !strcasecmp(k, "Delete"))) + !strcasecmp(k, "Delete"))) { _ephoto_thumb_search_go(tb->search, NULL, NULL); } @@ -1850,7 +1850,7 @@ _ephoto_main_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU static void _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_Thumb_Browser *tb = data; Ecore_Event_Handler *handler; @@ -1858,38 +1858,38 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _todo_items_free(tb); elm_drop_item_container_del(tb->grid); elm_drag_item_container_del(tb->grid); - EINA_LIST_FREE(tb->handlers, handler) ecore_event_handler_del(handler); + EINA_LIST_FREE(tb->handlers, handler) + ecore_event_handler_del(handler); if (tb->animator.todo_items) { - ecore_animator_del(tb->animator.todo_items); - tb->animator.todo_items = NULL; + ecore_animator_del(tb->animator.todo_items); + tb->animator.todo_items = NULL; } if (tb->ls) { - tb->main_deleted = EINA_TRUE; - eio_file_cancel(tb->ls); - return; + tb->main_deleted = EINA_TRUE; + eio_file_cancel(tb->ls); + return; } if (eina_list_count(tb->cut_items)) - eina_list_free(tb->cut_items); + eina_list_free(tb->cut_items); else if (eina_list_count(tb->copy_items)) - eina_list_free(tb->copy_items); + eina_list_free(tb->copy_items); if (eina_list_count(tb->ephoto->selentries)) - eina_list_free(tb->ephoto->selentries); + eina_list_free(tb->ephoto->selentries); if (eina_list_count(tb->ephoto->searchentries)) - eina_list_free(tb->ephoto->searchentries); + eina_list_free(tb->ephoto->searchentries); if (eina_list_count(tb->searchentries)) - eina_list_free(tb->searchentries); + eina_list_free(tb->searchentries); free(tb); } - /*Ephoto Thumb Browser Public Functions*/ void ephoto_thumb_browser_dirs_only_set(Ephoto *ephoto, Eina_Bool dirs_only) { Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); tb->dirs_only = dirs_only; } @@ -1898,7 +1898,7 @@ void ephoto_thumb_browser_clear(Ephoto *ephoto) { Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); elm_gengrid_clear(tb->grid); } @@ -1908,14 +1908,14 @@ ephoto_thumb_browser_recalc(Ephoto *ephoto) { ephoto_thumb_browser_clear(ephoto); ephoto_directory_set(ephoto, ephoto->config->directory, - NULL, 0, 1); + NULL, 0, 1); } void ephoto_thumb_browser_paste(Ephoto *ephoto, Elm_Object_Item *item) { Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); Ephoto_Entry *entry; const char *path; @@ -1945,7 +1945,7 @@ void ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry) { Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); if (!entry->is_dir && !entry->item) { @@ -1955,7 +1955,7 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry) tb->totimages += 1; f = eina_file_open(entry->path, EINA_FALSE); entry->size = eina_file_size_get(f); - tb->totsize += (double) entry->size; + tb->totsize += (double)entry->size; eina_file_close(f); entry->gengrid = tb->grid; @@ -1963,24 +1963,24 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry) ic = &_ephoto_thumb_file_class; if (tb->sort == EPHOTO_SORT_ALPHABETICAL_ASCENDING) entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_alpha_asc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_alpha_asc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_ALPHABETICAL_DESCENDING) entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_alpha_desc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_alpha_desc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_MODTIME_ASCENDING) entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_mod_asc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_mod_asc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_MODTIME_DESCENDING) entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_mod_desc, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_mod_desc, NULL, NULL); else if (tb->sort == EPHOTO_SORT_SIMILARITY) entry->item = - elm_gengrid_item_sorted_insert(tb->grid, ic, entry, - _entry_cmp_grid_similarity, NULL, NULL); + elm_gengrid_item_sorted_insert(tb->grid, ic, entry, + _entry_cmp_grid_similarity, NULL, NULL); if (entry->item) { elm_object_item_data_set(entry->item, entry); @@ -1996,8 +1996,8 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry) void ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry) { - Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + Ephoto_Thumb_Browser *tb = + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); if (!entry->is_dir) { @@ -2019,7 +2019,7 @@ void ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry) { Ephoto_Thumb_Browser *tb = - evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); + evas_object_data_get(ephoto->thumb_browser, "thumb_browser"); if (!entry->is_dir) { @@ -2029,7 +2029,7 @@ ephoto_thumb_browser_update(Ephoto *ephoto, Ephoto_Entry *entry) f = eina_file_open(entry->path, EINA_FALSE); entry->size = eina_file_size_get(f); - tb->totsize += (double) entry->size; + tb->totsize += (double)entry->size; eina_file_close(f); elm_gengrid_item_update(entry->item); @@ -2042,15 +2042,15 @@ void ephoto_thumb_browser_show_controls(Ephoto *ephoto) { Ephoto_Thumb_Browser *tb = evas_object_data_get(ephoto->thumb_browser, - "thumb_browser"); + "thumb_browser"); Evas_Object *but, *ic, *hover; int ret; evas_object_del(ephoto->view_button); ic = elm_icon_add(ephoto->statusbar); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "document-open"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2067,8 +2067,8 @@ ephoto_thumb_browser_show_controls(Ephoto *ephoto) ephoto->view_button = but; ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); ret = elm_icon_standard_set(ic, "zoom-in"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2083,8 +2083,8 @@ ephoto_thumb_browser_show_controls(Ephoto *ephoto) evas_object_show(but); ic = elm_icon_add(ephoto->controls_left); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); elm_icon_standard_set(ic, "zoom-out"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); @@ -2101,19 +2101,19 @@ ephoto_thumb_browser_show_controls(Ephoto *ephoto) hover = elm_hoversel_add(ephoto->controls_right); elm_hoversel_hover_parent_set(hover, ephoto->win); elm_hoversel_item_add(hover, _("Alphabetical Ascending"), - "view-sort-ascending", ELM_ICON_STANDARD, _sort_alpha_asc, tb); + "view-sort-ascending", ELM_ICON_STANDARD, _sort_alpha_asc, tb); elm_hoversel_item_add(hover, _("Alphabetical Descending"), - "view-sort-descending", ELM_ICON_STANDARD, _sort_alpha_desc, tb); + "view-sort-descending", ELM_ICON_STANDARD, _sort_alpha_desc, tb); elm_hoversel_item_add(hover, _("Modification Time Ascending"), - "view-sort-ascending", ELM_ICON_STANDARD, _sort_mod_asc, tb); + "view-sort-ascending", ELM_ICON_STANDARD, _sort_mod_asc, tb); elm_hoversel_item_add(hover, _("Modification Time Descending"), - "view-sort-descending", ELM_ICON_STANDARD, _sort_mod_desc, tb); + "view-sort-descending", ELM_ICON_STANDARD, _sort_mod_desc, tb); tb->similarity = elm_hoversel_item_add(hover, _("Image Simalarity"), - "view-sort-ascending", ELM_ICON_STANDARD, _sort_similarity, tb); + "view-sort-ascending", ELM_ICON_STANDARD, _sort_similarity, tb); elm_object_text_set(hover, _("Sort")); ic = elm_icon_add(hover); - evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), - 20*elm_config_scale_get()); + evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(), + 20 * elm_config_scale_get()); elm_icon_standard_set(ic, "view-sort-ascending"); elm_object_part_content_set(hover, "icon", ic); evas_object_show(ic); @@ -2158,37 +2158,37 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent) EPHOTO_EXPAND(tb->main); EPHOTO_FILL(tb->main); evas_object_event_callback_add(tb->main, EVAS_CALLBACK_DEL, - _ephoto_main_del, tb); + _ephoto_main_del, tb); evas_object_event_callback_add(tb->main, EVAS_CALLBACK_KEY_DOWN, - _ephoto_main_key_down, tb); + _ephoto_main_key_down, tb); evas_object_data_set(tb->main, "thumb_browser", tb); _ephoto_thumb_view_add(tb); elm_box_pack_end(tb->main, tb->table); tb->handlers = - eina_list_append(tb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, - _ephoto_thumb_populate_start, tb)); + eina_list_append(tb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_START, + _ephoto_thumb_populate_start, tb)); tb->handlers = - eina_list_append(tb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, - _ephoto_thumb_populate_end, tb)); + eina_list_append(tb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END, + _ephoto_thumb_populate_end, tb)); tb->handlers = - eina_list_append(tb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, - _ephoto_thumb_populate_error, tb)); + eina_list_append(tb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_POPULATE_ERROR, + _ephoto_thumb_populate_error, tb)); tb->handlers = - eina_list_append(tb->handlers, - ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, - _ephoto_thumb_entry_create, tb)); + eina_list_append(tb->handlers, + ecore_event_handler_add(EPHOTO_EVENT_ENTRY_CREATE, + _ephoto_thumb_entry_create, tb)); return tb->main; - error: +error: evas_object_del(tb->main); return NULL; } diff --git a/src/bin/ephoto_thumbnailer.c b/src/bin/ephoto_thumbnailer.c index 7d4ca39..0b335ad 100644 --- a/src/bin/ephoto_thumbnailer.c +++ b/src/bin/ephoto_thumbnailer.c @@ -122,7 +122,7 @@ _e_ipc_init(void) return 0; } _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) { printf("Error: could not connect to Ephoto IPC port=%d\n", port); @@ -138,7 +138,7 @@ _e_ipc_init(void) static Eina_Bool _e_ipc_cb_server_add(void *data EINA_UNUSED, - int type EINA_UNUSED, + int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Server_Add *e; @@ -152,8 +152,8 @@ _e_ipc_cb_server_add(void *data EINA_UNUSED, } static Eina_Bool -_e_ipc_cb_server_del(void *data EINA_UNUSED, - int type EINA_UNUSED, +_e_ipc_cb_server_del(void *data EINA_UNUSED, + int type EINA_UNUSED, void *event EINA_UNUSED) { /* quit now */ @@ -163,7 +163,7 @@ _e_ipc_cb_server_del(void *data EINA_UNUSED, static Eina_Bool _e_ipc_cb_server_data(void *data EINA_UNUSED, - int type EINA_UNUSED, + int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Server_Data *e; @@ -480,16 +480,16 @@ _e_thumb_generate(E_Thumb *eth) int hi, si, vi; float h, s, v; const int pat2[4] = - { - 0, 3, 1, 2 - }; + { + 0, 3, 1, 2 + }; const int pat1[16] = - { - 5, 10, 6, 9, - 0, 15, 3, 12, - 1, 14, 7, 8, - 4, 11, 2, 13 - }; + { + 5, 10, 6, 9, + 0, 15, 3, 12, + 1, 14, 7, 8, + 4, 11, 2, 13 + }; /* ww = hh = 1 here */ data3 = malloc(sizeof(unsigned int)); @@ -577,7 +577,8 @@ end: /* will free all */ if (edje) evas_object_del(edje); 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 (bg) evas_object_del(bg); ecore_evas_free(ee); @@ -621,7 +622,7 @@ e_sha1_sum(unsigned char *data, int size, unsigned char *dst) buf[63] = (size) & 0xff; } buf[idx] = *d; - idx++;; + idx++; if ((idx == 64) || (left == 1)) { if ((left == 1) && (idx < 64)) buf[idx] = 0x80;