diff --git a/data/themes/Makefile.am b/data/themes/Makefile.am index 3f81fac..f8f7be2 100644 --- a/data/themes/Makefile.am +++ b/data/themes/Makefile.am @@ -12,8 +12,7 @@ EXTRA_DIST = ephoto.edc \ images/sel_corner1.png \ images/sel_corner3.png \ images/sel_corner5.png \ - images/sel_corner7.png \ - images/tile.png + images/sel_corner7.png ephoto.edj: Makefile $(EXTRA_DIST) $(EDJE_CC) $(EDJE_FLAGS) \ diff --git a/data/themes/ephoto.edc b/data/themes/ephoto.edc index b23d974..d3470ab 100644 --- a/data/themes/ephoto.edc +++ b/data/themes/ephoto.edc @@ -3,334 +3,12 @@ collections { images { - image: "images/tile.png" COMP; image: "images/sel_border.png" COMP; image: "images/sel_corner1.png" COMP; image: "images/sel_corner3.png" COMP; image: "images/sel_corner5.png" COMP; image: "images/sel_corner7.png" COMP; } - group { name: "ephoto,main,layout"; - script { - public custom_folders = 0; - public custom_editor = 0; - public folders_visible = 0; - public editor_visible = 0; - public statusbar_visible = 1; - public message(Msg_Type:type, id, ...) { - if ((type == MSG_INT_SET) && (id == 1)) { - new minw = getarg(2); - set_int(statusbar_visible, 1); - - set_int(custom_folders, 1); - set_int(custom_editor, 1); - custom_state(PART:"ephoto,folders", - "visible", 0.0); - custom_state(PART:"ephoto.swallow.folders", - "visible", 0.0); - custom_state(PART:"ephoto,editor", - "visible", 0.0); - custom_state(PART:"ephoto.swallow.editor", - "visible", 0.0); - set_state_val(PART:"ephoto,folders", - STATE_MIN, minw, 0); - set_state_val(PART:"ephoto.swallow.folders", - STATE_MIN, minw, 0); - set_state_val(PART:"ephoto,editor", - STATE_MIN, minw, 0); - set_state_val(PART:"ephoto.swallow.editor", - STATE_MIN, minw, 0); - if (get_int(folders_visible)) { - set_state(PART:"ephoto,folders", - "custom", 0.0); - set_state(PART:"ephoto.swallow.folders", - "custom", 0.0); - } - if (get_int(editor_visible)) { - set_state(PART:"ephoto,editor", - "custom", 0.0); - set_state(PART:"ephoto.swallow.editor", - "custom", 0.0); - } - } - } - public hide_folders(val, Float:pos) { - set_int(folders_visible, 0); - set_state_anim(PART:"ephoto.swallow.folders", - "default", 0.0, DECELERATE, pos); - set_state_anim(PART:"ephoto,folders", - "default", 0.0, DECELERATE, pos); - } - public show_folders(val, Float:pos) { - set_int(folders_visible, 1); - if (custom_folders) { - set_state_anim(PART:"ephoto.swallow.folders", - "custom", 1.0, ACCELERATE, pos); - set_state_anim(PART:"ephoto,folders", - "custom", 1.0, ACCELERATE, pos); - } - else { - set_state_anim(PART:"ephoto.swallow.folders", - "visible", 1.0, ACCELERATE, pos); - set_state_anim(PART:"ephoto,folders", - "visible", 1.0, ACCELERATE, pos); - } - } - public hide_editor(val, Float:pos) { - set_int(editor_visible, 0); - set_state_anim(PART:"ephoto.swallow.editor", - "default", 0.0, DECELERATE, pos); - set_state_anim(PART:"ephoto,editor", - "default", 0.0, DECELERATE, pos); - } - public show_editor(val, Float:pos) { - set_int(editor_visible, 1); - if (custom_editor) { - set_state_anim(PART:"ephoto.swallow.editor", - "custom", 1.0, ACCELERATE, pos); - set_state_anim(PART:"ephoto,editor", - "custom", 1.0, ACCELERATE, pos); - } - else { - set_state_anim(PART:"ephoto.swallow.editor", - "visible", 1.0, ACCELERATE, pos); - set_state_anim(PART:"ephoto,editor", - "visible", 1.0, ACCELERATE, pos); - } - } - public hide_statusbar(val, Float:pos) { - set_int(statusbar_visible, 0); - set_state_anim(PART:"ephoto.swallow.statusbar", - "hidden", 0.0, DECELERATE, pos); - set_state_anim(PART:"ephoto,statusbar", - "hidden", 0.0, DECELERATE, pos); - } - public show_statusbar(val, Float:pos) { - set_int(statusbar_visible, 1); - set_state_anim(PART:"ephoto.swallow.statusbar", - "default", 1.0, ACCELERATE, pos); - set_state_anim(PART:"ephoto,statusbar", - "default", 1.0, ACCELERATE, pos); - } - } - parts { - rect { name: "ephoto,main,clip"; - scale: 1; - description { state: "default" 0.0; - } - } - image { name: "background_tile"; - scale: 1; - clip_to: "ephoto,main,clip"; - description { state: "default" 0.0; - fixed: 1 1; - rel1.to: "ephoto.swallow.main"; - rel2.to: "ephoto.swallow.main"; - image.normal: "images/tile.png"; - fill { - size.relative: 0.0 0.0; - size.offset: 32 32; - } - } - } - swallow { name: "ephoto.swallow.main"; - scale: 1; - mouse_events: 1; - clip_to: "ephoto,main,clip"; - description { state: "default" 0.0; - rel1.to_x: "ephoto,folders"; - rel1.relative: 1.0 0.0; - rel2.to_x: "ephoto,editor"; - rel2.to_y: "ephoto,statusbar"; - rel2.relative: 0.0 0.0; - } - } - rect { name: "ephoto,folders"; - clip_to: "ephoto,main,clip"; - scale: 1; - description { state: "default" 0.0; - fixed: 1 1; - min: 0 0; - rel1.to: "ephoto.swallow.folders"; - rel2.to: "ephoto.swallow.folders"; - color: 255 255 255 0; - visible: 0; - } - description { state: "visible" 0.0; - inherit: default 0.0; - fixed: 1 1; - min: 220 0; - color: 255 255 255 255; - visible: 1; - } - } - swallow { name: "ephoto.swallow.folders"; - scale: 1; - mouse_events: 1; - clip_to: "ephoto,folders"; - description { state: "default" 0.0; - fixed: 1 1; - min: 0 0; - align: 0.0 0.0; - rel1.relative: 0.0 0.0; - rel2.to_y: "ephoto,statusbar"; - rel2.relative: 0.0 0.0; - color: 255 255 255 0; - visible: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - fixed: 1 1; - min: 220 0; - rel1.relative: 0.0 0.0; - rel2.to_y: "ephoto,statusbar"; - rel2.relative: 0.2 0.0; - color: 255 255 255 255; - visible: 1; - } - } - rect { name: "ephoto,editor"; - clip_to: "ephoto,main,clip"; - scale: 1; - description { state: "default" 0.0; - fixed: 1 1; - min: 0 0; - rel1.to: "ephoto.swallow.editor"; - rel2.to: "ephoto.swallow.editor"; - color: 255 255 255 0; - visible: 0; - } - description { state: "visible" 0.0; - inherit: default 0.0; - fixed: 1 1; - min: 220 0; - color: 255 255 255 255; - visible: 1; - } - } - swallow { name: "ephoto.swallow.editor"; - scale: 1; - mouse_events: 1; - clip_to: "ephoto,editor"; - description { state: "default" 0.0; - fixed: 1 1; - min: 0 0; - align: 0.0 0.0; - rel1.relative: 1.0 0.0; - rel2.to_y: "ephoto,statusbar"; - rel2.relative: 1.0 0.0; - color: 255 255 255 0; - visible: 0; - } - description { state: "visible" 0.0; - inherit: "default" 0.0; - fixed: 1 1; - min: 220 0; - rel1.relative: 0.8 0.0; - rel2.to_y: "ephoto,statusbar"; - rel2.relative: 1.0 0.0; - align: 1.0 0.0; - color: 255 255 255 255; - visible: 1; - } - } - rect { name: "ephoto,statusbar"; - clip_to: "ephoto,main,clip"; - scale: 1; - description { state: "default" 0.0; - fixed: 1 1; - rel1.to: "ephoto.swallow.statusbar"; - rel2.to: "ephoto.swallow.statusbar"; - color: 255 255 255 255; - visible: 1; - } - description { state: "hidden" 0.0; - inherit: "default" 0.0; - color: 255 255 255 0; - visible: 0; - } - } - swallow { name: "ephoto.swallow.statusbar"; - scale: 1; - mouse_events: 1; - clip_to: "ephoto,statusbar"; - description { state: "default" 0.0; - fixed: 1 1; - rel1.relative: 0.0 1.0; - rel2.relative: 1.0 1.0; - align: 0.0 1.0; - color: 255 255 255 255; - visible: 1; - } - description { state: "hidden" 0.0; - inherit: "default" 0.0; - align: 0.0 0.0; - color: 255 255 255 0; - visible: 0; - } - } - } - programs { - program { signal: "ephoto,folders,hide"; - source: "ephoto"; - script { - if (get_int(folders_visible)) { - anim(0.3, "hide_folders", 1); - } - } - } - program { signal: "ephoto,folders,show"; - source: "ephoto"; - script { - if (!get_int(folders_visible)) { - anim(0.3, "show_folders", 1); - } - } - } - program { signal: "ephoto,folders,show,start"; - source: "ephoto"; - script { - set_int(folders_visible, 1); - if (custom_folders) { - set_state(PART:"ephoto,folders", "custom", 0.0); - set_state(PART:"ephoto.swallow.folders", "custom", 0.0); - } - else { - set_state(PART:"ephoto,folders", "visible", 0.0); - set_state(PART:"ephoto.swallow.folders", "visible", 0.0); - } - } - } - program { signal: "ephoto,editor,hide"; - source: "ephoto"; - script { - anim(0.3, "hide_editor", 1); - } - } - program { signal: "ephoto,editor,show"; - source: "ephoto"; - script { - anim(0.3, "show_editor", 1); - } - } - program { signal: "ephoto,statusbar,hide"; - source: "ephoto"; - script { - if (get_int(statusbar_visible)) { - anim(0.3, "hide_statusbar", 1); - } - } - } - program { signal: "ephoto,statusbar,show"; - source: "ephoto"; - script { - if (!get_int(statusbar_visible)) { - anim(0.3, "show_statusbar", 1); - } - } - } - } - } group { "elm/label/base/info"; mouse_events: 0; styles { diff --git a/data/themes/images/tile.png b/data/themes/images/tile.png deleted file mode 100644 index 219cc80..0000000 Binary files a/data/themes/images/tile.png and /dev/null differ diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 9a7b972..7895422 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -129,9 +129,9 @@ int e_ipc_init(void); int e_ipc_shutdown(void); /*editing functions*/ -Evas_Object *ephoto_editor_add(Ephoto *ephoto, const char *title, +Evas_Object *ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const char *data_name, void *data); -void ephoto_editor_del(Evas_Object *obj); +void ephoto_editor_del(Evas_Object *obj, Evas_Object *parent); void ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Object *image_parent, Evas_Object *image); void ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, @@ -213,14 +213,15 @@ struct _Ephoto_Config int config_version; int thumb_size; int thumb_gen_size; - const char *directory; - double slideshow_timeout; - const char *slideshow_transition; int window_width; int window_height; - Eina_Bool fsel_hide; - double lpane_size; + double slideshow_timeout; + double left_size; + double right_size; + const char *directory; + const char *slideshow_transition; const char *open; + Eina_Bool fsel_hide; Eina_Bool prompts; Eina_Bool drop; Eina_Bool movess; diff --git a/src/bin/ephoto_bcg.c b/src/bin/ephoto_bcg.c index 77714bd..7cdb73f 100644 --- a/src/bin/ephoto_bcg.c +++ b/src/bin/ephoto_bcg.c @@ -287,7 +287,7 @@ _bcg_apply(void *data, int type EINA_UNUSED, evas_object_image_size_get(ebcg->image, &w, &h); ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h); } - ephoto_editor_del(ebcg->editor); + ephoto_editor_del(ebcg->editor, ebcg->parent); return ECORE_CALLBACK_PASS_ON; } @@ -306,7 +306,7 @@ _bcg_cancel(void *data, int type EINA_UNUSED, ebcg->gamma = 1; _brightness_slider_changed(ebcg, ebcg->bslider, NULL); ephoto_single_browser_cancel_editing(ebcg->main); - ephoto_editor_del(ebcg->editor); + ephoto_editor_del(ebcg->editor, ebcg->parent); return ECORE_CALLBACK_PASS_ON; } @@ -351,7 +351,7 @@ ephoto_bcg_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje memcpy(ebcg->original_im_data, im_data, sizeof(unsigned int) * ebcg->w * ebcg->h); - ebcg->editor = ephoto_editor_add(ephoto, _("Brightness/Contrast/Gamma"), + ebcg->editor = ephoto_editor_add(ephoto, parent, _("Brightness/Contrast/Gamma"), "ebcg", ebcg); evas_object_event_callback_add(ebcg->editor, EVAS_CALLBACK_DEL, _editor_del, ebcg); diff --git a/src/bin/ephoto_color.c b/src/bin/ephoto_color.c index 5d81f52..e6bc6a2 100644 --- a/src/bin/ephoto_color.c +++ b/src/bin/ephoto_color.c @@ -272,7 +272,7 @@ _color_apply(void *data, int type EINA_UNUSED, evas_object_image_size_get(eco->image, &w, &h); ephoto_single_browser_image_data_done(eco->main, image_data, w, h); } - ephoto_editor_del(eco->editor); + ephoto_editor_del(eco->editor, eco->parent); return ECORE_CALLBACK_PASS_ON; } @@ -291,7 +291,7 @@ _color_cancel(void *data, int type EINA_UNUSED, eco->blue = 0; _red_slider_changed(eco, eco->rslider, NULL); ephoto_single_browser_cancel_editing(eco->main); - ephoto_editor_del(eco->editor); + ephoto_editor_del(eco->editor, eco->parent); return ECORE_CALLBACK_PASS_ON; } @@ -336,7 +336,7 @@ ephoto_color_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Ob memcpy(eco->original_im_data, im_data, sizeof(unsigned int) * eco->w * eco->h); - eco->editor = ephoto_editor_add(ephoto, _("Adjust Color Levels"), + eco->editor = ephoto_editor_add(ephoto, parent, _("Adjust Color Levels"), "eco", eco); evas_object_event_callback_add(eco->editor, EVAS_CALLBACK_DEL, _editor_del, eco); diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index 5edb491..83235d1 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -1,6 +1,6 @@ #include "ephoto.h" -#define CONFIG_VERSION 20 +#define CONFIG_VERSION 21 static int _ephoto_config_load(Ephoto *ephoto); static Eina_Bool _ephoto_on_config_save(void *data); @@ -759,7 +759,8 @@ ephoto_config_init(Ephoto *ephoto) C_VAL(D, T, window_width, EET_T_INT); C_VAL(D, T, window_height, EET_T_INT); C_VAL(D, T, fsel_hide, EET_T_INT); - C_VAL(D, T, lpane_size, EET_T_DOUBLE); + C_VAL(D, T, left_size, EET_T_DOUBLE); + C_VAL(D, T, right_size, EET_T_DOUBLE); C_VAL(D, T, open, EET_T_STRING); C_VAL(D, T, prompts, EET_T_INT); C_VAL(D, T, drop, EET_T_INT); @@ -777,7 +778,8 @@ ephoto_config_init(Ephoto *ephoto) ephoto->config->window_width = 900*elm_config_scale_get(); ephoto->config->window_height = 500*elm_config_scale_get(); ephoto->config->fsel_hide = 0; - ephoto->config->lpane_size = .15; + ephoto->config->left_size = .2; + ephoto->config->right_size = .2; ephoto->config->open = eina_stringshare_add(eina_environment_home_get()); ephoto->config->prompts = 1; ephoto->config->drop = 0; diff --git a/src/bin/ephoto_cropper.c b/src/bin/ephoto_cropper.c index f07ab1c..e76df59 100644 --- a/src/bin/ephoto_cropper.c +++ b/src/bin/ephoto_cropper.c @@ -224,7 +224,7 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED, evas_object_del(ec->cropper); evas_object_del(ec->layout); evas_object_del(ec->box); - ephoto_editor_del(ec->editor); + ephoto_editor_del(ec->editor, ec->parent); } static void @@ -240,7 +240,7 @@ _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED, evas_object_del(ec->cropper); evas_object_del(ec->layout); evas_object_del(ec->box); - ephoto_editor_del(ec->editor); + ephoto_editor_del(ec->editor, ec->parent); } static void @@ -697,7 +697,7 @@ ephoto_cropper_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, evas_object_event_callback_add(ec->layout, EVAS_CALLBACK_RESIZE, _image_resize, ec); - ec->editor = ephoto_editor_add(ephoto, _("Crop Image"), + ec->editor = ephoto_editor_add(ephoto, parent, _("Crop Image"), "ec", ec); evas_object_event_callback_add(ec->editor, EVAS_CALLBACK_DEL, _editor_del, ec); diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c index 634d25a..2c789e8 100644 --- a/src/bin/ephoto_directory_browser.c +++ b/src/bin/ephoto_directory_browser.c @@ -16,6 +16,7 @@ struct _Ephoto_Directory_Browser Evas_Object *fsel; Evas_Object *fsel_back; Evas_Object *leftbox; + Evas_Object *butbox; Elm_Object_Item *dir_current; Elm_Object_Item *last_sel; Eio_File *ls; @@ -414,7 +415,9 @@ _trash_back(void *data, Evas_Object *obj EINA_UNUSED, elm_box_clear(db->leftbox); db->fsel = db->fsel_back; - elm_box_pack_end(db->leftbox, db->fsel); + elm_box_pack_end(db->leftbox, db->butbox); + elm_box_pack_end(db->leftbox, db->fsel);\ + evas_object_show(db->butbox); evas_object_show(db->fsel); db->fsel_back = NULL; @@ -433,7 +436,9 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED, Evas_Object *ic, *but; db->fsel_back = db->fsel; + evas_object_hide(db->butbox); evas_object_hide(db->fsel_back); + elm_box_unpack(db->leftbox, db->butbox); elm_box_unpack(db->leftbox, db->fsel_back); ic = elm_icon_add(db->leftbox); @@ -641,10 +646,41 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED, evas_object_show(menu); } +static void +_go_root(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Ephoto *ephoto = data; + const char *path = "/"; + char *realpath = ecore_file_realpath(path); + + ephoto_directory_browser_clear(ephoto); + ephoto_thumb_browser_clear(ephoto); + eina_stringshare_replace(&ephoto->config->directory, realpath); + ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory); + ephoto_directory_browser_initialize_structure(ephoto); + free(realpath); +} + +static void +_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Ephoto *ephoto = data; + const char *path = eina_environment_home_get(); + char *realpath = ecore_file_realpath(path); + + ephoto_directory_browser_clear(ephoto); + ephoto_thumb_browser_clear(ephoto); + eina_stringshare_replace(&ephoto->config->directory, realpath); + ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory); + ephoto_directory_browser_initialize_structure(ephoto); + free(realpath); +} + static void _ephoto_directory_view_add(Ephoto_Directory_Browser *db) { Edje_Message_Int_Set *msg; + Evas_Object *ic, *but; msg = alloca(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int))); msg->count = 1; @@ -661,6 +697,44 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db) elm_box_pack_end(db->main, db->leftbox); evas_object_show(db->leftbox); + db->butbox = elm_box_add(db->leftbox); + elm_box_horizontal_set(db->butbox, EINA_TRUE); + elm_box_homogeneous_set(db->butbox, EINA_TRUE); + EPHOTO_WEIGHT(db->butbox, EVAS_HINT_EXPAND, 0.0); + EPHOTO_FILL(db->butbox); + elm_box_pack_end(db->leftbox, db->butbox); + evas_object_show(db->butbox); + + ic = elm_icon_add(db->butbox); + evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), + 20*elm_config_scale_get()); + elm_icon_standard_set(ic, "computer"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + but = elm_button_add(db->butbox); + elm_object_text_set(but, _("Root")); + elm_object_part_content_set(but, "icon", ic); + EPHOTO_WEIGHT(but, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + EPHOTO_FILL(but); + evas_object_smart_callback_add(but, "clicked", _go_root, db->ephoto); + elm_box_pack_end(db->butbox, but); + evas_object_show(but); + + ic = elm_icon_add(db->butbox); + evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(), + 20*elm_config_scale_get()); + elm_icon_standard_set(ic, "user-home"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + but = elm_button_add(db->butbox); + elm_object_text_set(but, _("Home")); + elm_object_part_content_set(but, "icon", ic); + EPHOTO_WEIGHT(but, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + EPHOTO_FILL(but); + evas_object_smart_callback_add(but, "clicked", _go_home, db->ephoto); + elm_box_pack_end(db->butbox, but); + evas_object_show(but); + db->fsel = elm_genlist_add(db->leftbox); elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE); diff --git a/src/bin/ephoto_editor.c b/src/bin/ephoto_editor.c index 10e6675..fc42693 100644 --- a/src/bin/ephoto_editor.c +++ b/src/bin/ephoto_editor.c @@ -22,7 +22,7 @@ _editor_cancel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } Evas_Object * -ephoto_editor_add(Ephoto *ephoto, const char *title, const char *data_name, +ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const char *title, const char *data_name, void *data) { Evas_Object *frame, *box, *ic, *button; @@ -30,13 +30,14 @@ ephoto_editor_add(Ephoto *ephoto, const char *title, const char *data_name, edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), "ephoto,folders,hide", "ephoto"); - frame = elm_frame_add(ephoto->main); + frame = elm_frame_add(parent); elm_object_text_set(frame, title); EPHOTO_WEIGHT(frame, 0.3, EVAS_HINT_EXPAND); EPHOTO_FILL(frame); evas_object_size_hint_min_set(frame, (int)round(195 * elm_config_scale_get()), 0); evas_object_data_set(frame, data_name, data); - elm_layout_content_set(ephoto->layout, "ephoto.swallow.editor", frame); + elm_object_part_content_set(parent, "right", frame); + elm_panes_content_right_size_set(parent, ephoto->config->right_size); evas_object_show(frame); box = elm_box_add(frame); @@ -100,12 +101,14 @@ ephoto_editor_add(Ephoto *ephoto, const char *title, const char *data_name, } void -ephoto_editor_del(Evas_Object *obj) +ephoto_editor_del(Evas_Object *obj, Evas_Object *parent) { Evas_Object *frame = evas_object_data_get(obj, "frame"); + elm_object_part_content_unset(parent, "right"); if (frame) evas_object_del(frame); + elm_panes_content_right_size_set(parent, 0.0); ecore_event_add(EPHOTO_EVENT_EDITOR_BACK, NULL, NULL, NULL); } diff --git a/src/bin/ephoto_hsv.c b/src/bin/ephoto_hsv.c index 0121f2e..3bfff76 100644 --- a/src/bin/ephoto_hsv.c +++ b/src/bin/ephoto_hsv.c @@ -294,7 +294,7 @@ _hsv_apply(void *data, int type EINA_UNUSED, evas_object_image_size_get(ehsv->image, &w, &h); ephoto_single_browser_image_data_done(ehsv->main, image_data, w, h); } - ephoto_editor_del(ehsv->editor); + ephoto_editor_del(ehsv->editor, ehsv->parent); return ECORE_CALLBACK_PASS_ON; } @@ -313,7 +313,7 @@ _hsv_cancel(void *data, int type EINA_UNUSED, ehsv->value = 0; _hue_slider_changed(ehsv, ehsv->hslider, NULL); ephoto_single_browser_cancel_editing(ehsv->main); - ephoto_editor_del(ehsv->editor); + ephoto_editor_del(ehsv->editor, ehsv->parent); return ECORE_CALLBACK_PASS_ON; } @@ -358,7 +358,7 @@ ephoto_hsv_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_Obje memcpy(ehsv->original_im_data, im_data, sizeof(unsigned int) * ehsv->w * ehsv->h); - ehsv->editor = ephoto_editor_add(ephoto, _("Hue/Saturation/Value"), + ehsv->editor = ephoto_editor_add(ephoto, parent, _("Hue/Saturation/Value"), "ehsv", ehsv); evas_object_event_callback_add(ehsv->editor, EVAS_CALLBACK_DEL, _editor_del, ehsv); diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index add3ebb..8aed810 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -111,8 +111,8 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry) evas_object_hide(ephoto->single_browser); evas_object_hide(ephoto->thumb_browser); elm_object_focus_set(ephoto->slideshow, EINA_TRUE); - elm_layout_signal_emit(ephoto->layout, "ephoto,folders,hide", "ephoto"); - elm_layout_signal_emit(ephoto->layout, "ephoto,statusbar,hide", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, 0.0); + elm_table_unpack(ephoto->main, ephoto->statusbar); evas_object_hide(ephoto->dir_browser); evas_object_hide(ephoto->statusbar); evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE); @@ -155,10 +155,10 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED, } if (ephoto->folders_toggle) { - elm_layout_signal_emit(ephoto->layout, "ephoto,folders,show", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size); evas_object_show(ephoto->dir_browser); } - elm_layout_signal_emit(ephoto->layout, "ephoto,statusbar,show", "ephoto"); + elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1); evas_object_show(ephoto->statusbar); } @@ -269,8 +269,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj, if (!ephoto->folders_toggle) { - edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), - "ephoto,folders,show", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size); ephoto->folders_toggle = EINA_TRUE; if (elm_object_text_get(obj)) elm_object_text_set(obj, _("Hide Folders")); @@ -278,8 +277,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj, } else { - edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), - "ephoto,folders,hide", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, 0.0); ephoto->folders_toggle = EINA_FALSE; if (elm_object_text_get(obj)) elm_object_text_set(obj, _("Show Folders")); @@ -319,22 +317,29 @@ _exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, evas_object_del(ephoto->win); } +static void +_ephoto_left_pane_resized(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Ephoto *ephoto = data; + + ephoto->config->left_size = elm_panes_content_left_size_get(ephoto->layout); +} + /*Toggle determines whether to toggle folder visibility, or just force visible*/ void ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle) { if (!ephoto->folders_toggle || !toggle) { - edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), - "ephoto,folders,show", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size); evas_object_show(ephoto->dir_browser); ephoto->folders_toggle = EINA_TRUE; elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders")); } else if (ephoto->folders_toggle) { - edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), - "ephoto,folders,hide", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, 0.0); evas_object_hide(ephoto->dir_browser); ephoto->folders_toggle = EINA_FALSE; elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders")); @@ -395,18 +400,18 @@ ephoto_window_add(const char *path) elm_win_resize_object_add(ephoto->win, ephoto->main); evas_object_show(ephoto->main); - ephoto->layout = elm_layout_add(ephoto->main); - elm_layout_file_set(ephoto->layout, PACKAGE_DATA_DIR "/themes/ephoto.edj", - "ephoto,main,layout"); + ephoto->layout = elm_panes_add(ephoto->main); EPHOTO_EXPAND(ephoto->layout); EPHOTO_FILL(ephoto->layout); - elm_table_pack(ephoto->main, ephoto->layout, 0, 1, 1, 2); + evas_object_smart_callback_add(ephoto->layout, "unpress", + _ephoto_left_pane_resized, ephoto); + elm_table_pack(ephoto->main, ephoto->layout, 0, 0, 1, 2); evas_object_show(ephoto->layout); ephoto->pager = elm_table_add(ephoto->layout); EPHOTO_EXPAND(ephoto->pager); EPHOTO_FILL(ephoto->pager); - elm_layout_content_set(ephoto->layout, "ephoto.swallow.main", ephoto->pager); + elm_object_part_content_set(ephoto->layout, "right", ephoto->pager); evas_object_show(ephoto->pager); ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout); @@ -447,16 +452,17 @@ ephoto_window_add(const char *path) ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout); EPHOTO_WEIGHT(ephoto->dir_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); EPHOTO_FILL(ephoto->dir_browser); - elm_layout_content_set(ephoto->layout, "ephoto.swallow.folders", ephoto->dir_browser); + elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size); + elm_object_part_content_set(ephoto->layout, "left", ephoto->dir_browser); evas_object_show(ephoto->dir_browser); - ephoto->statusbar = elm_box_add(ephoto->layout); + ephoto->statusbar = elm_box_add(ephoto->main); evas_object_size_hint_min_set(ephoto->statusbar, 20*elm_config_scale_get(), 20*elm_config_scale_get()); elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE); EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL); EPHOTO_FILL(ephoto->statusbar); - elm_layout_content_set(ephoto->layout, "ephoto.swallow.statusbar", ephoto->statusbar); + elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1); evas_object_show(ephoto->statusbar); ic = elm_icon_add(ephoto->statusbar); @@ -608,14 +614,14 @@ ephoto_window_add(const char *path) if (!ephoto->config->folders) { evas_object_hide(ephoto->dir_browser); + elm_panes_content_left_size_set(ephoto->layout, 0.0); ephoto->folders_toggle = EINA_FALSE; elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders")); } else { ephoto->folders_toggle = EINA_TRUE; - edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), - "ephoto,folders,show,start", "ephoto"); + elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size); elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders")); } if (ephoto->config->firstrun) diff --git a/src/bin/ephoto_red_eye.c b/src/bin/ephoto_red_eye.c index 238bbac..ac263ec 100644 --- a/src/bin/ephoto_red_eye.c +++ b/src/bin/ephoto_red_eye.c @@ -161,7 +161,7 @@ _reye_apply(void *data, int type EINA_UNUSED, evas_object_image_size_get(er->image, &w, &h); ephoto_single_browser_image_data_done(er->main, image_data, w, h); } - ephoto_editor_del(er->editor); + ephoto_editor_del(er->editor, er->parent); return ECORE_CALLBACK_PASS_ON; } @@ -181,7 +181,7 @@ _reye_cancel(void *data, int type EINA_UNUSED, free(er->edited_im_data); er->edited_im_data = NULL; } - ephoto_editor_del(er->editor); + ephoto_editor_del(er->editor, er->parent); return ECORE_CALLBACK_PASS_ON; } @@ -228,7 +228,7 @@ ephoto_red_eye_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, Evas_ evas_object_event_callback_add(er->image, EVAS_CALLBACK_MOUSE_UP, _reye_clicked, er); - er->editor = ephoto_editor_add(ephoto, _("Red Eye Removal"), + er->editor = ephoto_editor_add(ephoto, parent, _("Red Eye Removal"), "ereye", er); evas_object_event_callback_add(er->editor, EVAS_CALLBACK_DEL, _editor_del, er); diff --git a/src/bin/ephoto_scale.c b/src/bin/ephoto_scale.c index d44df42..4ec95ce 100644 --- a/src/bin/ephoto_scale.c +++ b/src/bin/ephoto_scale.c @@ -109,7 +109,7 @@ _es_apply(void *data, int type EINA_UNUSED, elm_spinner_value_get(es->scaleh) == es->h) { ephoto_single_browser_cancel_editing(es->main); - ephoto_editor_del(es->editor); + ephoto_editor_del(es->editor, es->parent); return ECORE_CALLBACK_PASS_ON; } @@ -143,7 +143,7 @@ _es_apply(void *data, int type EINA_UNUSED, memcpy(im_data, image_data, sizeof(unsigned int) * w * h); ephoto_single_browser_image_data_done(es->main, im_data, w, h); - ephoto_editor_del(es->editor); + ephoto_editor_del(es->editor, es->parent); evas_object_del(im); ecore_evas_free(ee); @@ -158,7 +158,7 @@ _es_cancel(void *data, int type EINA_UNUSED, Ephoto_Scale *es = data; ephoto_single_browser_cancel_editing(es->main); - ephoto_editor_del(es->editor); + ephoto_editor_del(es->editor, es->parent); return ECORE_CALLBACK_PASS_ON; } @@ -214,7 +214,7 @@ ephoto_scale_add(Ephoto *ephoto, Evas_Object *main, Evas_Object *parent, es->aspectw = (double)es->w / (double)es->h; es->aspecth = (double)es->h / (double)es->w; - es->editor = ephoto_editor_add(ephoto, _("Scale Image"), + es->editor = ephoto_editor_add(ephoto, parent, _("Scale Image"), "es", es); evas_object_event_callback_add(es->editor, EVAS_CALLBACK_DEL, _editor_del, es); diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 5d5f04f..e740075 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -1048,13 +1048,15 @@ _close_editor(void *data, Evas_Object *obj EINA_UNUSED, { Ephoto_Single_Browser *sb = data; - edje_object_signal_emit(elm_layout_edje_get(sb->ephoto->layout), - "ephoto,editor,hide", "ephoto"); + elm_object_part_content_unset(sb->mhbox, "right"); + elm_panes_content_right_size_set(sb->mhbox, 0.0); + if (sb->ephoto->folders_toggle) { - elm_layout_signal_emit(sb->ephoto->layout, "ephoto,folders,show", "ephoto"); + + elm_panes_content_left_size_set(sb->ephoto->layout, sb->ephoto->config->left_size); evas_object_show(sb->ephoto->dir_browser); - elm_layout_signal_emit(sb->ephoto->layout, "ephoto,statusbar,show", "ephoto"); + elm_table_pack(sb->ephoto->main, sb->ephoto->statusbar, 0, 2, 1, 1); evas_object_show(sb->ephoto->statusbar); } evas_object_del(sb->edit_main); @@ -1600,7 +1602,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb) sb->viewer = _viewer_add(sb->main, sb->entry->path, sb); if (sb->viewer) { - elm_box_pack_start(sb->mhbox, sb->viewer); + elm_object_part_content_set(sb->mhbox, "left", sb->viewer); evas_object_show(sb->viewer); evas_object_event_callback_add(sb->viewer, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb); @@ -1620,7 +1622,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb) _("This image does not exist or is corrupted!")); EPHOTO_EXPAND(sb->nolabel); EPHOTO_FILL(sb->nolabel); - elm_box_pack_start(sb->mhbox, sb->nolabel); + elm_object_part_content_set(sb->mhbox, "left", sb->nolabel); evas_object_show(sb->nolabel); ephoto_title_set(sb->ephoto, _("Bad Image")); } @@ -1727,18 +1729,18 @@ _editor_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNU itc->func.state_get = NULL; itc->func.del = NULL; - edje_object_signal_emit(elm_layout_edje_get(sb->ephoto->layout), - "ephoto,folders,hide", "ephoto"); + elm_panes_content_left_size_set(sb->ephoto->layout, 0.0); + if (evas_object_visible_get(sb->ephoto->statusbar)) + elm_table_unpack(sb->ephoto->main, sb->ephoto->statusbar); evas_object_hide(sb->ephoto->dir_browser); - edje_object_signal_emit(elm_layout_edje_get(sb->ephoto->layout), - "ephoto,statusbar,hide", "ephoto"); evas_object_hide(sb->ephoto->statusbar); - frame = elm_frame_add(sb->ephoto->layout); + frame = elm_frame_add(sb->mhbox); elm_object_text_set(frame, _("Edit")); EPHOTO_EXPAND(frame); EPHOTO_FILL(frame); - elm_layout_content_set(sb->ephoto->layout, "ephoto.swallow.editor", frame); + elm_object_part_content_set(sb->mhbox, "right", frame); + elm_panes_content_right_size_set(sb->mhbox, sb->ephoto->config->right_size); evas_object_show(frame); box = elm_box_add(frame); @@ -2072,6 +2074,15 @@ _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN evas_object_smart_callback_call(sb->main, "back", sb->entry); } +static void +_ephoto_right_pane_resized(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Ephoto_Single_Browser *sb = data; + + sb->ephoto->config->right_size = elm_panes_content_right_size_get(sb->mhbox); +} + static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) @@ -2528,14 +2539,14 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) EPHOTO_FILL(sb->main); evas_object_data_set(sb->main, "single_browser", sb); - sb->mhbox = elm_box_add(sb->main); - elm_box_horizontal_set(sb->mhbox, EINA_TRUE); + sb->mhbox = elm_panes_add(sb->main); EPHOTO_EXPAND(sb->mhbox); EPHOTO_FILL(sb->mhbox); + elm_panes_content_right_size_set(sb->mhbox, 0.0); + evas_object_smart_callback_add(sb->mhbox, "unpress", _ephoto_right_pane_resized, sb); elm_box_pack_end(sb->main, sb->mhbox); evas_object_show(sb->mhbox); - sb->handlers = eina_list_append(sb->handlers, ecore_event_handler_add(EPHOTO_EVENT_POPULATE_END,