2010-07-01 11:49:22 -07:00
|
|
|
#ifndef _EPHOTO_H_
|
|
|
|
#define _EPHOTO_H_
|
|
|
|
|
2010-10-11 21:58:04 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
2010-07-01 11:49:22 -07:00
|
|
|
#endif
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
#include <Eet.h>
|
2010-07-01 11:49:22 -07:00
|
|
|
#include <Ecore.h>
|
2011-02-24 14:26:47 -08:00
|
|
|
#include <Ecore_Evas.h>
|
2010-07-01 11:49:22 -07:00
|
|
|
#include <Ecore_File.h>
|
|
|
|
#include <Efreet_Mime.h>
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include <Eina.h>
|
|
|
|
#include <Edje.h>
|
|
|
|
#include <Evas.h>
|
2010-07-22 09:15:16 -07:00
|
|
|
#include <Eio.h>
|
2010-10-15 10:40:03 -07:00
|
|
|
#include <Ethumb_Client.h>
|
2010-07-01 11:49:22 -07:00
|
|
|
#include <limits.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2010-10-08 14:43:57 -07:00
|
|
|
#include <dirent.h>
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2011-02-24 14:26:47 -08:00
|
|
|
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;
|
|
|
|
|
|
|
|
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);
|
|
|
|
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, const char *path);
|
|
|
|
void ephoto_thumb_path_set(Evas_Object *o, const char *path);
|
|
|
|
void ephoto_directory_set(Ephoto *ephoto, const char *path);
|
|
|
|
|
|
|
|
Eina_Bool ephoto_config_init(Ephoto *em);
|
2014-11-18 19:18:22 -08:00
|
|
|
void ephoto_config_save(Ephoto *em);
|
2011-02-24 14:26:47 -08:00
|
|
|
void ephoto_config_free(Ephoto *em);
|
2014-11-19 14:50:56 -08:00
|
|
|
void ephoto_config_window(Ephoto *em);
|
2014-11-20 18:28:55 -08:00
|
|
|
void ephoto_about_window(Ephoto *em);
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2011-05-17 13:02:53 -07:00
|
|
|
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
|
|
|
|
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
|
|
|
|
void ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path);
|
2015-02-12 11:19:27 -08:00
|
|
|
Evas_Object *ephoto_cropper_add(Evas_Object *parent, const char *file, const char *key);
|
2011-06-28 15:26:16 -07:00
|
|
|
/* smart callbacks called:
|
2014-11-23 13:44:24 -08:00
|
|
|
* "back" - the user wants to go back to the previous screen.
|
2011-06-28 15:26:16 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent);
|
|
|
|
void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
|
|
|
|
/* smart callbacks called:
|
2014-11-23 13:44:24 -08:00
|
|
|
* "back" - the user wants to go back to the previous screen.
|
2011-06-28 15:26:16 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
|
|
|
|
|
|
|
|
/* smart callbacks called:
|
|
|
|
* "selected" - an item in the thumb browser is selected. The selected Ephoto_Entry is passed as event_info argument.
|
|
|
|
*/
|
2010-10-09 18:13:53 -07:00
|
|
|
|
2010-09-13 09:40:33 -07:00
|
|
|
enum _Ephoto_State
|
|
|
|
{
|
2011-02-24 14:26:47 -08:00
|
|
|
EPHOTO_STATE_THUMB,
|
|
|
|
EPHOTO_STATE_SINGLE,
|
|
|
|
EPHOTO_STATE_SLIDESHOW
|
|
|
|
};
|
|
|
|
|
2011-06-28 15:26:16 -07:00
|
|
|
enum _Ephoto_Orient /* matches with exif orientation tag */
|
2011-02-24 14:26:47 -08:00
|
|
|
{
|
|
|
|
EPHOTO_ORIENT_0 = 1,
|
|
|
|
EPHOTO_ORIENT_FLIP_HORIZ = 2,
|
|
|
|
EPHOTO_ORIENT_180 = 3,
|
|
|
|
EPHOTO_ORIENT_FLIP_VERT = 4,
|
|
|
|
EPHOTO_ORIENT_FLIP_VERT_90 = 5,
|
|
|
|
EPHOTO_ORIENT_90 = 6,
|
|
|
|
EPHOTO_ORIENT_FLIP_HORIZ_90 = 7,
|
|
|
|
EPHOTO_ORIENT_270 = 8
|
|
|
|
};
|
|
|
|
|
2011-06-28 15:26:16 -07:00
|
|
|
/* TODO: split into window & global config, allow multi window
|
|
|
|
*
|
|
|
|
* This also requires single instance, as 2 instances changing the
|
|
|
|
* same configuration will lead to problems.
|
|
|
|
*
|
|
|
|
* Single instance is better done as DBus, using FDO standard methods.
|
|
|
|
*/
|
2011-02-24 14:26:47 -08:00
|
|
|
struct _Ephoto_Config
|
|
|
|
{
|
|
|
|
int config_version;
|
2011-03-15 13:09:37 -07:00
|
|
|
int thumb_size;
|
|
|
|
int thumb_gen_size;
|
2011-02-24 14:26:47 -08:00
|
|
|
const char *directory;
|
2014-11-18 19:18:22 -08:00
|
|
|
double slideshow_timeout;
|
|
|
|
const char *slideshow_transition;
|
|
|
|
const char *editor;
|
|
|
|
int window_width;
|
|
|
|
int window_height;
|
2014-11-21 14:40:09 -08:00
|
|
|
Evas_Object *window;
|
|
|
|
Evas_Object *slide_time;
|
|
|
|
Evas_Object *slide_trans;
|
2015-01-26 14:21:31 -08:00
|
|
|
int fsel_hide;
|
2010-09-13 15:24:59 -07:00
|
|
|
};
|
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
struct _Ephoto
|
|
|
|
{
|
2010-10-09 18:13:53 -07:00
|
|
|
Evas_Object *win;
|
|
|
|
Evas_Object *bg;
|
2014-11-18 11:37:49 -08:00
|
|
|
Evas_Object *panel;
|
2010-10-12 15:54:20 -07:00
|
|
|
Evas_Object *pager;
|
2010-10-09 18:13:53 -07:00
|
|
|
|
|
|
|
Evas_Object *thumb_browser;
|
2011-02-24 14:26:47 -08:00
|
|
|
Evas_Object *single_browser;
|
2010-10-09 18:13:53 -07:00
|
|
|
Evas_Object *slideshow;
|
2015-01-25 14:47:58 -08:00
|
|
|
Elm_Object_Item *tb;
|
|
|
|
Elm_Object_Item *sb;
|
|
|
|
Elm_Object_Item *sl;
|
2010-10-09 18:13:53 -07:00
|
|
|
|
2011-02-21 17:55:08 -08:00
|
|
|
Eina_List *entries;
|
2015-01-24 16:37:43 -08:00
|
|
|
Eina_List *direntries;
|
2011-06-28 15:26:16 -07:00
|
|
|
Eina_List *thumbs; /* live thumbs that need to be regenerated on changes */
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2011-06-28 15:26:16 -07:00
|
|
|
int thumb_gen_size; /* pending value for thumb_regen */
|
2015-01-25 12:51:40 -08:00
|
|
|
Evas_Coord bottom_bar_size;
|
2011-02-24 14:26:47 -08:00
|
|
|
struct {
|
|
|
|
Ecore_Timer *thumb_regen;
|
|
|
|
} timer;
|
|
|
|
struct {
|
|
|
|
Ecore_Job *change_dir;
|
|
|
|
} job;
|
|
|
|
|
|
|
|
Eio_File *ls;
|
|
|
|
|
|
|
|
Evas_Object *prefs_win;
|
2010-10-11 20:40:14 -07:00
|
|
|
Ephoto_State state, prev_state;
|
2011-02-24 14:26:47 -08:00
|
|
|
|
|
|
|
Ephoto_Config *config;
|
2010-11-13 17:51:16 -08:00
|
|
|
};
|
|
|
|
|
2011-02-21 17:55:08 -08:00
|
|
|
struct _Ephoto_Entry
|
|
|
|
{
|
|
|
|
const char *path;
|
2011-06-28 15:26:16 -07:00
|
|
|
const char *basename; /* pointer inside path */
|
2011-02-21 17:55:08 -08:00
|
|
|
const char *label;
|
2011-02-24 14:26:47 -08:00
|
|
|
Ephoto *ephoto;
|
2012-01-30 16:58:19 -08:00
|
|
|
Elm_Object_Item *item;
|
2011-02-21 17:55:08 -08:00
|
|
|
Eina_List *free_listeners;
|
2015-01-24 13:19:25 -08:00
|
|
|
Eina_Bool is_dir;
|
2011-02-21 17:55:08 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ephoto_Event_Entry_Create
|
|
|
|
{
|
|
|
|
Ephoto_Entry *entry;
|
|
|
|
};
|
|
|
|
|
2015-01-24 13:19:25 -08:00
|
|
|
Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, Eina_File_Type type);
|
2011-02-24 14:26:47 -08:00
|
|
|
void ephoto_entry_free(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);
|
2014-11-18 13:35:24 -08:00
|
|
|
int ephoto_entries_cmp(const void *pa, const void *pb);
|
2011-02-24 14:26:47 -08:00
|
|
|
|
|
|
|
extern int __log_domain;
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(__log_domain, __VA_ARGS__)
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(__log_domain, __VA_ARGS__)
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(__log_domain, __VA_ARGS__)
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
|
|
|
|
{
|
2014-08-04 16:55:49 -07:00
|
|
|
const char *type, *bname;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
const char *filters[] =
|
|
|
|
{
|
2014-09-22 03:12:41 -07:00
|
|
|
"png", "jpeg", "jpg", "eet", "xpm", "tiff", "gif", "svg", "webp", "pmaps",
|
2014-08-04 16:55:49 -07:00
|
|
|
"bmp", "tga", "wbmp", "ico", "psd", "jp2k", "generic"
|
|
|
|
};
|
2011-02-24 14:26:47 -08:00
|
|
|
|
|
|
|
bname = info->path + info->name_start;
|
|
|
|
if (bname[0] == '.') return EINA_FALSE;
|
|
|
|
if ((info->type != EINA_FILE_REG) && (info->type != EINA_FILE_UNKNOWN))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2014-08-06 21:33:30 -07:00
|
|
|
type = strrchr(bname, '.');
|
2014-08-04 16:55:49 -07:00
|
|
|
if(!type) return EINA_FALSE;
|
|
|
|
int count = sizeof(filters)/sizeof(filters[0]);
|
|
|
|
for (i=0; i < count; i++)
|
|
|
|
{
|
2015-01-06 08:18:58 -08:00
|
|
|
if (!strcasecmp(type+1, filters[i]))
|
2014-08-04 16:55:49 -07:00
|
|
|
return evas_object_image_extension_can_load_get(bname);
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
2011-06-28 15:26:16 -07:00
|
|
|
/* seems that this does not play nice with threads */
|
2014-08-04 16:09:33 -07:00
|
|
|
//if (!(type = efreet_mime_type_get(info->path))) return EINA_FALSE;
|
|
|
|
//return strncmp(type, "image/", sizeof("image/") - 1) == 0;
|
2011-02-24 14:26:47 -08:00
|
|
|
}
|
|
|
|
|
2011-06-28 15:26:16 -07:00
|
|
|
extern int EPHOTO_EVENT_ENTRY_CREATE;
|
2011-02-21 17:55:08 -08:00
|
|
|
extern int EPHOTO_EVENT_POPULATE_START;
|
|
|
|
extern int EPHOTO_EVENT_POPULATE_END;
|
|
|
|
extern int EPHOTO_EVENT_POPULATE_ERROR;
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
#endif
|