Do not update if you are not willing to expect a different ephoto.. This is a very temporary test that won't work right for most.

SVN revision: 57559
This commit is contained in:
titan 2011-03-07 22:02:12 +00:00 committed by titan
parent ac899f9de4
commit 169813a679
6 changed files with 214 additions and 40 deletions

View File

@ -8,6 +8,142 @@ collections {
image: "thumb_shadow.png" COMP; image: "thumb_shadow.png" COMP;
} }
group group
{
name: "ephoto/layout/simple";
parts
{
part
{
name: "layout";
type: RECT;
description
{
state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel1.offset: 0 0;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
color: 255 255 255 0;
}
}
part
{
name: "ephoto.content.swallow";
type: SWALLOW;
description
{
rel1.to_y: "ephoto.toolbar.swallow";
rel1.relative: 0.0 1.0;
rel1.offset: -1 1;
}
}
part
{
name: "ephoto.toolbar.swallow";
type: SWALLOW;
description
{
state: "default" 0.0;
align: 0.5 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 0.0;
rel2.offset: -1 47;
fixed: 1 1;
}
}
}
}
group
{
name: "ephoto/layout/simple/autohide";
parts
{
part
{
name: "layout";
type: RECT;
description
{
state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel1.offset: 0 0;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
color: 255 255 255 0;
}
}
part
{
name: "ephoto.content.swallow";
type: SWALLOW;
description
{
rel1.to: "layout";
rel2.to: "layout";
}
}
part
{
name: "ephoto.toolbar.swallow";
type: SWALLOW;
description
{
state: "default" 0.0;
align: 0.5 1.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
fixed: 1 1;
visible: 0;
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 255;
visible: 1;
}
}
part
{
name: "toolbar_event";
type: RECT;
mouse_events: 1;
repeat_events: 1;
description
{
state: "default" 0.0;
align: 0.5 1.0;
rel1.to: "ephoto.toolbar.swallow";
rel2.to: "ephoto.toolbar.swallow";
color: 255 255 255 0;
}
}
}
programs
{
program
{
name: "go_visible";
signal: "mouse,clicked,1";
source: "toolbar_event";
filter: "ephoto.toolbar.swallow" "default" 0.0;
action: STATE_SET "visible" 0.0;
transition: LINEAR 0.4;
target: "ephoto.toolbar.swallow";
}
program
{
name: "go_hidden";
signal: "hide";
source: "toolbar_event";
filter: "ephoto.toolbar.swallow" "visible" 0.0;
action: STATE_SET "default" 0.0;
transition: LINEAR 0.4;
target: "ephoto.toolbar.swallow";
}
}
}
group
{ {
name: "elm/layout/ephoto/orient"; name: "elm/layout/ephoto/orient";
parts parts
@ -527,4 +663,3 @@ collections {
} }
} }
} }

View File

@ -38,6 +38,7 @@ void ephoto_thumb_size_set(Ephoto *ephoto, int size);
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, const char *path); Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, const char *path);
void ephoto_thumb_path_set(Evas_Object *o, const char *path); void ephoto_thumb_path_set(Evas_Object *o, const char *path);
void ephoto_directory_set(Ephoto *ephoto, const char *path); void ephoto_directory_set(Ephoto *ephoto, const char *path);
void auto_hide_toolbar(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__);
Ephoto_Orient ephoto_file_orient_get(const char *path); Ephoto_Orient ephoto_file_orient_get(const char *path);

View File

@ -336,19 +336,23 @@ ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
evas_object_event_callback_add evas_object_event_callback_add
(efb->main_layout, EVAS_CALLBACK_KEY_DOWN, _key_down, efb); (efb->main_layout, EVAS_CALLBACK_KEY_DOWN, _key_down, efb);
evas_object_data_set(efb->main_layout, "flow_browser", efb); evas_object_data_set(efb->main_layout, "flow_browser", efb);
edje_object_signal_callback_add
(efb->edje, "mouse,clicked,1", "toolbar_event", auto_hide_toolbar, efb->ephoto);
if (!elm_layout_theme_set if (!elm_layout_file_set
(efb->main_layout, "layout", "application", "toolbar-vbox")) (efb->main_layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
"ephoto/layout/simple/autohide"))
{ {
ERR("could not load style 'toolbar-vbox' from theme"); ERR("could not load style 'ephoto/layout/simple' from theme");
goto error; goto error;
} }
efb->toolbar = edje_object_part_external_object_get efb->toolbar = elm_toolbar_add(efb->main_layout);
(efb->edje, "elm.external.toolbar");
elm_toolbar_homogenous_set(efb->toolbar, EINA_TRUE); elm_toolbar_homogenous_set(efb->toolbar, EINA_TRUE);
elm_toolbar_mode_shrink_set(efb->toolbar, ELM_TOOLBAR_SHRINK_MENU); elm_toolbar_mode_shrink_set(efb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
elm_toolbar_menu_parent_set(efb->toolbar, parent); elm_toolbar_menu_parent_set(efb->toolbar, parent);
evas_object_size_hint_weight_set(efb->toolbar, 0.0, 0.0);
evas_object_size_hint_align_set(efb->toolbar, EVAS_HINT_FILL, 0.0);
efb->action.go_back = _toolbar_item_add efb->action.go_back = _toolbar_item_add
(efb, "edit-undo", "Back", 120, _flow_back); (efb, "edit-undo", "Back", 120, _flow_back);
@ -359,6 +363,10 @@ ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
efb->action.slideshow = _toolbar_item_add efb->action.slideshow = _toolbar_item_add
(efb, "media-playback-start", "Slideshow", 70, _show_slideshow); (efb, "media-playback-start", "Slideshow", 70, _show_slideshow);
elm_layout_content_set
(efb->main_layout, "ephoto.toolbar.swallow", efb->toolbar);
evas_object_show(efb->toolbar);
efb->layout = elm_layout_add(efb->main_layout); efb->layout = elm_layout_add(efb->main_layout);
elm_layout_file_set elm_layout_file_set
(efb->layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow"); (efb->layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "flow");
@ -367,8 +375,8 @@ ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
evas_object_size_hint_fill_set evas_object_size_hint_fill_set
(efb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL); (efb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(efb->layout); evas_object_show(efb->layout);
elm_layout_box_append elm_layout_content_set
(efb->main_layout, "elm.box.content", efb->layout); (efb->main_layout, "ephoto.content.swallow", efb->layout);
edje_object_signal_callback_add edje_object_signal_callback_add
(elm_layout_edje_get(efb->layout), "done", "ephoto", _flow_done, efb); (elm_layout_edje_get(efb->layout), "done", "ephoto", _flow_done, efb);

View File

@ -578,3 +578,22 @@ ephoto_entries_free(Ephoto *ephoto)
Ephoto_Entry *entry; Ephoto_Entry *entry;
EINA_LIST_FREE(ephoto->entries, entry) ephoto_entry_free(entry); EINA_LIST_FREE(ephoto->entries, entry) ephoto_entry_free(entry);
} }
Eina_Bool
_toolbar_hide(void *data)
{
Evas_Object *edje = data;
edje_object_signal_emit(edje, "hide", "toolbar_event");
return EINA_TRUE;
}
void
auto_hide_toolbar(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Ecore_Timer *timer;
timer = ecore_timer_add(5, _toolbar_hide, obj);
}

View File

@ -9,7 +9,7 @@
* Rotating the scroller is not correct and was rejected by Raster and others. * Rotating the scroller is not correct and was rejected by Raster and others.
*/ */
#define ROTATION 1 #define ROTATION 1
#define HORIZONTAL 0
#define ZOOM_STEP 0.2 #define ZOOM_STEP 0.2
typedef struct _Ephoto_Single_Browser Ephoto_Single_Browser; typedef struct _Ephoto_Single_Browser Ephoto_Single_Browser;
@ -436,11 +436,11 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
const char *bname = ecore_file_file_get(sb->entry->path); const char *bname = ecore_file_file_get(sb->entry->path);
sb->viewer = _viewer_add(sb->layout, sb->entry->path); sb->viewer = _viewer_add(sb->layout, sb->entry->path);
elm_layout_content_set elm_layout_content_set
(sb->layout, "elm.swallow.content", sb->viewer); (sb->layout, "ephoto.content.swallow", sb->viewer);
evas_object_show(sb->viewer); evas_object_show(sb->viewer);
evas_object_event_callback_add evas_object_event_callback_add
(sb->viewer, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb); (sb->viewer, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb);
edje_object_part_text_set(sb->edje, "elm.text.title", bname); // edje_object_part_text_set(sb->edje, "elm.text.title", bname);
ephoto_title_set(sb->ephoto, bname);; ephoto_title_set(sb->ephoto, bname);;
} }
@ -775,7 +775,7 @@ _ephoto_single_entry_create(void *data, int type __UNUSED__, void *event __UNUSE
Evas_Object * Evas_Object *
ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
{ {
Evas_Object *layout = elm_layout_add(parent), *button; Evas_Object *layout = elm_layout_add(parent);
Ephoto_Single_Browser *sb; Ephoto_Single_Browser *sb;
EINA_SAFETY_ON_NULL_RETURN_VAL(layout, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(layout, NULL);
@ -789,28 +789,23 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_event_callback_add evas_object_event_callback_add
(layout, EVAS_CALLBACK_KEY_DOWN, _key_down, sb); (layout, EVAS_CALLBACK_KEY_DOWN, _key_down, sb);
evas_object_data_set(layout, "single_browser", sb); evas_object_data_set(layout, "single_browser", sb);
edje_object_signal_callback_add
(sb->edje, "mouse,clicked,1", "toolbar_event", auto_hide_toolbar, sb->ephoto);
if (!elm_layout_theme_set if (!elm_layout_file_set
(layout, "layout", "application", "toolbar-content-back")) (layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
"ephoto/layout/simple/autohide"))
{ {
ERR("could not load style 'toolbar-content-back' from theme"); ERR("could not load style 'ephoto/layout/simple/autohide' from theme");
goto error; goto error;
} }
/*TODO This is hack. Better Idea?*/
button = edje_object_part_external_object_get(sb->edje, "back");
evas_object_del(button);
sb->toolbar = edje_object_part_external_object_get sb->toolbar = elm_toolbar_add(sb->layout);
(sb->edje, "elm.external.toolbar");
if (!sb->toolbar)
{
ERR("no toolbar in layout!");
goto error;
}
elm_toolbar_homogenous_set(sb->toolbar, EINA_FALSE); elm_toolbar_homogenous_set(sb->toolbar, EINA_FALSE);
elm_toolbar_mode_shrink_set(sb->toolbar, ELM_TOOLBAR_SHRINK_MENU); elm_toolbar_mode_shrink_set(sb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
elm_toolbar_menu_parent_set(sb->toolbar, parent); elm_toolbar_menu_parent_set(sb->toolbar, parent);
evas_object_size_hint_weight_set(sb->toolbar, 0.0, 0.0);
evas_object_size_hint_align_set(sb->toolbar, EVAS_HINT_FILL, 0.0);
sb->action.back = _toolbar_item_add sb->action.back = _toolbar_item_add
(sb, "edit-undo", "Back", 200, _back); (sb, "edit-undo", "Back", 200, _back);
@ -863,6 +858,10 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
_ephoto_single_browser_toolbar_eval(sb); _ephoto_single_browser_toolbar_eval(sb);
elm_layout_content_set
(sb->layout, "ephoto.toolbar.swallow", sb->toolbar);
evas_object_show(sb->toolbar);
sb->handlers = eina_list_append sb->handlers = eina_list_append
(sb->handlers, ecore_event_handler_add (sb->handlers, ecore_event_handler_add
(EPHOTO_EVENT_POPULATE_END, _ephoto_single_populate_end, sb)); (EPHOTO_EVENT_POPULATE_END, _ephoto_single_populate_end, sb));

View File

@ -14,6 +14,7 @@ struct _Ephoto_Thumb_Browser
{ {
Ephoto *ephoto; Ephoto *ephoto;
Evas_Object *layout; Evas_Object *layout;
Evas_Object *box;
Evas_Object *edje; Evas_Object *edje;
Evas_Object *fsel; Evas_Object *fsel;
Evas_Object *grid; Evas_Object *grid;
@ -444,24 +445,23 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_event_callback_add evas_object_event_callback_add
(layout, EVAS_CALLBACK_KEY_DOWN, _key_down, tb); (layout, EVAS_CALLBACK_KEY_DOWN, _key_down, tb);
evas_object_data_set(layout, "thumb_browser", tb); evas_object_data_set(layout, "thumb_browser", tb);
edje_object_signal_callback_add
(tb->edje, "mouse,clicked,1", "toolbar_event", auto_hide_toolbar, tb->ephoto);
if (!elm_layout_theme_set if (!elm_layout_file_set
(layout, "layout", "application", "toolbar-vbox")) (layout, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
"ephoto/layout/simple/autohide"))
{ {
ERR("could not load style 'toolbar-vbox' from theme"); ERR("could not load style 'ephoto/layout/simple' from theme");
goto error; goto error;
} }
tb->toolbar = edje_object_part_external_object_get tb->toolbar = elm_toolbar_add(tb->layout);
(tb->edje, "elm.external.toolbar");
if (!tb->toolbar)
{
ERR("no toolbar in layout!");
goto error;
}
elm_toolbar_homogenous_set(tb->toolbar, EINA_FALSE); elm_toolbar_homogenous_set(tb->toolbar, EINA_FALSE);
elm_toolbar_mode_shrink_set(tb->toolbar, ELM_TOOLBAR_SHRINK_MENU); elm_toolbar_mode_shrink_set(tb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
elm_toolbar_menu_parent_set(tb->toolbar, parent); elm_toolbar_menu_parent_set(tb->toolbar, parent);
evas_object_size_hint_weight_set(tb->toolbar, 0.0, 0.0);
evas_object_size_hint_align_set(tb->toolbar, EVAS_HINT_FILL, 0.0);
tb->action.flow = _toolbar_item_add tb->action.flow = _toolbar_item_add
(tb, "image", "Flow", 120, _flow); (tb, "image", "Flow", 120, _flow);
@ -474,6 +474,17 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
tb->action.view_single = _toolbar_item_add tb->action.view_single = _toolbar_item_add
(tb, "image", "Single", 50, _view_single); (tb, "image", "Single", 50, _view_single);
elm_layout_content_set
(tb->layout, "ephoto.toolbar.swallow", tb->toolbar);
evas_object_show(tb->toolbar);
tb->box = elm_box_add(tb->layout);
elm_box_horizontal_set(tb->box, EINA_FALSE);
elm_box_homogenous_set(tb->box, EINA_FALSE);
evas_object_size_hint_weight_set
(tb->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(tb->box);
tb->fsel = elm_fileselector_entry_add(layout); tb->fsel = elm_fileselector_entry_add(layout);
EINA_SAFETY_ON_NULL_GOTO(tb->fsel, error); EINA_SAFETY_ON_NULL_GOTO(tb->fsel, error);
evas_object_size_hint_weight_set(tb->fsel, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(tb->fsel, EVAS_HINT_EXPAND, 0.0);
@ -484,9 +495,8 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
(tb->fsel, "file,chosen", _changed_dir, tb); (tb->fsel, "file,chosen", _changed_dir, tb);
evas_object_smart_callback_add evas_object_smart_callback_add
(tb->fsel, "activated", _changed_dir_text, tb); (tb->fsel, "activated", _changed_dir_text, tb);
evas_object_show(tb->fsel); evas_object_show(tb->fsel);
elm_layout_box_append(layout, "elm.box.content", tb->fsel); elm_box_pack_end(tb->box, tb->fsel);
tb->overlay = elm_layout_add(layout); tb->overlay = elm_layout_add(layout);
elm_layout_file_set elm_layout_file_set
@ -500,8 +510,8 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
(elm_layout_edje_get(tb->overlay), "ephoto.signal.up", "ephoto", (elm_layout_edje_get(tb->overlay), "ephoto.signal.up", "ephoto",
_ephoto_up_clicked, tb); _ephoto_up_clicked, tb);
evas_object_show(tb->overlay); evas_object_show(tb->overlay);
elm_layout_box_append(tb->layout, "elm.box.content", tb->overlay); elm_box_pack_end(tb->box, tb->overlay);
tb->grid = elm_gengrid_add(tb->overlay); tb->grid = elm_gengrid_add(tb->overlay);
EINA_SAFETY_ON_NULL_GOTO(tb->grid, error); EINA_SAFETY_ON_NULL_GOTO(tb->grid, error);
elm_gengrid_align_set(tb->grid, 0.5, 0.5); elm_gengrid_align_set(tb->grid, 0.5, 0.5);
@ -517,6 +527,8 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_layout_content_set elm_layout_content_set
(tb->overlay, "ephoto.swallow.content.thumb", tb->grid); (tb->overlay, "ephoto.swallow.content.thumb", tb->grid);
elm_layout_content_set(tb->layout, "ephoto.content.swallow", tb->box);
tb->handlers = eina_list_append tb->handlers = eina_list_append
(tb->handlers, ecore_event_handler_add (tb->handlers, ecore_event_handler_add
(EPHOTO_EVENT_POPULATE_START, _ephoto_thumb_populate_start, tb)); (EPHOTO_EVENT_POPULATE_START, _ephoto_thumb_populate_start, tb));