From: Otavio Pontes <otavio@profusion.mobi>
Date: Thu, 23 Sep 2010 16:39:58 -0300 Subject: [PATCH 4/5] Adding new keyboard shortcuts to ephoto. To: otavio@profusion.mobi Also adds: - zoom in/out function to flow_browser and buttons in toolbar for zoom and rotation. - Fullscreen mode to slideshow. SVN revision: 52899
This commit is contained in:
parent
4da0ca1b85
commit
ad063ce60e
|
@ -102,6 +102,7 @@ struct _Ephoto
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *flow_browser;
|
Evas_Object *flow_browser;
|
||||||
Evas_Object *slideshow;
|
Evas_Object *slideshow;
|
||||||
|
Evas_Object *slideshow_notify;
|
||||||
Evas_Object *thumb_browser;
|
Evas_Object *thumb_browser;
|
||||||
Evas_Object *prefs_win;
|
Evas_Object *prefs_win;
|
||||||
Eina_List *images;
|
Eina_List *images;
|
||||||
|
|
|
@ -16,8 +16,12 @@ static void _ephoto_go_rotate_counterclockwise(void *data, Evas_Object *obj, voi
|
||||||
static void _ephoto_go_rotate_clockwise(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_go_rotate_clockwise(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_go_editor(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_go_editor(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_flow_browser_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_flow_browser_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_in(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_out(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_regular_size(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
|
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
|
||||||
|
|
||||||
|
@ -38,7 +42,11 @@ static const char *toolbar_items[] = {
|
||||||
"Previous",
|
"Previous",
|
||||||
"Next",
|
"Next",
|
||||||
"Last",
|
"Last",
|
||||||
"Slideshow"
|
"Slideshow",
|
||||||
|
"Rotate CW",
|
||||||
|
"Rotate CCW",
|
||||||
|
"Zoom In",
|
||||||
|
"Zoom Out"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -171,6 +179,7 @@ ephoto_create_flow_browser(Evas_Object *parent)
|
||||||
ef->toolbar = elm_toolbar_add(ef->flow_browser);
|
ef->toolbar = elm_toolbar_add(ef->flow_browser);
|
||||||
elm_toolbar_icon_size_set(ef->toolbar, 24);
|
elm_toolbar_icon_size_set(ef->toolbar, 24);
|
||||||
elm_toolbar_homogenous_set(ef->toolbar, EINA_TRUE);
|
elm_toolbar_homogenous_set(ef->toolbar, EINA_TRUE);
|
||||||
|
elm_toolbar_scrollable_set(ef->toolbar, EINA_FALSE);
|
||||||
evas_object_size_hint_weight_set(ef->toolbar, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(ef->toolbar, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(ef->toolbar, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(ef->toolbar, EVAS_HINT_FILL, 0.5);
|
||||||
elm_layout_content_set(ef->flow_browser, "ephoto.toolbar.swallow", ef->toolbar);
|
elm_layout_content_set(ef->flow_browser, "ephoto.toolbar.swallow", ef->toolbar);
|
||||||
|
@ -200,7 +209,22 @@ ephoto_create_flow_browser(Evas_Object *parent)
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
elm_toolbar_item_add(ef->toolbar, o, "Slideshow", _ephoto_go_slideshow, ef);
|
elm_toolbar_item_add(ef->toolbar, o, "Slideshow", _ephoto_go_slideshow, ef);
|
||||||
|
|
||||||
|
o = elm_icon_add(ef->toolbar);
|
||||||
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
|
elm_toolbar_item_add(ef->toolbar, o, "RotateCW", _ephoto_go_rotate_clockwise, ef);
|
||||||
|
|
||||||
|
o = elm_icon_add(ef->toolbar);
|
||||||
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
|
elm_toolbar_item_add(ef->toolbar, o, "RotateCCW", _ephoto_go_rotate_counterclockwise, ef);
|
||||||
|
|
||||||
|
o = elm_icon_add(ef->toolbar);
|
||||||
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
|
elm_toolbar_item_add(ef->toolbar, o, "Zoom In", _ephoto_zoom_in, ef);
|
||||||
|
|
||||||
|
o = elm_icon_add(ef->toolbar);
|
||||||
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
|
elm_toolbar_item_add(ef->toolbar, o, "Zoom Out", _ephoto_zoom_out, ef);
|
||||||
|
|
||||||
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_SHOW,
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_SHOW,
|
||||||
_ephoto_flow_browser_show_cb, ef);
|
_ephoto_flow_browser_show_cb, ef);
|
||||||
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_DEL,
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_DEL,
|
||||||
|
@ -225,8 +249,10 @@ ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image)
|
||||||
{
|
{
|
||||||
ef->cur_image = current_image;
|
ef->cur_image = current_image;
|
||||||
|
|
||||||
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_KEY_UP,
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_KEY_DOWN,
|
||||||
_ephoto_key_pressed, ef);
|
_ephoto_key_pressed, ef);
|
||||||
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
|
_ephoto_mouse_wheel, ef);
|
||||||
|
|
||||||
ef->iter = eina_list_data_find_list(em->images, current_image);
|
ef->iter = eina_list_data_find_list(em->images, current_image);
|
||||||
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
||||||
|
@ -269,30 +295,50 @@ _ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_i
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *modifiers;
|
||||||
void (*func)(void *data, Evas_Object *obj, void *event_info);
|
void (*func)(void *data, Evas_Object *obj, void *event_info);
|
||||||
} keys[] = {
|
} keys[] = {
|
||||||
{ "Left", _ephoto_go_previous },
|
{ "Left", NULL, _ephoto_go_previous },
|
||||||
{ "Right", _ephoto_go_next },
|
{ "Right", NULL, _ephoto_go_next },
|
||||||
{ "space", _ephoto_go_next },
|
{ "space", NULL, _ephoto_go_next },
|
||||||
{ "Escape", _ephoto_go_back },
|
{ "Escape", NULL, _ephoto_go_back },
|
||||||
{ "bracketleft", _ephoto_go_rotate_counterclockwise },
|
{ "bracketleft", NULL, _ephoto_go_rotate_counterclockwise },
|
||||||
{ "bracketright", _ephoto_go_rotate_clockwise },
|
{ "bracketright", NULL, _ephoto_go_rotate_clockwise },
|
||||||
{ "e", _ephoto_go_editor },
|
{ "Home", NULL, _ephoto_go_first },
|
||||||
{ NULL, NULL }
|
{ "End", NULL, _ephoto_go_last },
|
||||||
|
{ "F5", NULL, _ephoto_go_slideshow},
|
||||||
|
{ "plus", "Control", _ephoto_zoom_in},
|
||||||
|
{ "minus", "Control", _ephoto_zoom_out},
|
||||||
|
{ "0", "Control", _ephoto_zoom_regular_size},
|
||||||
|
{ "e", NULL, _ephoto_go_editor },
|
||||||
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
{
|
{
|
||||||
Ephoto_Flow_Browser *ef = data;
|
Evas_Event_Key_Down *eku;
|
||||||
Evas_Event_Key_Up *eku;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
eku = (Evas_Event_Key_Up *)event_data;
|
eku = (Evas_Event_Key_Down *)event_data;
|
||||||
DBG("Key name: %s", eku->keyname);
|
DBG("Key name: %s", eku->key);
|
||||||
for (i = 0; keys[i].name; ++i)
|
for (i = 0; keys[i].name; ++i)
|
||||||
if (!strcmp(eku->keyname, keys[i].name))
|
if ((!strcmp(eku->key, keys[i].name)) &&
|
||||||
keys[i].func(ef, NULL, NULL);
|
((keys[i].modifiers == NULL) || (evas_key_modifier_is_set(eku->modifiers, keys[i].modifiers))))
|
||||||
|
keys[i].func(data, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
|
{
|
||||||
|
Evas_Event_Mouse_Wheel *emw = (Evas_Event_Mouse_Wheel *) event_data;
|
||||||
|
if (evas_key_modifier_is_set(emw->modifiers, "Control"))
|
||||||
|
{
|
||||||
|
if (emw->z < 0)
|
||||||
|
_ephoto_zoom_in(data, NULL, NULL);
|
||||||
|
else
|
||||||
|
_ephoto_zoom_out(data, NULL, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go back to the thumbnail viewer*/
|
/*Go back to the thumbnail viewer*/
|
||||||
|
@ -397,6 +443,7 @@ _ephoto_go_rotate_counterclockwise(void *data, Evas_Object *obj, void *event_inf
|
||||||
edje_object_signal_emit(o, "ef,state,rotate,180", "ef");
|
edje_object_signal_emit(o, "ef,state,rotate,180", "ef");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -424,6 +471,7 @@ _ephoto_go_rotate_clockwise(void *data, Evas_Object *obj, void *event_info)
|
||||||
edje_object_signal_emit(o, "ef,state,rotate,0", "ef");
|
edje_object_signal_emit(o, "ef,state,rotate,0", "ef");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -438,3 +486,41 @@ _ephoto_go_editor(void *data, Evas_Object *obj, void *event_info)
|
||||||
exe = ecore_exe_run(buf, NULL);
|
exe = ecore_exe_run(buf, NULL);
|
||||||
ecore_exe_free(exe);
|
ecore_exe_free(exe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Zoom in in image */
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_in(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
double zoom;
|
||||||
|
|
||||||
|
elm_photocam_zoom_mode_set(ef->image, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
|
||||||
|
zoom = elm_photocam_zoom_get(ef->image);
|
||||||
|
zoom -= 0.4;
|
||||||
|
if (zoom < 0.1)
|
||||||
|
zoom = 0.1;
|
||||||
|
elm_photocam_zoom_set(ef->image, zoom);
|
||||||
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zoom out in image */
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_out(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
double zoom;
|
||||||
|
|
||||||
|
elm_photocam_zoom_mode_set(ef->image, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
|
||||||
|
zoom = elm_photocam_zoom_get(ef->image);
|
||||||
|
zoom += 0.4;
|
||||||
|
elm_photocam_zoom_set(ef->image, zoom);
|
||||||
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zoom regular size in image */
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_regular_size(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
elm_photocam_zoom_mode_set(ef->image, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,15 @@ static void _ephoto_preferences_hide(void *data, Evas_Object *obj, void *event_i
|
||||||
static void _ephoto_preferences_item_change(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_preferences_item_change(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_preferences_slideshow_transition(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_preferences_slideshow_transition(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
|
{
|
||||||
|
Evas_Event_Key_Down *eku;
|
||||||
|
eku = (Evas_Event_Key_Down *)event_data;
|
||||||
|
if (!strcmp(eku->key, "Escape"))
|
||||||
|
_ephoto_preferences_hide(data, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ephoto_show_preferences(Ephoto *em)
|
ephoto_show_preferences(Ephoto *em)
|
||||||
{
|
{
|
||||||
|
@ -126,11 +135,16 @@ ephoto_show_preferences(Ephoto *em)
|
||||||
elm_box_pack_end(box, o);
|
elm_box_pack_end(box, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
|
||||||
|
evas_object_event_callback_add(em->prefs_win, EVAS_CALLBACK_KEY_DOWN,
|
||||||
|
_ephoto_key_pressed, em);
|
||||||
|
|
||||||
elm_toolbar_item_select_first(tb);
|
elm_toolbar_item_select_first(tb);
|
||||||
elm_pager_content_promote(pager, pg1);
|
elm_pager_content_promote(pager, pg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
elm_win_inwin_activate(em->prefs_win);
|
elm_win_inwin_activate(em->prefs_win);
|
||||||
|
evas_object_focus_set(em->prefs_win, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -178,4 +192,5 @@ _ephoto_preferences_hide(void *data, Evas_Object *obj, void *event_info)
|
||||||
Ephoto *em = data;
|
Ephoto *em = data;
|
||||||
|
|
||||||
evas_object_hide(em->prefs_win);
|
evas_object_hide(em->prefs_win);
|
||||||
|
evas_object_focus_set(em->thumb_browser, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,29 @@
|
||||||
|
|
||||||
static Evas_Object *_ephoto_get_image(void *data, Evas_Object *obj);
|
static Evas_Object *_ephoto_get_image(void *data, Evas_Object *obj);
|
||||||
static void _ephoto_end_slideshow(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_end_slideshow(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_switch_fullscreen();
|
||||||
|
|
||||||
static Elm_Slideshow_Item_Class itc;
|
static Elm_Slideshow_Item_Class itc;
|
||||||
static int return_view;
|
static int return_view;
|
||||||
static const char *cur_image;
|
static const char *cur_image;
|
||||||
|
|
||||||
|
/*Key is pressed*/
|
||||||
|
static void
|
||||||
|
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
|
{
|
||||||
|
Evas_Event_Key_Down *eku = (Evas_Event_Key_Down *)event_data;
|
||||||
|
if ((!strcmp(eku->key, "F5")) || (!strcmp(eku->key, "Escape")))
|
||||||
|
ephoto_hide_slideshow();
|
||||||
|
if ((!strcmp(eku->key, "F11")))
|
||||||
|
_ephoto_switch_fullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_switch_fullscreen(void)
|
||||||
|
{
|
||||||
|
elm_win_fullscreen_set(em->win, !elm_win_fullscreen_get(em->win));
|
||||||
|
}
|
||||||
|
|
||||||
/*Create the slideshow*/
|
/*Create the slideshow*/
|
||||||
void
|
void
|
||||||
ephoto_create_slideshow(void)
|
ephoto_create_slideshow(void)
|
||||||
|
@ -18,6 +36,14 @@ ephoto_create_slideshow(void)
|
||||||
evas_object_size_hint_align_set(em->slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(em->slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_ephoto_end_slideshow, NULL);
|
_ephoto_end_slideshow, NULL);
|
||||||
|
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_KEY_DOWN,
|
||||||
|
_ephoto_key_pressed, NULL);
|
||||||
|
em->slideshow_notify = elm_notify_add(em->win);
|
||||||
|
Evas_Object *label = elm_label_add(em->win);
|
||||||
|
elm_label_label_set(label, "Press F11 to turn off fullscreen");
|
||||||
|
elm_notify_content_set(em->slideshow_notify, label);
|
||||||
|
elm_notify_orient_set(em->slideshow_notify, ELM_NOTIFY_ORIENT_TOP);
|
||||||
|
elm_notify_timeout_set(em->slideshow_notify, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Start and show the slideshow*/
|
/*Start and show the slideshow*/
|
||||||
|
@ -25,11 +51,13 @@ void
|
||||||
ephoto_show_slideshow(int view, const char *current_image)
|
ephoto_show_slideshow(int view, const char *current_image)
|
||||||
{
|
{
|
||||||
Eina_List *l = NULL, *iter = NULL;
|
Eina_List *l = NULL, *iter = NULL;
|
||||||
|
Elm_Slideshow_Item *cur_item = NULL, *item;
|
||||||
const char *image;
|
const char *image;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
|
||||||
elm_slideshow_transition_set(em->slideshow, em->config->slideshow_transition);
|
elm_slideshow_transition_set(em->slideshow, em->config->slideshow_transition);
|
||||||
elm_slideshow_timeout_set(em->slideshow, em->config->slideshow_timeout);
|
elm_slideshow_timeout_set(em->slideshow, em->config->slideshow_timeout);
|
||||||
|
elm_win_fullscreen_set(em->win, EINA_TRUE);
|
||||||
|
|
||||||
return_view = view;
|
return_view = view;
|
||||||
cur_image = current_image;
|
cur_image = current_image;
|
||||||
|
@ -41,20 +69,36 @@ ephoto_show_slideshow(int view, const char *current_image)
|
||||||
itc.func.get = _ephoto_get_image;
|
itc.func.get = _ephoto_get_image;
|
||||||
itc.func.del = NULL;
|
itc.func.del = NULL;
|
||||||
|
|
||||||
|
elm_slideshow_clear(em->slideshow);
|
||||||
l = em->images;
|
l = em->images;
|
||||||
EINA_LIST_FOREACH(l, iter, image)
|
EINA_LIST_FOREACH(l, iter, image)
|
||||||
{
|
{
|
||||||
elm_slideshow_item_add(em->slideshow, &itc, image);
|
item = elm_slideshow_item_add(em->slideshow, &itc, image);
|
||||||
|
if ((current_image) && (!strcmp(image, current_image)))
|
||||||
|
cur_item = item;
|
||||||
}
|
}
|
||||||
|
if (cur_item)
|
||||||
|
elm_slideshow_show(cur_item);
|
||||||
|
|
||||||
evas_object_show(em->slideshow);
|
evas_object_show(em->slideshow);
|
||||||
|
evas_object_focus_set(em->slideshow, EINA_TRUE);
|
||||||
elm_win_resize_object_add(em->win, em->slideshow);
|
elm_win_resize_object_add(em->win, em->slideshow);
|
||||||
|
|
||||||
|
evas_object_show(em->slideshow_notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Hide the slideshow object*/
|
/*Hide the slideshow object*/
|
||||||
void
|
void
|
||||||
ephoto_hide_slideshow(void)
|
ephoto_hide_slideshow(void)
|
||||||
{
|
{
|
||||||
|
elm_win_fullscreen_set(em->win, EINA_FALSE);
|
||||||
evas_object_hide(em->slideshow);
|
evas_object_hide(em->slideshow);
|
||||||
|
elm_slideshow_clear(em->slideshow);
|
||||||
|
if (return_view == 0)
|
||||||
|
evas_object_focus_set(em->thumb_browser, 1);
|
||||||
|
else if (return_view == 1)
|
||||||
|
evas_object_focus_set(em->flow_browser, 1);
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
/*
|
/*
|
||||||
if (return_view == 0)
|
if (return_view == 0)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
|
#define SLIDER_MAX 300
|
||||||
|
#define SLIDER_MIN 80
|
||||||
typedef struct _Ephoto_Thumb_Data Ephoto_Thumb_Data;
|
typedef struct _Ephoto_Thumb_Data Ephoto_Thumb_Data;
|
||||||
typedef struct _Ephoto_Thumb_Browser Ephoto_Thumb_Browser;
|
typedef struct _Ephoto_Thumb_Browser Ephoto_Thumb_Browser;
|
||||||
|
|
||||||
|
@ -44,6 +46,53 @@ static void _ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_inf
|
||||||
static void _ephoto_preferences(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_preferences(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_in(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_out(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_zoom_regular_size(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
|
/*A key has been pressed*/
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const char *modifiers;
|
||||||
|
void (*func)(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
} keys[] = {
|
||||||
|
{ "F5", NULL, _ephoto_view_slideshow },
|
||||||
|
{ "d", "Control", _ephoto_change_directory},
|
||||||
|
{ "p", "Control", _ephoto_preferences},
|
||||||
|
{ "plus", "Control", _ephoto_zoom_in},
|
||||||
|
{ "minus", "Control", _ephoto_zoom_out},
|
||||||
|
{ "0", "Control", _ephoto_zoom_regular_size},
|
||||||
|
{ NULL, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
|
{
|
||||||
|
Evas_Event_Key_Down *eku;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
eku = (Evas_Event_Key_Down *)event_data;
|
||||||
|
DBG("Key name: %s", eku->key);
|
||||||
|
for (i = 0; keys[i].name; ++i)
|
||||||
|
if ((!strcmp(eku->key, keys[i].name)) &&
|
||||||
|
((keys[i].modifiers == NULL) || (evas_key_modifier_is_set(eku->modifiers, keys[i].modifiers))))
|
||||||
|
keys[i].func(data, obj, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
|
{
|
||||||
|
Evas_Event_Mouse_Wheel *emw = (Evas_Event_Mouse_Wheel *) event_data;
|
||||||
|
if (evas_key_modifier_is_set(emw->modifiers, "Control"))
|
||||||
|
{
|
||||||
|
if (emw->z < 0)
|
||||||
|
_ephoto_zoom_in(data, NULL, NULL);
|
||||||
|
else
|
||||||
|
_ephoto_zoom_out(data, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*Create the thumbnail browser object*/
|
/*Create the thumbnail browser object*/
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
ephoto_create_thumb_browser(Evas_Object *parent)
|
ephoto_create_thumb_browser(Evas_Object *parent)
|
||||||
|
@ -81,7 +130,7 @@ ephoto_create_thumb_browser(Evas_Object *parent)
|
||||||
tb->thumb_slider = elm_slider_add(tb->thbox);
|
tb->thumb_slider = elm_slider_add(tb->thbox);
|
||||||
elm_slider_label_set(tb->thumb_slider, "Thumb Size:");
|
elm_slider_label_set(tb->thumb_slider, "Thumb Size:");
|
||||||
elm_slider_span_size_set(tb->thumb_slider, 100);
|
elm_slider_span_size_set(tb->thumb_slider, 100);
|
||||||
elm_slider_min_max_set(tb->thumb_slider, 80, 300);
|
elm_slider_min_max_set(tb->thumb_slider, SLIDER_MIN, SLIDER_MAX);
|
||||||
elm_slider_value_set(tb->thumb_slider, em->config->thumb_size);
|
elm_slider_value_set(tb->thumb_slider, em->config->thumb_size);
|
||||||
elm_box_pack_end(tb->thbox, tb->thumb_slider);
|
elm_box_pack_end(tb->thbox, tb->thumb_slider);
|
||||||
evas_object_smart_callback_add(tb->thumb_slider, "changed",
|
evas_object_smart_callback_add(tb->thumb_slider, "changed",
|
||||||
|
@ -141,6 +190,11 @@ ephoto_create_thumb_browser(Evas_Object *parent)
|
||||||
evas_object_data_set(tb->layout, "thumb_browser", tb);
|
evas_object_data_set(tb->layout, "thumb_browser", tb);
|
||||||
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_DEL, _ephoto_del_cb, tb);
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_DEL, _ephoto_del_cb, tb);
|
||||||
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_SHOW, _ephoto_show_cb, tb);
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_SHOW, _ephoto_show_cb, tb);
|
||||||
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_KEY_DOWN,
|
||||||
|
_ephoto_key_pressed, tb);
|
||||||
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
|
_ephoto_mouse_wheel, tb);
|
||||||
|
evas_object_focus_set(tb->layout, 1);
|
||||||
return tb->layout;
|
return tb->layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +296,48 @@ ephoto_populate_thumbnails(Evas_Object *obj)
|
||||||
tb);
|
tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Zoom out the thumbnail size*/
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_out(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
|
val = elm_slider_value_get(tb->thumb_slider);
|
||||||
|
val -= (SLIDER_MAX + SLIDER_MIN) / 10;
|
||||||
|
if (val > SLIDER_MAX)
|
||||||
|
val = SLIDER_MAX;
|
||||||
|
elm_slider_value_set(tb->thumb_slider, val);
|
||||||
|
_ephoto_slider_changed(data, obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Zoom in the thumbnail size*/
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_in(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
|
val = elm_slider_value_get(tb->thumb_slider);
|
||||||
|
val += (SLIDER_MAX + SLIDER_MIN) / 10;
|
||||||
|
if (val > SLIDER_MAX)
|
||||||
|
val = SLIDER_MAX;
|
||||||
|
elm_slider_value_set(tb->thumb_slider, val);
|
||||||
|
_ephoto_slider_changed(data, obj, event);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Zoom half the thumbnail size*/
|
||||||
|
static void
|
||||||
|
_ephoto_zoom_regular_size(void *data, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
|
val = (SLIDER_MAX + SLIDER_MIN) / 2;
|
||||||
|
elm_slider_value_set(tb->thumb_slider, val);
|
||||||
|
_ephoto_slider_changed(data, obj, event);
|
||||||
|
}
|
||||||
/*Change the thumbnail size*/
|
/*Change the thumbnail size*/
|
||||||
static void
|
static void
|
||||||
_ephoto_slider_changed(void *data, Evas_Object *obj, void *event)
|
_ephoto_slider_changed(void *data, Evas_Object *obj, void *event)
|
||||||
|
|
Loading…
Reference in New Issue