summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-05-18 11:28:47 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-05-18 12:56:14 +0900
commitc124534a5e59bb2a90a7ee39215c6dd9e0dd76f0 (patch)
tree8a5a6ea846d59c6458482a7d4b85e8e1c2afd04d
parent12260dabb9db574be460e12e8e9c343de576f413 (diff)
downloadefl-c124534a5e59bb2a90a7ee39215c6dd9e0dd76f0.tar.gz
photocam: move zoom related APIs to Efl.Ui.Zoomable
Signed-off-by: Amitesh Singh <amitesh.sh@samsung.com>
-rw-r--r--src/lib/elementary/elm_photocam.c40
-rw-r--r--src/lib/elementary/elm_photocam.eo88
-rw-r--r--src/lib/elementary/elm_photocam_legacy.h72
-rw-r--r--src/lib/evas/canvas/efl_ui_zoomable.eo89
4 files changed, 196 insertions, 93 deletions
diff --git a/src/lib/elementary/elm_photocam.c b/src/lib/elementary/elm_photocam.c
index fd62c800e4..5438a30e49 100644
--- a/src/lib/elementary/elm_photocam.c
+++ b/src/lib/elementary/elm_photocam.c
@@ -1877,7 +1877,7 @@ elm_photocam_file_get(const Elm_Photocam *obj)
}
EOLIAN static void
-_elm_photocam_zoom_set(Eo *obj, Elm_Photocam_Data *sd, double zoom)
+_elm_photocam_efl_ui_zoomable_zoom_set(Eo *obj, Elm_Photocam_Data *sd, double zoom)
{
double z;
Eina_List *l;
@@ -2104,13 +2104,13 @@ done:
}
EOLIAN static double
-_elm_photocam_zoom_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
+_elm_photocam_efl_ui_zoomable_zoom_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
{
return sd->zoom;
}
EOLIAN static void
-_elm_photocam_zoom_mode_set(Eo *obj, Elm_Photocam_Data *sd, Elm_Photocam_Zoom_Mode mode)
+_elm_photocam_efl_ui_zoomable_zoom_mode_set(Eo *obj, Elm_Photocam_Data *sd, Elm_Photocam_Zoom_Mode mode)
{
double tz;
if (sd->mode == mode) return;
@@ -2122,7 +2122,7 @@ _elm_photocam_zoom_mode_set(Eo *obj, Elm_Photocam_Data *sd, Elm_Photocam_Zoom_Mo
}
EOLIAN static Elm_Photocam_Zoom_Mode
-_elm_photocam_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
+_elm_photocam_efl_ui_zoomable_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
{
return sd->mode;
}
@@ -2245,7 +2245,7 @@ _elm_photocam_elm_interface_scrollable_region_bring_in(Eo *obj, Elm_Photocam_Dat
}
EOLIAN static void
-_elm_photocam_zoom_animation_set(Eo *obj, Elm_Photocam_Data *sd, Eina_Bool paused)
+_elm_photocam_efl_ui_zoomable_zoom_animation_set(Eo *obj, Elm_Photocam_Data *sd, Eina_Bool paused)
{
paused = !!paused;
@@ -2258,7 +2258,7 @@ _elm_photocam_zoom_animation_set(Eo *obj, Elm_Photocam_Data *sd, Eina_Bool pause
}
EOLIAN static Eina_Bool
-_elm_photocam_zoom_animation_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
+_elm_photocam_efl_ui_zoomable_zoom_animation_get(Eo *obj EINA_UNUSED, Elm_Photocam_Data *sd)
{
return sd->paused;
}
@@ -2470,11 +2470,35 @@ elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
EAPI Eina_Bool
elm_photocam_paused_get(const Evas_Object *obj)
{
- return elm_obj_photocam_zoom_animation_get(obj);
+ return efl_ui_zoom_animation_get(obj);
}
EAPI void
elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
{
- elm_obj_photocam_zoom_animation_set(obj, paused);
+ efl_ui_zoom_animation_set(obj, paused);
+}
+
+EAPI void
+elm_photocam_zoom_set(Evas_Object *obj, double zoom)
+{
+ efl_ui_zoom_set(obj, zoom);
+}
+
+EAPI double
+elm_photocam_zoom_get(const Evas_Object *obj)
+{
+ return efl_ui_zoom_get(obj);
+}
+
+EAPI void
+elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
+{
+ efl_ui_zoom_mode_set(obj, mode);
+}
+
+EAPI Elm_Photocam_Zoom_Mode
+elm_photocam_zoom_mode_get(const Evas_Object *obj)
+{
+ return efl_ui_zoom_mode_get(obj);
}
diff --git a/src/lib/elementary/elm_photocam.eo b/src/lib/elementary/elm_photocam.eo
index f27d595f8d..9349d794ba 100644
--- a/src/lib/elementary/elm_photocam.eo
+++ b/src/lib/elementary/elm_photocam.eo
@@ -1,13 +1,3 @@
-enum Elm.Photocam.Zoom_Mode
-{
- [[Types of zoom available.]]
- manual = 0, [[Zoom controlled normally by elm_photocam_zoom_set]]
- auto_fit, [[Zoom until photo fits in photocam]]
- auto_fill, [[Zoom until photo fills photocam]]
- auto_fit_in, [[Zoom in until photo fits in photocam]]
- last [[Sentinel value to indicate last enum field during iteration]]
-}
-
class Elm.Photocam (Elm.Widget, Elm.Interface_Scrollable,
Elm.Interface.Atspi_Widget_Action, Efl.File,
Efl.Ui.Clickable, Efl.Ui.Scrollable, Efl.Gfx.View,
@@ -18,26 +8,6 @@ class Elm.Photocam (Elm.Widget, Elm.Interface_Scrollable,
eo_prefix: elm_obj_photocam;
event_prefix: elm_photocam;
methods {
- @property zoom_animation {
- set {
- [[Enable zoom animation
-
- This sets the zoom animation state to on or off for photocam. The
- default is off. This will stop zooming using animation on
- zoom level changes and change instantly. This will stop any
- existing animations that are running.
- ]]
- }
- get {
- [[Disable zoom animation
-
- This gets the current zoom animation state for the photocam object.
- ]]
- }
- values {
- paused: bool; [[The pause state.]]
- }
- }
@property gesture_enabled {
set {
[[Set the gesture state for photocam.
@@ -56,61 +26,6 @@ class Elm.Photocam (Elm.Widget, Elm.Interface_Scrollable,
gesture: bool; [[The gesture state.]]
}
}
- @property zoom {
- set {
- [[Set the zoom level of the photo
-
- This sets the zoom level. If $zoom is 1, it means no zoom. If
- it's smaller than 1, it means zoom in. If it's bigger than 1,
- it means zoom out. For example, $zoom 1 will be 1:1 pixel for
- pixel. $zoom 2 will be 2:1 (that is 2x2 photo pixels will
- display as 1 on-screen pixel) which is a zoom out. 4:1 will
- be 4x4 photo pixels as 1 screen pixel, and so on. The $zoom
- parameter must be greater than 0. It is suggested to stick
- to powers of 2. (1, 2, 4, 8, 16, 32, etc.).
- ]]
- }
- get {
- [[Get the zoom level of the photo
-
- This returns the current zoom level of the photocam object.
- Note that if you set the fill mode to other than
- #ELM_PHOTOCAM_ZOOM_MODE_MANUAL (which is the default), the
- zoom level may be changed at any time by the photocam object
- itself to account for photo size and photocam viewport size.
- ]]
- }
- values {
- zoom: double; [[The zoom level to set]]
- }
- }
- @property zoom_mode {
- set {
- [[Set the zoom mode
-
- This sets the zoom mode to manual or one of several automatic
- levels. Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom
- is set manually by @.zoom.set and will stay at that level until
- changed by code or until zoom mode is changed. This is the
- default mode. The Automatic modes will allow the photocam object
- to automatically adjust zoom mode based on properties.
-
- #ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will adjust zoom so the photo
- fits EXACTLY inside the scroll frame with no pixels outside this
- region. #ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but
- ensure no pixels within the frame are left unfilled.
- ]]
- }
- get {
- [[Get the zoom mode
-
- This gets the current zoom mode of the photocam object.
- ]]
- }
- values {
- mode: Elm.Photocam.Zoom_Mode; [[The zoom mode.]]
- }
- }
@property image_region {
get {
[[Get the region of the image that is currently shown
@@ -138,6 +53,9 @@ class Elm.Photocam (Elm.Widget, Elm.Interface_Scrollable,
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }
Efl.Gfx.View.view_size { get; }
+ Efl.Ui.Zoomable.zoom_animation { set; get; }
+ Efl.Ui.Zoomable.zoom { set; get; }
+ Efl.Ui.Zoomable.zoom_mode { set; get; }
Efl.Canvas.Group.group_add;
Efl.Canvas.Group.group_del;
Efl.Canvas.Group.group_member_add;
diff --git a/src/lib/elementary/elm_photocam_legacy.h b/src/lib/elementary/elm_photocam_legacy.h
index 2ea43e0ffe..9ae4919339 100644
--- a/src/lib/elementary/elm_photocam_legacy.h
+++ b/src/lib/elementary/elm_photocam_legacy.h
@@ -145,4 +145,76 @@ EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj);
*/
EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused);
+/**
+ * @brief Set the zoom level of the photo
+ *
+ * This sets the zoom level. If @c zoom is 1, it means no zoom. If it's smaller
+ * than 1, it means zoom in. If it's bigger than 1, it means zoom out. For
+ * example, @c zoom 1 will be 1:1 pixel for pixel. @c zoom 2 will be 2:1 (that
+ * is 2x2 photo pixels will display as 1 on-screen pixel) which is a zoom out.
+ * 4:1 will be 4x4 photo pixels as 1 screen pixel, and so on. The @c zoom
+ * parameter must be greater than 0. It is suggested to stick to powers of 2.
+ * (1, 2, 4, 8, 16, 32, etc.).
+ *
+ * @param[in] zoom The zoom level to set
+ *
+ * @ingroup Elm_Photocam
+ */
+EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom);
+
+/**
+ * @brief Get the zoom level of the photo
+ *
+ * This returns the current zoom level of the photocam object. Note that if you
+ * set the fill mode to other than #ELM_PHOTOCAM_ZOOM_MODE_MANUAL (which is the
+ * default), the zoom level may be changed at any time by the photocam object
+ * itself to account for photo size and photocam viewport size.
+ *
+ * @return The zoom level to set
+ *
+ * @ingroup Elm_Photocam
+ */
+EAPI double elm_photocam_zoom_get(const Evas_Object *obj);
+
+typedef Efl_Ui_Zoom_Mode Elm_Photocam_Zoom_Mode;
+
+#define ELM_PHOTOCAM_ZOOM_MODE_MANUAL EFL_UI_ZOOM_MODE_MANUAL
+#define ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT EFL_UI_ZOOM_MODE_AUTO_FIT
+#define ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL EFL_UI_ZOOM_MODE_AUTO_FILL
+#define ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN EFL_UI_ZOOM_MODE_AUTO_FIT_IN
+#define ELM_PHOTOCAM_ZOOM_MODE_LAST EFL_UI_ZOOM_MODE_LAST
+
+/**
+ * @brief Set the zoom mode
+ *
+ * This sets the zoom mode to manual or one of several automatic levels. Manual
+ * (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
+ * @ref elm_photocam_zoom_mode_set and will stay at that level until changed by
+ * code or until zoom mode is changed. This is the default mode. The Automatic
+ * modes will allow the photocam object to automatically adjust zoom mode based
+ * on properties.
+ *
+ * #ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will adjust zoom so the photo fits EXACTLY
+ * inside the scroll frame with no pixels outside this region.
+ * #ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but ensure no pixels
+ * within the frame are left unfilled.
+ *
+ * @param[in] mode The zoom mode.
+ *
+ * @ingroup Elm_Photocam
+ */
+EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode);
+
+/**
+ * @brief Get the zoom mode
+ *
+ * This gets the current zoom mode of the photocam object.
+ *
+ * @return The zoom mode.
+ *
+ * @ingroup Elm_Photocam
+ */
+EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj);
+
+
#include "elm_photocam.eo.legacy.h"
diff --git a/src/lib/evas/canvas/efl_ui_zoomable.eo b/src/lib/evas/canvas/efl_ui_zoomable.eo
index ae315c6639..474340de26 100644
--- a/src/lib/evas/canvas/efl_ui_zoomable.eo
+++ b/src/lib/evas/canvas/efl_ui_zoomable.eo
@@ -1,7 +1,96 @@
+enum Efl.Ui.Zoom_Mode
+{
+ [[Types of zoom available.]]
+ manual = 0, [[Zoom controlled normally by efl_ui_zoom_set]]
+ auto_fit, [[Zoom until photo fits in zoomable object]]
+ auto_fill, [[Zoom until photo fills zoomable object]]
+ auto_fit_in, [[Zoom in until photo fits in zoomable object]]
+ last [[Sentinel value to indicate last enum field during iteration]]
+}
+
interface Efl.Ui.Zoomable ()
{
[[Efl UI zoomable interface]]
event_prefix: efl_ui;
+ eo_prefix: efl_ui;
+
+ methods {
+ @property zoom_animation {
+ set {
+ [[Enable zoom animation
+
+ This sets the zoom animation state to on or off for zoomable. The
+ default is off. This will stop zooming using animation on
+ zoom level changes and change instantly. This will stop any
+ existing animations that are running.
+ ]]
+ }
+ get {
+ [[Disable zoom animation
+
+ This gets the current zoom animation state for the zoomable object.
+ ]]
+ }
+ values {
+ paused: bool; [[The pause state.]]
+ }
+ }
+ @property zoom {
+ set {
+ [[Set the zoom level of the photo
+
+ This sets the zoom level. If $zoom is 1, it means no zoom. If
+ it's smaller than 1, it means zoom in. If it's bigger than 1,
+ it means zoom out. For example, $zoom 1 will be 1:1 pixel for
+ pixel. $zoom 2 will be 2:1 (that is 2x2 photo pixels will
+ display as 1 on-screen pixel) which is a zoom out. 4:1 will
+ be 4x4 photo pixels as 1 screen pixel, and so on. The $zoom
+ parameter must be greater than 0. It is suggested to stick
+ to powers of 2. (1, 2, 4, 8, 16, 32, etc.).
+ ]]
+ }
+ get {
+ [[Get the zoom level of the photo
+
+ This returns the current zoom level of the zoomable object.
+ Note that if you set the fill mode to other than
+ #EFL_UI_ZOOM_MODE_MANUAL (which is the default), the
+ zoom level may be changed at any time by the zoomable object
+ itself to account for photo size and zoomable viewport size.
+ ]]
+ }
+ values {
+ zoom: double; [[The zoom level to set]]
+ }
+ }
+ @property zoom_mode {
+ set {
+ [[Set the zoom mode
+
+ This sets the zoom mode to manual or one of several automatic
+ levels. Manual (EFL_UI_ZOOM_MODE_MANUAL) means that zoom
+ is set manually by @.zoom.set and will stay at that level until
+ changed by code or until zoom mode is changed. This is the
+ default mode. The Automatic modes will allow the zoomable object
+ to automatically adjust zoom mode based on properties.
+
+ #EFL_UI_ZOOM_MODE_AUTO_FIT) will adjust zoom so the photo
+ fits EXACTLY inside the scroll frame with no pixels outside this
+ region. #EFL_UI_ZOOM_MODE_AUTO_FILL will be similar but
+ ensure no pixels within the frame are left unfilled.
+ ]]
+ }
+ get {
+ [[Get the zoom mode
+
+ This gets the current zoom mode of the zoomable object.
+ ]]
+ }
+ values {
+ mode: Efl.Ui.Zoom_Mode; [[The zoom mode.]]
+ }
+ }
+ }
events {
zoom,start; [[Called when zooming started]]
zoom,stop; [[Called when zooming stopped]]