2010-07-01 11:49:22 -07:00
|
|
|
#ifndef _EPHOTO_H_
|
|
|
|
#define _EPHOTO_H_
|
|
|
|
|
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
#include <Eet.h>
|
2010-07-01 11:49:22 -07:00
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Evas.h>
|
|
|
|
#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-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
|
|
|
#include "config.h"
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
typedef struct _Ephoto_Config Ephoto_Config;
|
|
|
|
typedef struct _Ephoto Ephoto;
|
2010-10-09 12:13:35 -07:00
|
|
|
typedef struct _Ephoto_Entry Ephoto_Entry;
|
2010-09-13 15:24:59 -07:00
|
|
|
|
|
|
|
typedef enum _Ephoto_State Ephoto_State;
|
2010-09-14 01:35:42 -07:00
|
|
|
typedef enum _Ephoto_Orient Ephoto_Orient;
|
2010-09-13 15:24:59 -07:00
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
/*Main Functions*/
|
2010-07-10 14:52:14 -07:00
|
|
|
void ephoto_create_main_window(const char *directory, const char *image);
|
2010-10-08 15:48:12 -07:00
|
|
|
void ephoto_thumb_size_set(int size);
|
|
|
|
Evas_Object *ephoto_thumb_add(Evas_Object *parent, const char *path);
|
2010-10-09 12:13:35 -07:00
|
|
|
void ephoto_thumb_path_set(Evas_Object *o, const char *path);
|
2010-10-08 15:48:12 -07:00
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
/* Configuration */
|
|
|
|
Eina_Bool ephoto_config_init(Ephoto *em);
|
2010-09-14 00:02:04 -07:00
|
|
|
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
|
2010-09-13 15:24:59 -07:00
|
|
|
void ephoto_config_free(Ephoto *em);
|
|
|
|
|
2010-09-19 08:30:36 -07:00
|
|
|
/* Preferences */
|
|
|
|
void ephoto_show_preferences(Ephoto *em);
|
|
|
|
|
2010-07-05 14:07:53 -07:00
|
|
|
/*Ephoto Flow Browser*/
|
2010-09-13 09:40:33 -07:00
|
|
|
Evas_Object *ephoto_create_flow_browser(Evas_Object *parent);
|
|
|
|
void ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image);
|
|
|
|
/* smart callbacks called:
|
|
|
|
* "delete,request" - the user requested to delete the flow browser, typically called when go_back button is pressed or Escape key is typed.
|
|
|
|
*/
|
|
|
|
|
2010-07-05 14:07:53 -07:00
|
|
|
|
2010-07-27 19:06:03 -07:00
|
|
|
/*Ephoto Slideshow*/
|
|
|
|
void ephoto_create_slideshow(void);
|
|
|
|
void ephoto_show_slideshow(int view, const char *current_image);
|
|
|
|
void ephoto_hide_slideshow(void);
|
|
|
|
void ephoto_delete_slideshow(void);
|
|
|
|
|
2010-10-03 02:50:00 -07:00
|
|
|
/* Ephoto Directory Thumb */
|
2010-10-09 12:13:35 -07:00
|
|
|
Evas_Object *ephoto_directory_thumb_add(Evas_Object *parent, Ephoto_Entry *e);
|
2010-10-03 02:50:00 -07:00
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
/*Ephoto Thumb Browser*/
|
2010-10-09 12:13:35 -07:00
|
|
|
Evas_Object *ephoto_thumb_browser_add(Evas_Object *parent);
|
2010-09-13 09:40:33 -07:00
|
|
|
/* smart callbacks called:
|
|
|
|
* "selected" - an item in the thumb browser is selected. The selected file is passed as event_info argument.
|
2010-09-13 10:02:32 -07:00
|
|
|
* "directory,changed" - the user selected a new directory. The selected directory is passed as event_info argument.
|
2010-09-13 09:40:33 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Enum for the state machine */
|
|
|
|
enum _Ephoto_State
|
|
|
|
{
|
|
|
|
EPHOTO_STATE_THUMB,
|
|
|
|
EPHOTO_STATE_FLOW,
|
|
|
|
EPHOTO_STATE_SLIDESHOW
|
|
|
|
};
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2010-09-14 01:35:42 -07:00
|
|
|
enum _Ephoto_Orient
|
|
|
|
{
|
|
|
|
EPHOTO_ORIENT_0,
|
|
|
|
EPHOTO_ORIENT_90,
|
|
|
|
EPHOTO_ORIENT_180,
|
|
|
|
EPHOTO_ORIENT_270
|
|
|
|
};
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
struct _Ephoto_Config
|
|
|
|
{
|
|
|
|
int config_version;
|
|
|
|
|
|
|
|
int thumb_size;
|
2010-10-08 15:48:12 -07:00
|
|
|
int thumb_gen_size;
|
2010-09-19 08:30:36 -07:00
|
|
|
|
|
|
|
int remember_directory;
|
|
|
|
const char *directory;
|
|
|
|
|
|
|
|
double slideshow_timeout;
|
|
|
|
const char *slideshow_transition;
|
2010-09-27 15:02:10 -07:00
|
|
|
|
|
|
|
const char *editor;
|
2010-09-13 15:24:59 -07:00
|
|
|
};
|
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
/*Ephoto Main Structure*/
|
|
|
|
struct _Ephoto
|
|
|
|
{
|
|
|
|
Evas *e;
|
|
|
|
Evas_Object *win;
|
|
|
|
Evas_Object *bg;
|
2010-09-13 09:29:39 -07:00
|
|
|
Evas_Object *layout;
|
2010-07-05 14:07:53 -07:00
|
|
|
Evas_Object *flow_browser;
|
2010-07-27 19:06:03 -07:00
|
|
|
Evas_Object *slideshow;
|
2010-09-29 10:34:35 -07:00
|
|
|
Evas_Object *slideshow_notify;
|
2010-07-01 11:49:22 -07:00
|
|
|
Evas_Object *thumb_browser;
|
2010-10-09 12:13:35 -07:00
|
|
|
Eina_List *entries;
|
|
|
|
|
2010-09-19 08:30:36 -07:00
|
|
|
Evas_Object *prefs_win;
|
2010-09-13 09:40:33 -07:00
|
|
|
Ephoto_State state;
|
2010-09-13 15:24:59 -07:00
|
|
|
|
|
|
|
Ephoto_Config *config;
|
|
|
|
|
|
|
|
Eet_Data_Descriptor *config_edd;
|
|
|
|
Ecore_Timer *config_save;
|
2010-07-01 11:49:22 -07:00
|
|
|
};
|
2010-09-13 09:40:33 -07:00
|
|
|
|
2010-10-09 12:13:35 -07:00
|
|
|
struct _Ephoto_Entry
|
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
const char *basename; /* pointer inside path */
|
|
|
|
const char *label;
|
|
|
|
Elm_Gengrid_Item *item;
|
|
|
|
Eina_List *dir_files; /* if dir, here contain files with preview */
|
|
|
|
Eina_Bool dir_files_checked : 1;
|
|
|
|
Eina_Bool is_dir : 1;
|
|
|
|
Eina_Bool is_up : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
Ephoto_Entry *ephoto_entry_new(const char *path, const char *label);
|
|
|
|
void ephoto_entry_free(Ephoto_Entry *entry);
|
|
|
|
void ephoto_entries_free(Ephoto *em);
|
|
|
|
|
2010-07-01 11:49:22 -07:00
|
|
|
extern Ephoto *em;
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
extern int __log_domain;
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(__log_domain, __VA_ARGS__)
|
2010-10-08 15:48:12 -07:00
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(__log_domain, __VA_ARGS__)
|
2010-09-13 15:24:59 -07:00
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(__log_domain, __VA_ARGS__)
|
2010-07-01 11:49:22 -07:00
|
|
|
|
2010-10-08 14:43:57 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
_ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
|
|
|
|
{
|
|
|
|
const char *type, *bname, *ext;
|
|
|
|
|
|
|
|
bname = info->path + info->name_start;
|
|
|
|
if (bname[0] == '.') return EINA_FALSE;
|
|
|
|
if ((info->dirent->d_type != DT_REG) && (info->dirent->d_type != DT_UNKNOWN))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
ext = info->path + info->path_length - 1;
|
|
|
|
for (; ext > bname; ext--) if (*ext == '.') break;
|
|
|
|
if (*ext == '.')
|
|
|
|
{
|
|
|
|
ext++;
|
|
|
|
if ((strcasecmp(ext, "jpg") == 0) ||
|
|
|
|
(strcasecmp(ext, "jpeg") == 0) ||
|
|
|
|
(strcasecmp(ext, "png") == 0))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(type = efreet_mime_type_get(info->path))) return EINA_FALSE;
|
|
|
|
return strncmp(type, "image/", sizeof("image/") - 1) == 0;
|
|
|
|
}
|
|
|
|
|
2010-09-13 15:24:59 -07:00
|
|
|
#endif
|