Add the ability to show the selected image if view large is pressed and an image is selected and add the ability to double click an image to view it large. Also formatting.

SVN revision: 50051
This commit is contained in:
titan 2010-07-05 22:58:16 +00:00 committed by titan
parent e73f692de2
commit fa09a70bf8
4 changed files with 65 additions and 13 deletions

View File

@ -1,6 +1,7 @@
#include "ephoto.h" #include "ephoto.h"
int main(int argc, char **argv) int
main(int argc, char **argv)
{ {
ethumb_client_init(); ethumb_client_init();
elm_need_efreet(); elm_need_efreet();

View File

@ -12,7 +12,8 @@ static Eina_List *iter;
static Evas_Object *image, *toolbar; static Evas_Object *image, *toolbar;
/*Create the flow browser*/ /*Create the flow browser*/
void ephoto_create_flow_browser(void) void
ephoto_create_flow_browser(void)
{ {
Evas_Object *o; Evas_Object *o;
@ -61,7 +62,8 @@ void ephoto_create_flow_browser(void)
} }
/*Show the flow browser*/ /*Show the flow browser*/
void ephoto_show_flow_browser(const char *current_image) void
ephoto_show_flow_browser(const char *current_image)
{ {
iter = eina_list_data_find_list(em->images, current_image); iter = eina_list_data_find_list(em->images, current_image);
if (iter == NULL) if (iter == NULL)
@ -75,7 +77,8 @@ void ephoto_show_flow_browser(const char *current_image)
} }
/*Hide the flow browser*/ /*Hide the flow browser*/
void ephoto_hide_flow_browser(void) void
ephoto_hide_flow_browser(void)
{ {
evas_object_hide(image); evas_object_hide(image);
evas_object_hide(toolbar); evas_object_hide(toolbar);
@ -83,7 +86,8 @@ void ephoto_hide_flow_browser(void)
} }
/*Delete the flow browser*/ /*Delete the flow browser*/
void ephoto_delete_flow_browser(void) void
ephoto_delete_flow_browser(void)
{ {
Eina_List *items; Eina_List *items;
@ -100,7 +104,8 @@ void ephoto_delete_flow_browser(void)
} }
/*Go back to the thumbnail viewer*/ /*Go back to the thumbnail viewer*/
static void _ephoto_go_back(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
{ {
ephoto_hide_flow_browser(); ephoto_hide_flow_browser();
ephoto_show_thumb_browser(); ephoto_show_thumb_browser();
@ -109,7 +114,8 @@ static void _ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
} }
/*Go to the very first image in the list*/ /*Go to the very first image in the list*/
static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_go_first(void *data, Evas_Object *obj, void *event_info)
{ {
iter = eina_list_nth_list(em->images, 0); iter = eina_list_nth_list(em->images, 0);
@ -119,7 +125,8 @@ static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info)
} }
/*Go to the very last image in the list*/ /*Go to the very last image in the list*/
static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
{ {
iter = eina_list_last(em->images); iter = eina_list_last(em->images);
@ -129,7 +136,8 @@ static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
} }
/*Go to the next image in the list*/ /*Go to the next image in the list*/
static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
{ {
iter = iter->next; iter = iter->next;
if (!iter) if (!iter)
@ -141,7 +149,8 @@ static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
} }
/*Go to the previous image in the list*/ /*Go to the previous image in the list*/
static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_go_previous(void *data, Evas_Object *obj, void *event_info)
{ {
iter = iter->prev; iter = iter->prev;
if (!iter) if (!iter)

View File

@ -7,7 +7,8 @@ Ephoto *em;
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info); static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info);
/*Create the main ephoto window*/ /*Create the main ephoto window*/
void ephoto_create_main_window(void) void
ephoto_create_main_window(void)
{ {
em = calloc(1, sizeof(Ephoto)); em = calloc(1, sizeof(Ephoto));
em->thumbs_images = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del); em->thumbs_images = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del);
@ -42,7 +43,8 @@ void ephoto_create_main_window(void)
} }
/*Delete the main ephoto window*/ /*Delete the main ephoto window*/
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info) static void
_ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info)
{ {
ephoto_delete_thumb_browser(); ephoto_delete_thumb_browser();
ephoto_delete_flow_browser(); ephoto_delete_flow_browser();

View File

@ -11,6 +11,7 @@ static char *_ephoto_get_label(const void *data, Evas_Object *obj, const char *p
static Evas_Object *_ephoto_get_icon(const void *data, Evas_Object *obj, const char *part); static Evas_Object *_ephoto_get_icon(const void *data, Evas_Object *obj, const char *part);
static Eina_Bool _ephoto_get_state(const void *data, Evas_Object *obj, const char *part); static Eina_Bool _ephoto_get_state(const void *data, Evas_Object *obj, const char *part);
static void _ephoto_grid_del(const void *data, Evas_Object *obj); static void _ephoto_grid_del(const void *data, Evas_Object *obj);
static void _ephoto_thumb_clicked(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info); static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info);
/*Inline Variables*/ /*Inline Variables*/
@ -307,6 +308,8 @@ _ephoto_get_icon(const void *data, Evas_Object *obj, const char *part)
elm_layout_file_set(thumb, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", elm_layout_file_set(thumb, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
"/ephoto/thumb"); "/ephoto/thumb");
evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_event_callback_add(thumb, EVAS_CALLBACK_MOUSE_DOWN,
_ephoto_thumb_clicked, NULL);
evas_object_show(thumb); evas_object_show(thumb);
o = elm_bg_add(em->win); o = elm_bg_add(em->win);
@ -335,12 +338,49 @@ _ephoto_grid_del(const void *data, Evas_Object *obj)
return; return;
} }
/*Check to see if the thumbnail was double clicked*/
static void
_ephoto_thumb_clicked(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
char *file;
const Eina_List *selected;
Evas_Event_Mouse_Down *emd;
Evas_Object *o;
emd = event_info;
if (emd->flags == EVAS_BUTTON_DOUBLE_CLICK ||
emd->flags == EVAS_BUTTON_TRIPLE_CLICK)
{
selected = elm_gengrid_selected_items_get(em->thumb_browser);
o = eina_list_data_get(selected);
file = (char *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
ephoto_hide_thumb_browser();
ephoto_show_flow_browser(file);
}
}
/*Show the flow browser*/ /*Show the flow browser*/
static void static void
_ephoto_view_large(void *data, Evas_Object *obj, void *event_info) _ephoto_view_large(void *data, Evas_Object *obj, void *event_info)
{ {
const Eina_List *selected;
Evas_Object *o;
char *file;
ephoto_hide_thumb_browser(); ephoto_hide_thumb_browser();
ephoto_show_flow_browser(eina_list_data_get(em->images));
selected = elm_gengrid_selected_items_get(em->thumb_browser);
if (eina_list_data_get(selected))
{
o = eina_list_data_get(selected);
file = (char *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
ephoto_show_flow_browser(file);
}
else
{
ephoto_show_flow_browser(eina_list_data_get(em->images));
}
elm_toolbar_item_unselect_all(toolbar); elm_toolbar_item_unselect_all(toolbar);
} }