From: Enlightenment S. <no-...@en...> - 2010-06-27 14:50:28
|
Log: Add a little slideshow in the image panel. Author: watchwolf Date: 2010-06-27 07:50:21 -0700 (Sun, 27 Jun 2010) New Revision: 49904 Added: trunk/enki/data/images/slideshow.png trunk/enki/data/images/slideshow_select.png trunk/enki/src/bin/evas_object/slideshow_object.c trunk/enki/src/bin/evas_object/slideshow_object.h Modified: trunk/enki/data/theme.edc trunk/enki/src/bin/Makefile.am trunk/enki/src/bin/main.c trunk/enki/src/bin/main.h trunk/enki/src/bin/panel_image.c Property changes on: trunk/enki/data/images/slideshow.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/enki/data/images/slideshow_select.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/enki/data/theme.edc =================================================================== --- trunk/enki/data/theme.edc 2010-06-27 14:06:10 UTC (rev 49903) +++ trunk/enki/data/theme.edc 2010-06-27 14:50:21 UTC (rev 49904) @@ -59,10 +59,206 @@ image: "images/flickr/logo_8.png" COMP; image: "images/flickr/logo_9.png" COMP; image: "images/flickr/logo_10.png" COMP; + + image: "images/slideshow.png" COMP; + image: "images/slideshow_select.png" COMP; } collections { group { + name: "photo_simple"; + data { + item: left_marge 5; + item: right_marge 5; + item: top_marge 5; + item: bottom_marge 5; + } + /*lua_script { + function message(ed, typ, id, ...) + local custom + print 'custom' + custom = ed.shadow:custom_state ("default", 0.0) + custom.rel1 = {0.3, 0.3} + custom.rel2 = {0.6, 0.6} + ed.shadow.state = {'custom', 0.0} + end + }*/ +script { + public message(Msg_Type:type, id, ...) { + if( (type==MSG_INT_SET) && (id==0) ) + { + new off1_x; + new off1_y; + new off2_x; + new off2_y; + + custom_state(PART:"shadow", "default", 0.0); + + off1_x = getarg(2); + off1_y = getarg(3); + off2_x = getarg(4); + off2_y = getarg(5); + set_state_val(PART:"shadow", STATE_REL1_OFFSET, off1_x + 5, off1_y + 5); + set_state_val(PART:"shadow", STATE_REL2_OFFSET, off2_x - 5, off2_y - 5); + set_state(PART:"shadow", "custom", 0.0); + } + } +} +parts { + part { + name: "object.whole"; + type: RECT; + ignore_flags: ON_HOLD; + description { + state: "default" 0.0; + visible: 1; + color: 255 255 255 0; + } + description { + state: "select" 0.0; + inherit: "default" 0.0; + color: 0 0 200 100; + } + description { + state: "unselect" 0.0; + inherit: "default" 0.0; + } + } + part { + name: "shadow"; + type: IMAGE; + repeat_events: 1; + description { + state: "default" 0.0; + visible: 1; + image.normal: "images/shadow.png"; + } + } + part { + name: "border"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + visible: 1; + color: 0 0 0 255; + rel1.to: "shadow"; + rel2.to: "shadow"; + rel1.relative: 0.01 0.01; + rel2.relative: 0.99 0.99; + } + } + part { + name: "photo_clipped"; + type: RECT; + repeat_events: 1; + description { + state: "default" 0.0; + visible: 1; + color: 255 255 255 0; + rel1.to: "border"; + rel2.to: "border"; + rel1.offset: 1 1; + rel2.offset: -2 -2; + } + description { + state: "visible" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { + name: "object.photo.swallow"; + type: SWALLOW; + repeat_events: 1; + clip_to: "photo_clipped"; + description { + state: "default" 0.0; + rel1.to: "photo_clipped"; + rel2.to: "photo_clipped"; + } + } + part { + name: "camera"; + type: IMAGE; + description { + state: "default" 0.0; + visible: 0; + color: 255 255 255 255; + aspect: 1 1; + aspect_preference: BOTH; + rel1.relative: 0.0 0.7; + rel2.relative: 0.0 0.9; + image.scale_hint: DYNAMIC; + image.normal: "images/camera-video.png"; + } + description { + state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + rel1.relative: 0.0 0.7; + rel2.offset: -2 10; + rel2.relative: 0.2 0.9; + } + } + part { + name: "loading_clip"; + type: RECT; + description { + state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + } + description { + state: "loading" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { + name: "object.loading.swallow"; + type: SWALLOW; + clip_to: "loading_clip"; + description + { + state: "default" 0.0; + } + } +} +programs { + program { + name: "show"; + signal: "show"; + action: STATE_SET "visible" 0.0; + target: "photo_clipped"; + transition: LINEAR 0.5; + } + program { + name: "show_camera"; + signal: "show,camera"; + source: "photo"; + action: STATE_SET "visible" 0.0; + target: "camera"; + } + program { + name: "hide_camera"; + signal: "hide,camera"; + source: "photo"; + action: STATE_SET "default" 0.0; + target: "camera"; + } + program { + name: "loading"; + signal: "loading"; + source: "photo"; + action: STATE_SET "loading" 0.0; + target: "loading_clip"; + transition: SINUSOIDAL 0.5; + } +} +} + group { name: "photo"; data { item: left_marge 5; @@ -895,10 +1091,10 @@ align: 1.0 0.0; fixed: 1 1; rel1.to: "background"; - rel1.relative: 0.92 0.0; + rel1.relative: 0.92 0.1; rel1.offset: 0.0 10; rel2.to_x: "background"; - rel2.relative: 1.0 1.0; + rel2.relative: 1.0 0.8; rel2.offset: -10 0; } } @@ -2030,5 +2226,223 @@ } } +group { + name: "slideshow"; + min: 350 50; + max: 350 50; + + parts{ + part { + name: "whole"; + type: RECT; + description { + state: "default" 0.0; + } + } + + part { + name: "rect"; + type: RECT; + clip_to: "whole"; + description { + state: "default" 0.0; + rel1.to: "whole"; + rel1.relative: 0.1 0.0; + rel2.to: "whole"; + rel2.relative: 0.9 1.0; + visible: 0; + } + } + part { + name: "bg"; + type: IMAGE; + clip_to: "whole"; + description { + state: "default" 0.0; + visible: 1; + rel1.to: "whole"; + rel2.to: "whole"; + image.normal: "images/slideshow.png"; + image.border: 10 10 9 9; + } + } + + #define slideshow_swallow_add(id, rel1_x, rel1_y, rel2_x, rel2_y, off1_y, off2_y, \ + rel1_x_l, rel1_y_l, rel2_x_l, rel2_y_l,\ + rel1_x_r, rel1_y_r, rel2_x_r, rel2_y_r,\ + alpha, alpha_l, alpha_r) \ + part { \ + name: "rect."id; \ + type: RECT; \ + clip_to: "whole"; \ + description { \ + state: "default" 0.0; \ + rel1.to_y: "rect"; \ + rel1.relative: rel1_x rel1_y; \ + rel1.offset: 0 off1_y; \ + rel2.relative: rel2_x rel2_y;\ + rel2.offset: 0 off2_y; \ + rel2.to_y: "rect"; \ + aspect: 1 1; \ + aspect_preference: BOTH; \ + color: 255 255 255 alpha; \ + } \ + description { \ + state: "right" 0.0; \ + inherit: "default" 0.0; \ + rel1.relative: rel1_x_l rel1_y_l; \ + rel2.relative: rel2_x_l rel2_y_l;\ + color: 255 255 255 alpha_l; \ + } \ + description { \ + state: "left" 0.0; \ + inherit: "default" 0.0; \ + rel1.relative: rel1_x_r rel1_y_r; \ + rel2.relative: rel2_x_r rel2_y_r;\ + color: 255 255 255 alpha_r; \ + } \ + } \ + part { \ + name: "object.swallow."id; \ + type: SWALLOW; \ + clip_to: "rect."id; \ + description { \ + state: "default" 0.0; \ + rel1.to: "rect."id; \ + rel2.to: "rect."id; \ + } \ + } + + part + { + name: "select"; + type: IMAGE; + clip_to: "whole"; + description { + state: "default" 0.0; + rel1.to_y: "rect"; + rel1.relative: 0.14285*3 0.0; + rel1.offset: 0 5; + rel2.to_y: "rect"; + rel2.relative: 0.14285*4 1.0; + rel2.offset: 0 -5; + image.normal: "images/slideshow_select.png"; + image.border: 2 2 2 2; + } + } + + slideshow_swallow_add(1, 0.0, 0.0, 0.14285, 1.0, 0, 0, \ + -0.14285, 0.0, 0.0, 1.0, \ + 0.14285, 0.0, 0.14285*2, 1.0, \ + 0, 0, 255); + slideshow_swallow_add(2, 0.14285, 0.0, 0.14285*2, 1.0, 0, 0, \ + 0.0, 0.0, 0.14285, 1.0, \ + 0.14285*2, 0.0, 0.14285*3, 1.0, \ + 255, 0, 255); + slideshow_swallow_add(3, 0.14285*2, 0.0, 0.14285*3, 1.0, 0, 0, \ + 0.14285, 0.0, 0.14285*2, 1.0, \ + 0.14285*3, 0.0, 0.14285*4, 1.0, \ + 255, 255, 255); + slideshow_swallow_add(4, 0.14285*3, 0.0, 0.14285*4, 1.0, 0, 0, \ + 0.14285*2, 0.0, 0.14285*3, 1.0, \ + 0.14285*4, 0.0, 0.14285*5, 1.0, \ + 255, 255, 255); + slideshow_swallow_add(5, 0.14285*4, 0.0, 0.14285*5, 1.0, 0, 0, \ + 0.14285*3, 0.0, 0.14285*4, 1.0, \ + 0.14285*5, 0.0, 0.14285*6, 1.0, \ + 255, 255, 255); + slideshow_swallow_add(6, 0.14285*5, 0.0, 0.14285*6, 1.0, 0, 0, \ + 0.14285*4, 0.0, 0.14285*5, 1.0, \ + 0.14285*6, 0.0, 0.14285*7, 1.0, \ + 255, 255, 0); \ + slideshow_swallow_add(7, 0.14285*6, 0.0, 0.14285*7, 1.0, 0, 0, \ + 0.14285*5, 0.0, 0.14285*6, 1.0, \ + 0.14285*7, 0.0, 0.14285*8, 1.0, \ + 0, 255, 0); + + part { + name: "object.swallow.left"; + type: SWALLOW; + clip_to: "whole"; + description { + state: "default" 0.0; + rel1.to_y: "rect"; + rel1.offset: 5 5; + rel2.relative: 0.14285/1.5 1.0; + rel2.offset: 0 -5; + rel2.to_y: "rect"; + fixed: 1 1; + } + } + part { + name: "object.swallow.right"; + type: SWALLOW; + clip_to: "whole"; + description { + state: "default" 0.0; + rel1.to_y: "rect"; + rel1.relative: 1-0.14285/1.5 0.0; + rel1.offset: 0 5; + rel2.relative: 1.0 1.0; + rel2.offset: -5 -5; + rel2.to_y: "rect"; + fixed: 1 1; + } + } + + } + + programs { + program { + name: "init"; + signal: "init"; + action: STATE_SET "default" 0.0; + target: "rect.1"; + target: "rect.2"; + target: "rect.3"; + target: "rect.4"; + target: "rect.5"; + target: "rect.6"; + target: "rect.7"; + } + program { + name: "right"; + signal: "right"; + action: STATE_SET "right" 0.0; + target: "rect.1"; + target: "rect.2"; + target: "rect.3"; + target: "rect.4"; + target: "rect.5"; + target: "rect.6"; + target: "rect.7"; + transition: SINUSOIDAL 0.3; + after: "right2"; + } + program { + name: "right2"; + action: SIGNAL_EMIT "right,done" ""; + } + program { + name: "left"; + signal: "left"; + action: STATE_SET "left" 0.0; + target: "rect.1"; + target: "rect.2"; + target: "rect.3"; + target: "rect.4"; + target: "rect.5"; + target: "rect.6"; + target: "rect.7"; + transition: SINUSOIDAL 0.3; + after: "left2"; + } + program { + name: "left2"; + action: SIGNAL_EMIT "left,done" ""; + } + } } +} + Modified: trunk/enki/src/bin/Makefile.am =================================================================== --- trunk/enki/src/bin/Makefile.am 2010-06-27 14:06:10 UTC (rev 49903) +++ trunk/enki/src/bin/Makefile.am 2010-06-27 14:50:21 UTC (rev 49904) @@ -17,9 +17,6 @@ slideshow.c \ panel_image.c \ panel_geocaching.c \ - evas_object/photo_object.c \ - evas_object/photos_list_object.c \ - evas_object/tabpanel.c \ menu.c \ import.c \ album_menu.c \ @@ -31,6 +28,10 @@ flickr_sync.c \ download.c \ upload.c \ - main_menu.c + main_menu.c \ + evas_object/photos_list_object.c \ + evas_object/photo_object.c \ + evas_object/slideshow_object.c \ + evas_object/tabpanel.c enki_LDADD = @ENKI_LIBS@ Property changes on: trunk/enki/src/bin/evas_object/slideshow_object.c ___________________________________________________________________ Added: svn:mime-type + text/plain Property changes on: trunk/enki/src/bin/evas_object/slideshow_object.h ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/enki/src/bin/main.c =================================================================== --- trunk/enki/src/bin/main.c 2010-06-27 14:06:10 UTC (rev 49903) +++ trunk/enki/src/bin/main.c 2010-06-27 14:50:21 UTC (rev 49904) @@ -1,6 +1,7 @@ // vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 #include "main.h" +#include "evas_object/slideshow_object.h" int APP_LOG_DOMAIN; @@ -498,6 +499,7 @@ void enlil_photo_data_free(Enlil_Photo *photo, void *_data) { Enlil_Photo_Data *data = _data; + Slideshow_Item *item; //Enlil_Data *enlil_data = data->enlil_data; Enlil_Flickr_Job *job; @@ -514,6 +516,11 @@ if(data->iptc_job) enlil_iptc_job_del(data->iptc_job); + EINA_LIST_FREE(data->slideshow_object_items, item) + { + slideshow_object_item_del(item); + } + EINA_LIST_FREE(data->flickr_sync.jobs, job) { enlil_flickr_job_del(job); Modified: trunk/enki/src/bin/main.h =================================================================== --- trunk/enki/src/bin/main.h 2010-06-27 14:06:10 UTC (rev 49903) +++ trunk/enki/src/bin/main.h 2010-06-27 14:50:21 UTC (rev 49904) @@ -159,6 +159,7 @@ Enlil_Data *enlil_data; PL_Child_Item *list_photo_item; Elm_Slideshow_Item *slideshow_item; + Eina_List *slideshow_object_items; //list of Slideshow_Item* Panel_Image *panel_image; Enlil_Exif_Job *exif_job; @@ -287,8 +288,14 @@ Evas_Object *menu; Evas_Object *tb; + struct + { + Evas_Object *slideshow; + } slideshow; + Evas_Object *entry_name; Evas_Object *entry_description; + Evas_Object *lbl_file_size; Eina_Bool save_description_name; Ecore_Timer *timer_description_name; struct Modified: trunk/enki/src/bin/panel_image.c =================================================================== --- trunk/enki/src/bin/panel_image.c 2010-06-27 14:06:10 UTC (rev 49903) +++ trunk/enki/src/bin/panel_image.c 2010-06-27 14:50:21 UTC (rev 49904) @@ -1,13 +1,21 @@ // vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 #include "main.h" +#include "evas_object/slideshow_object.h" static Elm_Genlist_Item_Class itc_exifs; static char *_gl_exifs_label_get(const void *data, Evas_Object *obj, const char *part); static Elm_Genlist_Item_Class itc_iptcs; static char *_gl_iptcs_label_get(const void *data, Evas_Object *obj, const char *part); +static void _slideshow_selected_cb(void *data, Evas_Object *obj, void *event_info); +static Slideshow_Item_Class itc_slideshow; +static Evas_Object *_slideshow_icon_get(const void *data, Evas_Object *obj); + + +static void _panel_image_photo_set(Panel_Image *panel_image, Enlil_Photo *photo); + static void _entry_name_changed_cb(void *data, Evas_Object *obj, void *event_info); static void _entry_description_changed_cb(void *data, Evas_Object *obj, void *event_info); @@ -61,11 +69,12 @@ Panel_Image *panel_image_new(Evas_Object *obj, Enlil_Photo *photo) { - char buf[PATH_MAX]; - Evas_Object *ph, *vbox, *vbox2, *bx, *bx2, *tb, *bt, *rect, *sl, *pb, *icon, *gl, - *fr, *entry, *sc, *lbl, *tabs, *panels, *panes, *panes_h; + Evas_Object *ph, *vbox, *vbox2, *bx, *bx2, *tb, *bt, *rect, *sl, *pb, *icon, *gl, + *fr, *entry, *sc, *lbl, *tabs, *panels, *panes, *panes_h, *hbox; Elm_Toolbar_Item *tb_item; Tabpanel_Item *tp_item; + Eina_List *l; + Enlil_Photo *_photo; Panel_Image *panel_image = calloc(1, sizeof(Panel_Image)); Enlil_Photo_Data *photo_data = enlil_photo_user_data_get(photo); @@ -80,7 +89,7 @@ evas_object_smart_callback_add(panes, "clicked,double", _panes_clicked_double, panel_image); evas_object_show(panes); - // left panel + // left panel panes_h = elm_panes_add(obj); panel_image->panes_h = panes_h; elm_panes_horizontal_set(panes_h, EINA_TRUE); @@ -110,7 +119,7 @@ elm_button_label_set(bt, D_("Save")); evas_object_size_hint_weight_set(bt, 1.0, 0.0); evas_object_size_hint_align_set(bt, -1.0, 0.0); - evas_object_smart_callback_add(bt, "clicked", _bt_save_cb, photo); + evas_object_smart_callback_add(bt, "clicked", _bt_save_cb, panel_image); evas_object_show(bt); elm_box_pack_end(vbox, bt); @@ -118,7 +127,7 @@ elm_button_label_set(bt, D_("Save as")); evas_object_size_hint_weight_set(bt, 1.0, 0.0); evas_object_size_hint_align_set(bt, -1.0, 0.0); - evas_object_smart_callback_add(bt, "clicked", _bt_save_as_cb, photo); + evas_object_smart_callback_add(bt, "clicked", _bt_save_as_cb, panel_image); evas_object_show(bt); elm_box_pack_end(vbox, bt); @@ -146,7 +155,6 @@ entry = elm_entry_add(obj); panel_image->entry_name = entry; - elm_entry_entry_set(entry, enlil_photo_name_get(photo)); elm_entry_single_line_set(entry, 1); evas_object_smart_callback_add(entry, "changed", _entry_name_changed_cb, panel_image); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 1.0); @@ -163,7 +171,6 @@ entry = elm_entry_add(obj); panel_image->entry_description = entry; - elm_entry_entry_set(entry, enlil_photo_description_get(photo)); evas_object_smart_callback_add(entry, "changed", _entry_description_changed_cb, panel_image); elm_entry_single_line_set(entry, 0); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0); @@ -183,9 +190,8 @@ evas_object_show(lbl); elm_table_pack(tb, lbl, 0, 1, 1, 1); - snprintf(buf, PATH_MAX, "%f mo", enlil_photo_size_get(photo) / 1024. / 1024.); lbl = elm_label_add(obj); - elm_label_label_set(lbl, buf); + panel_image->lbl_file_size = lbl; evas_object_show(lbl); elm_table_pack(tb, lbl, 1, 1, 1, 1); @@ -278,8 +284,8 @@ evas_object_size_hint_align_set(panel_image->tb, -1.0, 0.0); evas_object_show(panel_image->tb); - elm_toolbar_item_add(panel_image->tb, NULL, D_("Save"), _bt_save_cb, photo); - elm_toolbar_item_add(panel_image->tb, NULL, D_("Save as"), _bt_save_as_cb, photo); + elm_toolbar_item_add(panel_image->tb, NULL, D_("Save"), _bt_save_cb, panel_image); + elm_toolbar_item_add(panel_image->tb, NULL, D_("Save as"), _bt_save_as_cb, panel_image); tb_item = elm_toolbar_item_add(panel_image->tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(tb_item, 1); @@ -291,7 +297,7 @@ icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/undo"); - panel_image->undo.item_undo = elm_menu_item_add(panel_image->undo.undo, NULL, icon, D_("Undo"), _bt_undo_cb, photo); + panel_image->undo.item_undo = elm_menu_item_add(panel_image->undo.undo, NULL, icon, D_("Undo"), _bt_undo_cb, panel_image); elm_menu_item_disabled_set(panel_image->undo.item_undo, 1); elm_menu_item_separator_add(panel_image->undo.undo, NULL); @@ -303,7 +309,7 @@ icon = elm_icon_add(obj); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/redo"); - panel_image->undo.item_redo = elm_menu_item_add(panel_image->undo.redo, NULL, icon, D_("Redo"), _bt_redo_cb, photo); + panel_image->undo.item_redo = elm_menu_item_add(panel_image->undo.redo, NULL, icon, D_("Redo"), _bt_redo_cb, panel_image); elm_menu_item_disabled_set(panel_image->undo.item_redo, 1); elm_menu_item_separator_add(panel_image->undo.redo, NULL); @@ -312,54 +318,54 @@ icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/1_1"); - elm_toolbar_item_add(panel_image->tb, icon, D_("1:1"), _bt_1_1_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("1:1"), _bt_1_1_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/fit"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Fit"), _bt_fit_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Fit"), _bt_fit_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/fill"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Fill"), _bt_fill_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Fill"), _bt_fill_cb, panel_image); tb_item = elm_toolbar_item_add(panel_image->tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(tb_item, 1); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/rotate/90"); - elm_toolbar_item_add(panel_image->tb, icon, D_("90°"), _bt_rotate_90_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("90°"), _bt_rotate_90_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/rotate/90/reverse"); - elm_toolbar_item_add(panel_image->tb, icon, D_("-90°"), _bt_rotate_R90_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("-90°"), _bt_rotate_R90_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/rotate/180"); - elm_toolbar_item_add(panel_image->tb, icon, D_("180°"), _bt_rotate_180_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("180°"), _bt_rotate_180_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/flip/horizontal"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Horizontal"), _bt_flip_horizontal_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Horizontal"), _bt_flip_horizontal_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/flip/vertical"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Vertical"), _bt_flip_vertical_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Vertical"), _bt_flip_vertical_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/blur"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Blur"), _bt_blur_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Blur"), _bt_blur_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/sharpen"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Sharpen"), _bt_sharpen_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Sharpen"), _bt_sharpen_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/sepia"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Sepia"), _bt_sepia_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Sepia"), _bt_sepia_cb, panel_image); icon = elm_icon_add(obj); elm_icon_file_set(icon, PACKAGE_DATA_DIR"/theme.edj", "icons/grayscale"); - elm_toolbar_item_add(panel_image->tb, icon, D_("Grayscale"), _bt_grayscale_cb, photo); + elm_toolbar_item_add(panel_image->tb, icon, D_("Grayscale"), _bt_grayscale_cb, panel_image); @@ -369,9 +375,6 @@ elm_photocam_zoom_mode_set(ph, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); elm_box_pack_end(bx2, ph); - snprintf(buf, PATH_MAX,"%s/%s", enlil_photo_path_get(photo), enlil_photo_file_name_get(photo)); - elm_photocam_file_set(ph, buf); - //rectangle on top of the photocam which retrieves the mouse wheel rect = evas_object_rectangle_add(evas_object_evas_get(obj)); panel_image->rect = rect; @@ -388,6 +391,36 @@ evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, panel_image); evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, panel_image); + hbox = elm_box_add(obj); + evas_object_size_hint_weight_set(hbox, 1.0, 0.0); + evas_object_size_hint_align_set(hbox, -1.0, 1.0); + evas_object_show(hbox); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(bx2, hbox); + + //slideshow + Evas_Object *slideshow = slideshow_object_add(obj); + panel_image->slideshow.slideshow = slideshow; + evas_object_size_hint_weight_set(slideshow, 0.0, 1.0); + evas_object_size_hint_align_set(slideshow, 0.0, -1.0); + evas_object_size_hint_min_set(slideshow, 100, 50); + slideshow_object_file_set(slideshow, PACKAGE_DATA_DIR"/theme.edj", "slideshow"); + evas_object_smart_callback_add(slideshow, "selected", _slideshow_selected_cb, panel_image); + evas_object_show(slideshow); + elm_box_pack_end(hbox, slideshow); + + itc_slideshow.icon_get = _slideshow_icon_get; + EINA_LIST_FOREACH(enlil_album_photos_get(enlil_photo_album_get(photo)), l, _photo) + { + Enlil_Photo_Data *_photo_data = enlil_photo_user_data_get(_photo); + Slideshow_Item *_item = slideshow_object_item_append(slideshow, &itc_slideshow, _photo); + _photo_data->slideshow_object_items = eina_list_append(_photo_data->slideshow_object_items, _item); + } + + Slideshow_Item *_item = eina_list_data_get(eina_list_last(photo_data->slideshow_object_items)); + slideshow_object_item_select(slideshow, _item); + + //zoom sl = elm_slider_add(obj); panel_image->sl = sl; evas_object_size_hint_weight_set(sl, 1.0, 0.0); @@ -399,9 +432,11 @@ elm_slider_unit_format_set(sl, "%4.0f"); evas_object_smart_callback_add(sl, "delay,changed", _slider_photocam_zoom_cb, panel_image); evas_object_show(sl); - elm_box_pack_end(bx2, sl); + elm_box_pack_end(hbox, sl); elm_slider_value_set(photo_data->panel_image->sl, elm_photocam_zoom_get(photo_data->panel_image->photocam)); + + //transformations notification window panel_image->notify_trans = elm_notify_add(ph); elm_notify_orient_set(panel_image->notify_trans, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT); @@ -440,20 +475,65 @@ elm_box_pack_end(bx2, bt); // - panel_image->history = enlil_trans_history_new(buf); - panel_image->tabpanel_item = tabpanel_item_add(photo_data->enlil_data->tabpanel, enlil_photo_name_get(photo), panes, _panel_select_cb, photo); - panel_image_exifs_update(photo); - panel_image_iptcs_update(photo); + _panel_image_photo_set(panel_image, photo); return panel_image; } +static void _panel_image_photo_set(Panel_Image *panel_image, Enlil_Photo *photo) +{ + Enlil_Trans_Job *job; + Elm_Menu_Item *mi_item; + Enlil_Photo_Data *photo_data = enlil_photo_user_data_get(photo); + char buf[PATH_MAX]; + + if(panel_image->photo) + { + Enlil_Photo_Data *_data = enlil_photo_user_data_get(panel_image->photo); + _data->panel_image = NULL; + } + + panel_image->photo = photo; + photo_data->panel_image = panel_image; + + tabpanel_item_label_set(panel_image->tabpanel_item, enlil_photo_name_get(photo)); + + elm_entry_entry_set(panel_image->entry_name, enlil_photo_name_get(photo)); + elm_entry_entry_set(panel_image->entry_description, enlil_photo_description_get(photo)); + + snprintf(buf, sizeof(buf), "%f mo", enlil_photo_size_get(photo) / 1024. / 1024.); + elm_label_label_set(panel_image->lbl_file_size, buf); + + elm_label_label_set(panel_image->exifs.size, D_("Unknown")); + + snprintf(buf, sizeof(buf),"%s/%s", enlil_photo_path_get(photo), enlil_photo_file_name_get(photo)); + elm_photocam_file_set(panel_image->photocam, buf); + + panel_image->save.save = EINA_FALSE; + + EINA_LIST_FREE( panel_image->jobs_trans, job) + enlil_trans_job_del(job); + + EINA_LIST_FREE( panel_image->undo.items_undo, mi_item) + ; + EINA_LIST_FREE( panel_image->undo.items_redo, mi_item) + ; + + enlil_trans_history_free(panel_image->history); + panel_image->history = enlil_trans_history_new(buf); + + panel_image_exifs_update(photo); + panel_image_iptcs_update(photo); +} + void panel_image_free(Panel_Image **_panel_image) { Enlil_Trans_Job *job; + Eina_List *l; + Slideshow_Item *item; Elm_Menu_Item *mi_item; Panel_Image *panel_image = *_panel_image; Enlil_Photo_Data *photo_data = enlil_photo_user_data_get( panel_image->photo ); @@ -481,6 +561,17 @@ if(panel_image->timer_description_name) ecore_timer_del(panel_image->timer_description_name); + EINA_LIST_FOREACH(slideshow_object_items_get(panel_image->slideshow.slideshow), l, item) + { + Enlil_Photo *_photo; + Eina_List *l2; + EINA_LIST_FOREACH(enlil_album_photos_get(enlil_photo_album_get(panel_image->photo)), l2, _photo) + { + Enlil_Photo_Data *_photo_data = enlil_photo_user_data_get(_photo); + _photo_data->slideshow_object_items = eina_list_remove( _photo_data->slideshow_object_items, item); + } + } + FREE(panel_image); } @@ -775,7 +866,7 @@ elm_box_pack_end(vbox, fs); evas_object_show(fs); - evas_object_smart_callback_add(fs, "done", _bt_save_as_done_cb, photo); + evas_object_smart_callback_add(fs, "done", _bt_save_as_done_cb, panel_image); panel_image->save.save = EINA_FALSE; } @@ -906,47 +997,56 @@ static void _bt_rotate_180_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_rotation_180(data); + Panel_Image *panel_image = data; + panel_image_rotation_180(panel_image->photo); } static void _bt_rotate_90_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_rotation_90(data); +Panel_Image *panel_image = data; + panel_image_rotation_90(panel_image->photo); } static void _bt_rotate_R90_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_rotation_R90(data); + Panel_Image *panel_image = data; + panel_image_rotation_R90(panel_image->photo); } static void _bt_flip_vertical_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_flip_vertical(data); + Panel_Image *panel_image = data; + panel_image_flip_vertical(panel_image->photo); } static void _bt_flip_horizontal_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_flip_horizontal(data); +Panel_Image *panel_image = data; + panel_image_flip_horizontal(panel_image->photo); } static void _bt_blur_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_blur(data); + Panel_Image *panel_image = data; + panel_image_blur(panel_image->photo); } static void _bt_sharpen_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_sharpen(data); + Panel_Image *panel_image = data; + panel_image_sharpen(panel_image->photo); } static void _bt_grayscale_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_grayscale(data); + Panel_Image *panel_image = data; + panel_image_grayscale(panel_image->photo); } static void _bt_sepia_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_sepia(data); + Panel_Image *panel_image = data; + panel_image_sepia(panel_image->photo); } static void _end_trans_cb(void *data, Enlil_Trans_Job *job, const char *file) @@ -1191,9 +1291,9 @@ static void _bt_save_as_done_cb(void *data, Evas_Object *obj, void *event_info) { char buf[PATH_MAX]; - Enlil_Photo *photo = data; + Panel_Image *panel_image = data; + Enlil_Photo *photo = panel_image->photo; Enlil_Photo_Data *photo_data = enlil_photo_user_data_get(photo); - Panel_Image *panel_image = photo_data->panel_image; const char *selected = event_info; if(panel_image->inwin) @@ -1236,12 +1336,14 @@ static void _bt_save_as_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_save_as(data); + Panel_Image *panel_image = data; + panel_image_save_as(panel_image->photo); } static void _bt_save_cb(void *data, Evas_Object *obj, void *event_info) { - panel_image_save(data); + Panel_Image *panel_image = data; + panel_image_save(panel_image->photo); } static void _bt_close_cb(void *data, Evas_Object *obj, void *event_info) @@ -1374,3 +1476,43 @@ elm_panes_content_left_size_set(obj, panel_image->panes_h_size); } +static Evas_Object *_slideshow_icon_get(const void *data, Evas_Object *obj) +{ + const char *s = NULL; + Enlil_Photo *photo = (Enlil_Photo *) data; + Enlil_Photo_Data *enlil_photo_data = enlil_photo_user_data_get(photo); + + Evas_Object *o = photo_object_add(obj); + photo_object_theme_file_set(o, PACKAGE_DATA_DIR"/theme.edj", "photo_simple"); + + if(enlil_photo_data->cant_create_thumb == 1) + return o; + + s = enlil_thumb_photo_get(photo, Enlil_THUMB_FDO_NORMAL, thumb_done_cb, thumb_error_cb, NULL); + + evas_image_cache_flush (evas_object_evas_get(obj)); + + if(s) + photo_object_file_set(o, s , NULL); + else + photo_object_progressbar_set(o, EINA_TRUE); + + if(enlil_photo_type_get(photo) == ENLIL_PHOTO_TYPE_VIDEO) + photo_object_camera_set(o, EINA_TRUE); + + photo_object_text_set(o, enlil_photo_name_get(photo)); + + evas_object_show(o); + return o; +} + + +static void _slideshow_selected_cb(void *data, Evas_Object *obj, void *event_info) +{ + Slideshow_Item *item = event_info; + Panel_Image *panel_image = data; + + Enlil_Photo *photo = slideshow_object_item_data_get(item); + + _panel_image_photo_set(panel_image, photo); +} |