Ephoto: Fix orient handling with regards to undo/redo

This commit is contained in:
Stephen Houston 2016-10-11 09:36:19 -05:00
parent 9f8024bae5
commit af63586365
1 changed files with 50 additions and 39 deletions

View File

@ -71,6 +71,7 @@ static void _ephoto_main_back(void *data, Evas_Object *obj EINA_UNUSED,
static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _next_entry(Ephoto_Single_Browser *sb);
static void _orient_apply(Ephoto_Single_Browser *sb);
/*Common*/
static const char *
@ -431,15 +432,11 @@ _viewer_zoom_fit(Evas_Object *obj)
}
static void
_orient_apply(Ephoto_Single_Browser *sb)
_orient_set(Ephoto_Single_Browser *sb, Ephoto_Orient orient)
{
Ephoto_History *eh = NULL;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
Evas_Coord w, h;
Eina_List *l;
char buf[PATH_MAX];
switch (sb->orient)
switch (orient)
{
case EPHOTO_ORIENT_0:
evas_object_image_orient_set(v->image, EVAS_IMAGE_ORIENT_NONE);
@ -476,9 +473,22 @@ _orient_apply(Ephoto_Single_Browser *sb)
default:
return;
}
}
static void
_orient_apply(Ephoto_Single_Browser *sb)
{
Ephoto_History *eh = NULL;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
Evas_Coord w, h;
Eina_List *l;
char buf[PATH_MAX];
_orient_set(sb, sb->orient);
elm_table_unpack(v->table, v->image);
elm_object_content_unset(v->scroller);
evas_object_image_size_get(v->image, &w, &h);
evas_object_image_data_update_add(v->image, 0, 0, w, h);
if (sb->history_pos < (eina_list_count(sb->history)-1))
{
int count;
@ -878,8 +888,9 @@ _undo_image(void *data, Evas_Object *obj EINA_UNUSED,
{
sb->history_pos--;
eh = eina_list_nth(sb->history, sb->history_pos);
evas_object_image_orient_set(v->image, eh->orient);
elm_table_unpack(v->table, v->image);
elm_object_content_unset(v->scroller);
_orient_set(sb, eh->orient);
evas_object_image_size_set(v->image, eh->w, eh->h);
evas_object_image_data_set(v->image, eh->im_data);
evas_object_image_data_update_add(v->image, 0, 0, eh->w, eh->h);
@ -910,9 +921,9 @@ _redo_image(void *data, Evas_Object *obj EINA_UNUSED,
{
sb->history_pos++;
eh = eina_list_nth(sb->history, sb->history_pos);
evas_object_image_orient_set(v->image, eh->orient);
elm_table_unpack(v->table, v->image);
elm_object_content_unset(v->scroller);
_orient_set(sb, eh->orient);
evas_object_image_size_set(v->image, eh->w, eh->h);
evas_object_image_data_set(v->image, eh->im_data);
evas_object_image_data_update_add(v->image, 0, 0, eh->w, eh->h);