begin to work on zoom

This commit is contained in:
Vincent Torri 2021-04-06 19:08:57 +02:00
parent afebf1f2aa
commit 686dfb71fc
2 changed files with 27 additions and 8 deletions

View File

@ -129,9 +129,7 @@ _cb_image_zoomorig(void *win, Evas_Object *obj EINA_UNUSED, const char *emission
Entice *entice;
entice = evas_object_data_get(win, "entice");
//entice_image_rotate(entice->image, 1);
printf("zoom 1:1 \n");
fflush(stdout);
entice_image_zoom(entice->image, 1.0);
}
static void
@ -140,9 +138,21 @@ _cb_image_zoomfit(void *win, Evas_Object *obj EINA_UNUSED, const char *emission
Entice *entice;
entice = evas_object_data_get(win, "entice");
//entice_image_rotate(entice->image, 1);
printf("zoom fit \n");
fflush(stdout);
entice_image_zoom_fit(entice->image);
}
static void
_cb_image_zoomcheck(void *win, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Entice *entice;
entice = evas_object_data_get(win, "entice");
if (elm_check_state_get(obj) == EINA_TRUE)
entice_image_zoom_fit(entice->image);
else
{
/* FIXME */
}
}
static void
@ -197,10 +207,14 @@ entice_controls_init(Evas_Object *win)
CONTROLS("go-previous", prev);
CONTROLS("go-next", next);
/* best fit checkbox */
o = elm_check_add(win);
elm_object_style_set(o, "default");
elm_object_focus_allow_set(o, EINA_FALSE);
evas_object_show(o);
entice->zoomcheck = o;
evas_object_smart_callback_add(entice->zoomcheck, "changed",
_cb_image_zoomcheck, win);
elm_object_part_content_set(entice->layout, "entice.zoomcheck", entice->zoomcheck);
@ -211,6 +225,7 @@ entice_controls_init(Evas_Object *win)
elm_object_text_set(o, "2000%");
elm_entry_single_line_set(o, EINA_TRUE);
//evas_object_smart_callback_add(o, "activated", _entry_activated_cb, NULL);
elm_object_focus_allow_set(o, EINA_FALSE);
evas_object_show(o);
entice->zoomval = o;

View File

@ -393,6 +393,9 @@ entice_image_zoom(Evas_Object *obj, double zoom)
elm_scroller_policy_set(entice->scroller,
ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
/* update controls */
elm_check_state_set(entice->zoomcheck, EINA_FALSE);
sd->is_fit = EINA_FALSE;
}
@ -408,7 +411,6 @@ entice_image_zoom_fit(Evas_Object *obj)
Evas_Coord ih;
Evas_Coord x;
Evas_Coord y;
Evas_Image_Orient orient;
sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN(sd);
@ -420,7 +422,6 @@ entice_image_zoom_fit(Evas_Object *obj)
EINA_SAFETY_ON_NULL_RETURN(win);
evas_object_geometry_get(win, NULL, NULL, &w, &h);
orient = evas_object_image_orient_get(sd->img);
evas_object_image_size_get(sd->img, &iw, &ih);
if ((w * ih) > (iw * h))
@ -453,5 +454,8 @@ entice_image_zoom_fit(Evas_Object *obj)
elm_scroller_policy_set(entice->scroller,
ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
/* update controls */
elm_check_state_set(entice->zoomcheck, EINA_TRUE);
sd->is_fit = EINA_TRUE;
}