implement zoom in and out
This commit is contained in:
parent
485ff4e395
commit
36023b5c7a
|
@ -57,6 +57,8 @@ rotation clockwise| Ctrl-r
|
||||||
rotation counter-clockwise | Ctrl-Alt-r
|
rotation counter-clockwise | Ctrl-Alt-r
|
||||||
Original size | Ctrl-0
|
Original size | Ctrl-0
|
||||||
Best fit | f
|
Best fit | f
|
||||||
|
Zoom in | +
|
||||||
|
Zoom out | -
|
||||||
Open Settings | s
|
Open Settings | s
|
||||||
Copy file name in clipboard | Ctrl-c
|
Copy file name in clipboard | Ctrl-c
|
||||||
Exit Settings | Esc
|
Exit Settings | Esc
|
||||||
|
|
|
@ -107,7 +107,8 @@ _cb_image_zoomin(void *win, Evas_Object *obj EINA_UNUSED, const char *emission E
|
||||||
Entice *entice;
|
Entice *entice;
|
||||||
|
|
||||||
entice = evas_object_data_get(win, "entice");
|
entice = evas_object_data_get(win, "entice");
|
||||||
//entice_image_rotate(entice->image, 1);
|
entice_image_zoom_increase(entice->image);
|
||||||
|
entice_image_update(entice->image);
|
||||||
printf("zoom in \n");
|
printf("zoom in \n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,8 @@ _cb_image_zoomout(void *win, Evas_Object *obj EINA_UNUSED, const char *emission
|
||||||
Entice *entice;
|
Entice *entice;
|
||||||
|
|
||||||
entice = evas_object_data_get(win, "entice");
|
entice = evas_object_data_get(win, "entice");
|
||||||
//entice_image_rotate(entice->image, 1);
|
entice_image_zoom_decrease(entice->image);
|
||||||
|
entice_image_update(entice->image);
|
||||||
printf("zoom out \n");
|
printf("zoom out \n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,6 +454,46 @@ int entice_image_zoom_get(Evas_Object *obj)
|
||||||
return sd->zoom;
|
return sd->zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entice_image_zoom_increase(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Img *sd;
|
||||||
|
size_t l;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
|
l = sizeof(_zoom_levels) / sizeof(int);
|
||||||
|
for (size_t i = 0; i < (l - 1); i++)
|
||||||
|
{
|
||||||
|
if ((_zoom_levels[i] <= sd->zoom) && (sd->zoom < _zoom_levels[i + 1]))
|
||||||
|
{
|
||||||
|
entice_image_zoom_set(obj, _zoom_levels[i + 1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
entice_image_zoom_decrease(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Img *sd;
|
||||||
|
size_t l;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
|
l = sizeof(_zoom_levels) / sizeof(int);
|
||||||
|
for (size_t i = (l - 1); i > 0; i--)
|
||||||
|
{
|
||||||
|
if ((_zoom_levels[i - 1] < sd->zoom) && (sd->zoom <= _zoom_levels[i]))
|
||||||
|
{
|
||||||
|
entice_image_zoom_set(obj, _zoom_levels[i - 1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
entice_image_update(Evas_Object *obj)
|
entice_image_update(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,10 @@ void entice_image_zoom_set(Evas_Object *obj, int zoom);
|
||||||
|
|
||||||
int entice_image_zoom_get(Evas_Object *obj);
|
int entice_image_zoom_get(Evas_Object *obj);
|
||||||
|
|
||||||
|
void entice_image_zoom_increase(Evas_Object *obj);
|
||||||
|
|
||||||
|
void entice_image_zoom_decrease(Evas_Object *obj);
|
||||||
|
|
||||||
void entice_image_update(Evas_Object *obj);
|
void entice_image_update(Evas_Object *obj);
|
||||||
|
|
||||||
#endif /* ENTICE_IMAGE_H */
|
#endif /* ENTICE_IMAGE_H */
|
||||||
|
|
|
@ -88,6 +88,16 @@ void entice_key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
|
||||||
entice_image_set(entice->image, prev);
|
entice_image_set(entice->image, prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(ev->key, "plus"))
|
||||||
|
{
|
||||||
|
entice_image_zoom_increase(entice->image);
|
||||||
|
entice_image_update(entice->image);
|
||||||
|
}
|
||||||
|
else if (!strcmp(ev->key, "minus"))
|
||||||
|
{
|
||||||
|
entice_image_zoom_decrease(entice->image);
|
||||||
|
entice_image_update(entice->image);
|
||||||
|
}
|
||||||
else if (!strcmp(ev->keyname, "f"))
|
else if (!strcmp(ev->keyname, "f"))
|
||||||
{
|
{
|
||||||
entice_image_zoom_mode_set(entice->image, ENTICE_ZOOM_MODE_FIT);
|
entice_image_zoom_mode_set(entice->image, ENTICE_ZOOM_MODE_FIT);
|
||||||
|
|
Loading…
Reference in New Issue