Make the flow browser follow the same code and styles as the rest of the code.
SVN revision: 57442
This commit is contained in:
parent
aadaa80ddd
commit
f95dca17df
|
@ -1,22 +1,11 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
static void _entry_free(void *data __UNUSED__, const Ephoto_Entry *entry __UNUSED__);
|
typedef enum _Ephoto_Flow_State Ephoto_Flow_State;
|
||||||
static Evas_Object *_ephoto_add_image_edje(const char *swallow);
|
enum _Ephoto_Flow_State
|
||||||
static Evas_Object *_ephoto_add_image(Evas_Object *swallow);
|
|
||||||
static void _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__);
|
|
||||||
static void _ephoto_flow_back(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__);
|
|
||||||
static void _ephoto_flow_prev(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__);
|
|
||||||
static void _ephoto_flow_next(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__);
|
|
||||||
static void _ephoto_center_image_clicked(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
|
|
||||||
static void _ephoto_show_slideshow(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__);
|
|
||||||
static void _ephoto_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info);
|
|
||||||
static void _ephoto_mouse_wheel(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info);
|
|
||||||
|
|
||||||
typedef enum _Ephoto_Flow_State
|
|
||||||
{
|
{
|
||||||
EPHOTO_FLOW_STATE_FLOW,
|
EPHOTO_FLOW_STATE_FLOW,
|
||||||
EPHOTO_FLOW_STATE_SINGLE
|
EPHOTO_FLOW_STATE_SINGLE
|
||||||
} Ephoto_Flow_State;
|
};
|
||||||
|
|
||||||
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
|
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
|
||||||
struct _Ephoto_Flow_Browser
|
struct _Ephoto_Flow_Browser
|
||||||
|
@ -25,13 +14,15 @@ struct _Ephoto_Flow_Browser
|
||||||
Eina_Bool mouse_wheel;
|
Eina_Bool mouse_wheel;
|
||||||
Eina_List *current_index;
|
Eina_List *current_index;
|
||||||
Eina_List *items;
|
Eina_List *items;
|
||||||
Evas_Object *box;
|
Evas_Object *edje;
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
|
Evas_Object *main_layout;
|
||||||
Evas_Object *images[5];
|
Evas_Object *images[5];
|
||||||
Evas_Object *img_edje[5];
|
Evas_Object *img_edje[5];
|
||||||
Evas_Object *toolbar;
|
Evas_Object *toolbar;
|
||||||
Ephoto_Flow_State efs;
|
Ephoto_Flow_State efs;
|
||||||
Ephoto_Entry *entry;
|
Ephoto_Entry *entry;
|
||||||
|
Ephoto *ephoto;
|
||||||
char *swallows[5];
|
char *swallows[5];
|
||||||
int flow_direct;
|
int flow_direct;
|
||||||
struct {
|
struct {
|
||||||
|
@ -42,91 +33,44 @@ struct _Ephoto_Flow_Browser
|
||||||
} action;
|
} action;
|
||||||
};
|
};
|
||||||
|
|
||||||
Ephoto *ephoto;
|
|
||||||
Ephoto_Flow_Browser *efb;
|
|
||||||
|
|
||||||
Evas_Object *
|
static void
|
||||||
ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
|
_entry_free(void *data, const Ephoto_Entry *entry __UNUSED__)
|
||||||
{
|
{
|
||||||
int i;
|
Ephoto_Flow_Browser *efb = data;
|
||||||
|
|
||||||
efb = calloc(1, sizeof(Ephoto_Flow_Browser));
|
efb->entry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
efb->efs = EPHOTO_FLOW_STATE_FLOW;
|
static Evas_Object *
|
||||||
efb->swallows[0] = "offscreen_left";
|
_add_image_edje(const char *swallow, Evas_Object *parent)
|
||||||
efb->swallows[1] = "left";
|
{
|
||||||
efb->swallows[2] = "center";
|
Evas_Object *o;
|
||||||
efb->swallows[3] = "right";
|
|
||||||
efb->swallows[4] = "offscreen_right";
|
|
||||||
efb->key_down = EINA_FALSE;
|
|
||||||
efb->mouse_wheel = EINA_FALSE;
|
|
||||||
|
|
||||||
ephoto = e;
|
o = elm_layout_add(parent);
|
||||||
|
|
||||||
efb->box = elm_box_add(parent);
|
|
||||||
elm_box_horizontal_set(efb->box, EINA_FALSE);
|
|
||||||
elm_box_homogenous_set(efb->box, EINA_FALSE);
|
|
||||||
evas_object_size_hint_weight_set
|
|
||||||
(efb->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
||||||
elm_win_resize_object_add(ephoto->win, efb->box);
|
|
||||||
evas_object_event_callback_add
|
|
||||||
(efb->box, EVAS_CALLBACK_MOUSE_WHEEL, _ephoto_mouse_wheel, NULL);
|
|
||||||
evas_object_event_callback_add
|
|
||||||
(efb->box, EVAS_CALLBACK_KEY_DOWN, _ephoto_key_down, NULL);
|
|
||||||
evas_object_show(efb->box);
|
|
||||||
|
|
||||||
efb->toolbar = elm_toolbar_add(efb->box);
|
|
||||||
elm_toolbar_homogenous_set(efb->toolbar, EINA_TRUE);
|
|
||||||
elm_toolbar_mode_shrink_set(efb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
|
|
||||||
elm_toolbar_menu_parent_set(efb->toolbar, efb->box);
|
|
||||||
evas_object_size_hint_weight_set(efb->toolbar, 0.0, 0.0);
|
|
||||||
evas_object_size_hint_align_set(efb->toolbar, EVAS_HINT_FILL, 0.0);
|
|
||||||
|
|
||||||
efb->action.go_back = elm_toolbar_item_append
|
|
||||||
(efb->toolbar, "edit-undo", "Back", _ephoto_flow_back, NULL);
|
|
||||||
elm_toolbar_item_priority_set(efb->action.go_back, 0);
|
|
||||||
efb->action.go_prev = elm_toolbar_item_append
|
|
||||||
(efb->toolbar, "go-previous", "Previous", _ephoto_flow_prev, NULL);
|
|
||||||
elm_toolbar_item_priority_set(efb->action.go_prev, 1);
|
|
||||||
efb->action.go_next = elm_toolbar_item_append
|
|
||||||
(efb->toolbar, "go-next", "Next", _ephoto_flow_next, NULL);
|
|
||||||
elm_toolbar_item_priority_set(efb->action.go_next, 2);
|
|
||||||
efb->action.slideshow = elm_toolbar_item_append
|
|
||||||
(efb->toolbar, "media-playback-start", "Slideshow", _ephoto_show_slideshow, NULL);
|
|
||||||
elm_toolbar_item_priority_set(efb->action.slideshow, 3);
|
|
||||||
|
|
||||||
elm_toolbar_icon_size_set(efb->toolbar, 32);
|
|
||||||
elm_box_pack_end(efb->box, efb->toolbar);
|
|
||||||
evas_object_show(efb->toolbar);
|
|
||||||
|
|
||||||
efb->layout = elm_layout_add(ephoto->win);
|
|
||||||
elm_layout_file_set
|
elm_layout_file_set
|
||||||
(efb->layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow");
|
(o, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow_image");
|
||||||
evas_object_size_hint_weight_set
|
elm_layout_content_set(parent, swallow, o);
|
||||||
(efb->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_show(o);
|
||||||
evas_object_size_hint_fill_set
|
|
||||||
(efb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
||||||
elm_win_resize_object_add(ephoto->win, efb->layout);
|
|
||||||
elm_box_pack_end(efb->box, efb->layout);
|
|
||||||
evas_object_show(efb->layout);
|
|
||||||
|
|
||||||
edje_object_signal_callback_add
|
return o;
|
||||||
(elm_layout_edje_get(efb->layout), "done", "ephoto", _ephoto_flow_done, NULL);
|
}
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
static Evas_Object *
|
||||||
|
_add_image(Evas_Object *swallow, Evas_Object *parent)
|
||||||
{
|
{
|
||||||
efb->img_edje[i] = _ephoto_add_image_edje(efb->swallows[i]);
|
Evas_Object *o;
|
||||||
efb->images[i] = _ephoto_add_image(efb->img_edje[i]);
|
|
||||||
if (i == 2)
|
o = elm_thumb_add(parent);
|
||||||
evas_object_event_callback_add
|
elm_object_style_set(o, "noframe");
|
||||||
(efb->img_edje[2], EVAS_CALLBACK_MOUSE_DOWN, _ephoto_center_image_clicked, NULL);
|
elm_layout_content_set(swallow, "image", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
return efb->box;
|
static void
|
||||||
}
|
_flow_browser_image_set(Ephoto_Flow_Browser *efb)
|
||||||
|
|
||||||
void
|
|
||||||
ephoto_flow_browser_image_set(void)
|
|
||||||
{
|
{
|
||||||
Eina_List *prevv, *prev, *next, *nextt;
|
Eina_List *prevv, *prev, *next, *nextt;
|
||||||
Ephoto_Entry *pp, *p, *n, *nn, *c;
|
Ephoto_Entry *pp, *p, *n, *nn, *c;
|
||||||
|
@ -173,114 +117,13 @@ ephoto_flow_browser_image_set(void)
|
||||||
elm_layout_content_set(efb->img_edje[4], "image", efb->images[4]);
|
elm_layout_content_set(efb->img_edje[4], "image", efb->images[4]);
|
||||||
elm_layout_content_set(efb->layout, "offscreen_right", efb->img_edje[4]);
|
elm_layout_content_set(efb->layout, "offscreen_right", efb->img_edje[4]);
|
||||||
|
|
||||||
elm_object_focus(efb->box);
|
elm_object_focus(efb->main_layout);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ephoto_flow_browser_del(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
|
||||||
evas_object_del(efb->images[i]);
|
|
||||||
eina_list_free(efb->items);
|
|
||||||
if (efb->entry)
|
|
||||||
ephoto_entry_free_listener_del(efb->entry, _entry_free, NULL);
|
|
||||||
evas_object_del(efb->layout);
|
|
||||||
evas_object_del(efb->toolbar);
|
|
||||||
evas_object_del(efb->box);
|
|
||||||
free(efb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ephoto_flow_browser_entry_set(Evas_Object *obj __UNUSED__, Ephoto_Entry *entry)
|
|
||||||
{
|
|
||||||
Eina_Bool same_file = EINA_FALSE;
|
|
||||||
Eina_List *l;
|
|
||||||
Ephoto_Entry *itr;
|
|
||||||
|
|
||||||
elm_object_focus(efb->layout);
|
|
||||||
if (!evas_object_key_grab(efb->box, "Escape", 0, 0, 1))
|
|
||||||
printf("Couldn't grab Escape key\n");
|
|
||||||
if (!evas_object_key_grab(efb->box, "Left", 0, 0, 1))
|
|
||||||
printf("Couldn't grab Left key\n");
|
|
||||||
if (!evas_object_key_grab(efb->box, "Right", 0, 0, 1))
|
|
||||||
printf("Couldn't grab Right key\n");
|
|
||||||
if (!evas_object_key_grab(efb->box, "BackSpace", 0, 0, 1))
|
|
||||||
printf("Couldn't grab BackSpace key\n");
|
|
||||||
if (!evas_object_key_grab(efb->box, "space", 0, 0, 1))
|
|
||||||
printf("Couldn't grab space key\n");
|
|
||||||
|
|
||||||
if (efb->entry)
|
|
||||||
{
|
|
||||||
ephoto_entry_free_listener_del(efb->entry, _entry_free, NULL);
|
|
||||||
if (entry && entry->path == efb->entry->path)
|
|
||||||
same_file = EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
efb->entry = entry;
|
|
||||||
|
|
||||||
if (entry)
|
|
||||||
ephoto_entry_free_listener_add(entry, _entry_free, NULL);
|
|
||||||
if (!efb->entry || same_file)
|
|
||||||
{
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_TRUE);
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_TRUE);
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_TRUE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_FALSE);
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_FALSE);
|
|
||||||
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_FALSE);
|
|
||||||
}
|
|
||||||
eina_list_free(efb->items);
|
|
||||||
efb->items = NULL;
|
|
||||||
EINA_LIST_FOREACH(ephoto->entries, l, itr)
|
|
||||||
{
|
|
||||||
efb->items = eina_list_append(efb->items, itr);
|
|
||||||
if (itr == entry) efb->current_index = eina_list_last(efb->items);
|
|
||||||
}
|
|
||||||
ephoto_flow_browser_image_set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_entry_free(void *data __UNUSED__, const Ephoto_Entry *entry __UNUSED__)
|
_flow_done(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
{
|
|
||||||
efb->entry = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_ephoto_add_image_edje(const char *swallow)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = elm_layout_add(efb->box);
|
|
||||||
elm_layout_file_set
|
|
||||||
(o, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow_image");
|
|
||||||
elm_layout_content_set(efb->layout, swallow, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_ephoto_add_image(Evas_Object *swallow)
|
|
||||||
{
|
|
||||||
Evas_Object *o;
|
|
||||||
|
|
||||||
o = elm_thumb_add(efb->box);
|
|
||||||
elm_object_style_set(o, "noframe");
|
|
||||||
elm_layout_content_set(swallow, "image", o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Object *edje;
|
Evas_Object *edje;
|
||||||
|
|
||||||
edje = elm_layout_edje_get(efb->layout);
|
edje = elm_layout_edje_get(efb->layout);
|
||||||
|
@ -291,14 +134,14 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *
|
||||||
efb->current_index = eina_list_prev(efb->current_index);
|
efb->current_index = eina_list_prev(efb->current_index);
|
||||||
if (!eina_list_data_get(efb->current_index))
|
if (!eina_list_data_get(efb->current_index))
|
||||||
efb->current_index = eina_list_last(efb->items);
|
efb->current_index = eina_list_last(efb->items);
|
||||||
ephoto_flow_browser_image_set();
|
_flow_browser_image_set(efb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
efb->current_index = eina_list_next(efb->current_index);
|
efb->current_index = eina_list_next(efb->current_index);
|
||||||
if (!eina_list_data_get(efb->current_index))
|
if (!eina_list_data_get(efb->current_index))
|
||||||
efb->current_index = eina_list_nth_list(efb->items, 0);
|
efb->current_index = eina_list_nth_list(efb->items, 0);
|
||||||
ephoto_flow_browser_image_set();
|
_flow_browser_image_set(efb);
|
||||||
}
|
}
|
||||||
|
|
||||||
edje_object_signal_emit(edje, "reset", "ephoto");
|
edje_object_signal_emit(edje, "reset", "ephoto");
|
||||||
|
@ -311,23 +154,20 @@ _ephoto_flow_done(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_flow_back(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
_flow_back(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
|
|
||||||
elm_toolbar_item_selected_set(efb->action.go_back, EINA_FALSE);
|
elm_toolbar_item_selected_set(efb->action.go_back, EINA_FALSE);
|
||||||
|
|
||||||
evas_object_key_ungrab(efb->box, "Escape", 0, 0);
|
elm_object_unfocus(efb->main_layout);
|
||||||
evas_object_key_ungrab(efb->box, "Left", 0, 0);
|
evas_object_smart_callback_call(efb->main_layout, "back", efb->entry);
|
||||||
evas_object_key_ungrab(efb->box, "Right", 0, 0);
|
|
||||||
evas_object_key_ungrab(efb->box, "BackSpace", 0, 0);
|
|
||||||
evas_object_key_ungrab(efb->box, "space", 0, 0);
|
|
||||||
|
|
||||||
elm_object_unfocus(efb->layout);
|
|
||||||
evas_object_smart_callback_call(efb->box, "back", efb->entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_flow_prev(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
_flow_prev(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Object *edje;
|
Evas_Object *edje;
|
||||||
|
|
||||||
elm_toolbar_item_selected_set(efb->action.go_prev, EINA_FALSE);
|
elm_toolbar_item_selected_set(efb->action.go_prev, EINA_FALSE);
|
||||||
|
@ -349,8 +189,9 @@ _ephoto_flow_prev(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_flow_next(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
_flow_next(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Object *edje;
|
Evas_Object *edje;
|
||||||
|
|
||||||
elm_toolbar_item_selected_set(efb->action.go_next, EINA_FALSE);
|
elm_toolbar_item_selected_set(efb->action.go_next, EINA_FALSE);
|
||||||
|
@ -372,8 +213,9 @@ _ephoto_flow_next(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_center_image_clicked(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_center_image_clicked(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Object *edje;
|
Evas_Object *edje;
|
||||||
|
|
||||||
edje = elm_layout_edje_get(efb->layout);
|
edje = elm_layout_edje_get(efb->layout);
|
||||||
|
@ -391,16 +233,19 @@ _ephoto_center_image_clicked(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Obj
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_show_slideshow(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
_show_slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
|
|
||||||
elm_toolbar_item_selected_set(efb->action.slideshow, EINA_FALSE);
|
elm_toolbar_item_selected_set(efb->action.slideshow, EINA_FALSE);
|
||||||
|
|
||||||
evas_object_smart_callback_call(efb->box, "slideshow", efb->entry);
|
evas_object_smart_callback_call(efb->main_layout, "slideshow", efb->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Event_Key_Down *ev = event_info;
|
Evas_Event_Key_Down *ev = event_info;
|
||||||
const char *k = ev->keyname;
|
const char *k = ev->keyname;
|
||||||
|
|
||||||
|
@ -409,16 +254,17 @@ _ephoto_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __U
|
||||||
efb->key_down = EINA_TRUE;
|
efb->key_down = EINA_TRUE;
|
||||||
|
|
||||||
if (!strcmp(k, "Escape"))
|
if (!strcmp(k, "Escape"))
|
||||||
_ephoto_flow_back(NULL, NULL, NULL);
|
_flow_back(efb, NULL, NULL);
|
||||||
if (!strcmp(k, "Left") || !strcmp(k, "BackSpace"))
|
if (!strcmp(k, "Left") || !strcmp(k, "BackSpace"))
|
||||||
_ephoto_flow_prev(NULL, NULL, NULL);
|
_flow_prev(efb, NULL, NULL);
|
||||||
if (!strcmp(k, "Right") || !strcmp(k, "space"))
|
if (!strcmp(k, "Right") || !strcmp(k, "space"))
|
||||||
_ephoto_flow_next(NULL, NULL, NULL);
|
_flow_next(efb, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_mouse_wheel(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
Evas_Event_Mouse_Wheel *ev = event_info;
|
Evas_Event_Mouse_Wheel *ev = event_info;
|
||||||
|
|
||||||
if (efb->mouse_wheel)
|
if (efb->mouse_wheel)
|
||||||
|
@ -426,7 +272,154 @@ _ephoto_mouse_wheel(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj
|
||||||
efb->mouse_wheel = EINA_TRUE;
|
efb->mouse_wheel = EINA_TRUE;
|
||||||
|
|
||||||
if (ev->z > 0)
|
if (ev->z > 0)
|
||||||
_ephoto_flow_next(NULL, NULL, NULL);
|
_flow_next(efb, NULL, NULL);
|
||||||
else
|
else
|
||||||
_ephoto_flow_prev(NULL, NULL, NULL);
|
_flow_prev(efb, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_layout_del(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = data;
|
||||||
|
|
||||||
|
if (efb->entry)
|
||||||
|
ephoto_entry_free_listener_del(efb->entry, _entry_free, efb);
|
||||||
|
|
||||||
|
free(efb);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Elm_Toolbar_Item *
|
||||||
|
_toolbar_item_add(Ephoto_Flow_Browser *efb, const char *icon, const char *label, int priority, Evas_Smart_Cb cb)
|
||||||
|
{
|
||||||
|
Elm_Toolbar_Item *item = elm_toolbar_item_append(efb->toolbar, icon, label,
|
||||||
|
cb, efb);
|
||||||
|
elm_toolbar_item_priority_set(item, priority);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *efb;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
efb = calloc(1, sizeof(Ephoto_Flow_Browser));
|
||||||
|
|
||||||
|
efb->efs = EPHOTO_FLOW_STATE_FLOW;
|
||||||
|
efb->swallows[0] = "offscreen_left";
|
||||||
|
efb->swallows[1] = "left";
|
||||||
|
efb->swallows[2] = "center";
|
||||||
|
efb->swallows[3] = "right";
|
||||||
|
efb->swallows[4] = "offscreen_right";
|
||||||
|
efb->key_down = EINA_FALSE;
|
||||||
|
efb->mouse_wheel = EINA_FALSE;
|
||||||
|
efb->ephoto = e;
|
||||||
|
|
||||||
|
efb->main_layout = elm_layout_add(parent);
|
||||||
|
efb->edje = elm_layout_edje_get(efb->main_layout);
|
||||||
|
evas_object_event_callback_add
|
||||||
|
(efb->main_layout, EVAS_CALLBACK_DEL, _layout_del, efb);
|
||||||
|
evas_object_event_callback_add
|
||||||
|
(efb->main_layout, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, efb);
|
||||||
|
evas_object_event_callback_add
|
||||||
|
(efb->main_layout, EVAS_CALLBACK_KEY_DOWN, _key_down, efb);
|
||||||
|
evas_object_data_set(efb->main_layout, "flow_browser", efb);
|
||||||
|
|
||||||
|
if (!elm_layout_theme_set
|
||||||
|
(efb->main_layout, "layout", "application", "toolbar-vbox"))
|
||||||
|
{
|
||||||
|
ERR("could not load style 'toolbar-vbox' from theme");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
efb->toolbar = edje_object_part_external_object_get
|
||||||
|
(efb->edje, "elm.external.toolbar");
|
||||||
|
elm_toolbar_homogenous_set(efb->toolbar, EINA_TRUE);
|
||||||
|
elm_toolbar_mode_shrink_set(efb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
|
||||||
|
elm_toolbar_menu_parent_set(efb->toolbar, parent);
|
||||||
|
|
||||||
|
efb->action.go_back = _toolbar_item_add
|
||||||
|
(efb, "edit-undo", "Back", 120, _flow_back);
|
||||||
|
efb->action.go_prev = _toolbar_item_add
|
||||||
|
(efb, "go-previous", "Previous", 100, _flow_prev);
|
||||||
|
efb->action.go_next = _toolbar_item_add
|
||||||
|
(efb, "go-next", "Next", 80, _flow_next);
|
||||||
|
efb->action.slideshow = _toolbar_item_add
|
||||||
|
(efb, "media-playback-start", "Slideshow", 70, _show_slideshow);
|
||||||
|
|
||||||
|
efb->layout = elm_layout_add(efb->main_layout);
|
||||||
|
elm_layout_file_set
|
||||||
|
(efb->layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow");
|
||||||
|
evas_object_size_hint_weight_set
|
||||||
|
(efb->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_fill_set
|
||||||
|
(efb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(efb->layout);
|
||||||
|
elm_layout_box_append
|
||||||
|
(efb->main_layout, "elm.box.content", efb->layout);
|
||||||
|
|
||||||
|
edje_object_signal_callback_add
|
||||||
|
(elm_layout_edje_get(efb->layout), "done", "ephoto", _flow_done, efb);
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
efb->img_edje[i] = _add_image_edje(efb->swallows[i], efb->layout);
|
||||||
|
efb->images[i] = _add_image(efb->img_edje[i], efb->layout);
|
||||||
|
if (i == 2)
|
||||||
|
evas_object_event_callback_add
|
||||||
|
(efb->img_edje[2], EVAS_CALLBACK_MOUSE_DOWN, _center_image_clicked, efb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return efb->main_layout;
|
||||||
|
|
||||||
|
error:
|
||||||
|
evas_object_del(efb->main_layout);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ephoto_flow_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *efb = evas_object_data_get(obj, "flow_browser");
|
||||||
|
Eina_Bool same_file = EINA_FALSE;
|
||||||
|
Eina_List *l;
|
||||||
|
Ephoto_Entry *itr;
|
||||||
|
|
||||||
|
elm_object_focus(efb->main_layout);
|
||||||
|
|
||||||
|
if (efb->entry)
|
||||||
|
{
|
||||||
|
ephoto_entry_free_listener_del(efb->entry, _entry_free, efb);
|
||||||
|
if (entry && entry->path == efb->entry->path)
|
||||||
|
same_file = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
efb->entry = entry;
|
||||||
|
|
||||||
|
if (entry)
|
||||||
|
ephoto_entry_free_listener_add(entry, _entry_free, efb);
|
||||||
|
if (!efb->entry || same_file)
|
||||||
|
{
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_TRUE);
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_TRUE);
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_FALSE);
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_FALSE);
|
||||||
|
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_FALSE);
|
||||||
|
}
|
||||||
|
eina_list_free(efb->items);
|
||||||
|
efb->items = NULL;
|
||||||
|
EINA_LIST_FOREACH(efb->ephoto->entries, l, itr)
|
||||||
|
{
|
||||||
|
efb->items = eina_list_append(efb->items, itr);
|
||||||
|
if (itr == entry) efb->current_index = eina_list_last(efb->items);
|
||||||
|
}
|
||||||
|
_flow_browser_image_set(efb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,9 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
case EPHOTO_STATE_THUMB:
|
case EPHOTO_STATE_THUMB:
|
||||||
_ephoto_thumb_browser_show(ephoto, entry);
|
_ephoto_thumb_browser_show(ephoto, entry);
|
||||||
break;
|
break;
|
||||||
|
case EPHOTO_STATE_FLOW:
|
||||||
|
_ephoto_flow_browser_show(ephoto, entry);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ERR("unhandled previous state %d", ephoto->prev_state);
|
ERR("unhandled previous state %d", ephoto->prev_state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* elm_photocam and elm_image rotates their images internally.
|
* elm_photocam and elm_image rotates their images internally.
|
||||||
* Rotating the scroller is not correct and was rejected by Raster and others.
|
* Rotating the scroller is not correct and was rejected by Raster and others.
|
||||||
*/
|
*/
|
||||||
//#define ROTATION
|
//#define ROTATION 1
|
||||||
|
|
||||||
#define ZOOM_STEP 0.2
|
#define ZOOM_STEP 0.2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue