Single browser should be black, also, center images in the single browser.

SVN revision: 59534
This commit is contained in:
Stephen Houston 2011-05-19 12:47:07 +00:00
parent be7bd64574
commit 6d7f1def6e
3 changed files with 32 additions and 3 deletions

View File

@ -106,6 +106,7 @@ struct _Ephoto
{
Evas_Object *win;
Evas_Object *bg;
Evas_Object *overlay;
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *pager;

View File

@ -39,6 +39,7 @@ static void
_win_free(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto *ephoto = data;
evas_object_del(ephoto->overlay);
if (ephoto->timer.thumb_regen) ecore_timer_del(ephoto->timer.thumb_regen);
free(ephoto);
}
@ -91,6 +92,15 @@ ephoto_window_add(const char *path)
elm_win_resize_object_add(ephoto->win, ephoto->bg);
evas_object_show(ephoto->bg);
ephoto->overlay = elm_bg_add(ephoto->bg);
evas_object_size_hint_weight_set
(ephoto->overlay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(ephoto->overlay, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_bg_color_set(ephoto->overlay, 0, 0, 0);
elm_win_resize_object_add(ephoto->win, ephoto->bg);
evas_object_show(ephoto->bg);
ephoto->layout = elm_layout_add(ephoto->win);
if (!ephoto->layout)
{
@ -222,6 +232,11 @@ ephoto_promote_list_browser(Ephoto *ephoto)
void
ephoto_promote_thumb_browser(Ephoto *ephoto)
{
if (elm_bg_overlay_get(ephoto->bg))
{
evas_object_hide(ephoto->overlay);
elm_bg_overlay_unset(ephoto->bg);
}
elm_pager_content_promote(ephoto->pager, ephoto->thumb_browser);
edje_object_signal_emit(ephoto->edje, "elm,back,show", "elm");
_ephoto_state_set(ephoto, EPHOTO_STATE_THUMB);
@ -231,6 +246,7 @@ void
ephoto_promote_single_browser(Ephoto *ephoto, Ephoto_Entry *e)
{
elm_pager_content_promote(ephoto->pager, ephoto->single_browser);
elm_bg_overlay_set(ephoto->bg, ephoto->overlay);
if (e)
ephoto_single_browser_entry_set(ephoto->single_browser, e);
_ephoto_state_set(ephoto, EPHOTO_STATE_SINGLE);

View File

@ -30,6 +30,7 @@ struct _Ephoto_Single_Browser
struct _Ephoto_Viewer
{
Evas_Object *scroller;
Evas_Object *box;
Evas_Object *image;
double zoom;
Eina_Bool fit:1;
@ -53,6 +54,12 @@ _viewer_add(Evas_Object *parent, const char *path)
EINA_SAFETY_ON_NULL_RETURN_VAL(v, NULL);
obj = v->scroller = elm_scroller_add(parent);
EINA_SAFETY_ON_NULL_GOTO(obj, error);
v->box = elm_box_add(obj);
evas_object_size_hint_weight_set(v->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(v->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(v->box);
v->image = evas_object_image_filled_add(evas_object_evas_get(parent));
evas_object_image_file_set(v->image, path, NULL);
err = evas_object_image_load_error_get(v->image);
@ -64,7 +71,8 @@ _viewer_add(Evas_Object *parent, const char *path)
evas_object_size_hint_max_set(v->image, w, h);
evas_object_resize(v->image, w, h);
evas_object_show(v->image);
elm_scroller_content_set(obj, v->image);
elm_box_pack_end(v->box, v->image);
elm_scroller_content_set(obj, v->box);
evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_data_set(obj, "viewer", v);
@ -88,8 +96,12 @@ _viewer_zoom_apply(Ephoto_Viewer *v, double zoom)
evas_object_image_size_get(v->image, &w, &h);
w *= zoom;
h *= zoom;
evas_object_size_hint_min_set(v->image, w, h);
evas_object_size_hint_max_set(v->image, w, h);
evas_object_size_hint_min_set(v->image, w-10, h-10);
evas_object_size_hint_max_set(v->image, w-10, h-10);
elm_box_unpack(v->box, v->image);
elm_scroller_content_unset(v->scroller);
elm_box_pack_end(v->box, v->image);
elm_scroller_content_set(v->scroller, v->box);
}
static void