summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile.am3
-rw-r--r--doc/examples.dox50
-rw-r--r--doc/index.doxy3
-rw-r--r--doc/widgets/Makefile.am4
-rw-r--r--doc/widgets/widget_preview_photocam.c10
-rw-r--r--src/examples/Makefile.am9
-rw-r--r--src/examples/photocam_example_01.c93
-rw-r--r--src/lib/Elementary.h.in241
-rw-r--r--src/lib/elm_photocam.c220
9 files changed, 388 insertions, 245 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index c689cbbe1..5ad98d8f0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -61,7 +61,8 @@ WGT_PREVIEW = \
61 progressbar:preview-00.png:widget_preview_progressbar:150:50 \ 61 progressbar:preview-00.png:widget_preview_progressbar:150:50 \
62 box:preview-00.png:widget_preview_box:200:160 \ 62 box:preview-00.png:widget_preview_box:200:160 \
63 notify:preview-00.png:widget_preview_notify:60:30 \ 63 notify:preview-00.png:widget_preview_notify:60:30 \
64 slideshow:preview-00.png:widget_preview_slideshow:50:50 64 slideshow:preview-00.png:widget_preview_slideshow:50:50 \
65 photocam:preview-00.png:widget_preview_photocam:243:162
65 66
66widget-build: 67widget-build:
67 @$(MAKE) -C widgets 68 @$(MAKE) -C widgets
diff --git a/doc/examples.dox b/doc/examples.dox
index 05ea48a2f..cb9d3705c 100644
--- a/doc/examples.dox
+++ b/doc/examples.dox
@@ -4714,6 +4714,56 @@
4714 */ 4714 */
4715 4715
4716/** 4716/**
4717 * @page tutorial_photocam Photocam example
4718 * @dontinclude photocam_example_01.c
4719 *
4720 * In this example we will have a photocam and a couple of buttons and slider to
4721 * control the photocam. To avoid cluttering we'll only show the parts of the
4722 * example that relate to the photocam, the full source code can be seen @ref
4723 * photocam_example_01.c "here".
4724 *
4725 * Creating a photocam is as easy as creating any other widget:
4726 * @skipline elm_photocam_add
4727 *
4728 * A photocam is only useful if we have a image on it, so lets set a file for it
4729 * to work with:
4730 * @until file_set
4731 *
4732 * We now set the photocam to not bounce horizontally:
4733 * @until bounce_set
4734 *
4735 * And we want to know when the photocam has finished loading the image so:
4736 * @until smart_callback
4737 *
4738 * The reason to know when the image is loaded is so that we can bring the
4739 * center of the image into view:
4740 * @skip static
4741 * @until }
4742 *
4743 * As mentioned we have 2 buttons in this example, the "Fit" one will cause
4744 * the photocam to go in to a zoom mode that makes the image fit inside the
4745 * photocam. Tough this has no effect on the image we also print what region was
4746 * being viewed before setting the zoom mode:
4747 * @until }
4748 * @note When in fit mode our slider(explained below) won't work.
4749 *
4750 * The second button("Unfit") will bring the photocam back into manual zoom
4751 * mode:
4752 * @until }
4753 *
4754 * Our slider controls the level of zoom of the photocam:
4755 * @until }
4756 * @note It is important to note that this only works when in manual zoom mode.
4757 *
4758 * Our example will initially look like this:
4759 *
4760 * @image html screenshots/photocam_example_01.png
4761 * @image latex screenshots/photocam_example_01.eps width=\textwidth
4762 *
4763 * @example photocam_example_01.c
4764 */
4765
4766/**
4717 * @page bg_example_01_c bg_example_01.c 4767 * @page bg_example_01_c bg_example_01.c
4718 * @include bg_example_01.c 4768 * @include bg_example_01.c
4719 * @example bg_example_01.c 4769 * @example bg_example_01.c
diff --git a/doc/index.doxy b/doc/index.doxy
index 6653292dd..62af37c78 100644
--- a/doc/index.doxy
+++ b/doc/index.doxy
@@ -155,6 +155,9 @@
155 * @image latex img/panes.eps 155 * @image latex img/panes.eps
156 * @li @ref Photo 156 * @li @ref Photo
157 * @li @ref Photocam 157 * @li @ref Photocam
158 *
159 * @image html img/widget/photocam/preview-00.png
160 * @image latex img/widget/photocam/preview-00.eps
158 * @li @ref Progressbar 161 * @li @ref Progressbar
159 * 162 *
160 * @image html img/widget/progressbar/preview-00.png 163 * @image html img/widget/progressbar/preview-00.png
diff --git a/doc/widgets/Makefile.am b/doc/widgets/Makefile.am
index 1b167c692..b71d07394 100644
--- a/doc/widgets/Makefile.am
+++ b/doc/widgets/Makefile.am
@@ -77,7 +77,8 @@ widget_preview_gengrid \
77widget_preview_progressbar \ 77widget_preview_progressbar \
78widget_preview_box \ 78widget_preview_box \
79widget_preview_notify \ 79widget_preview_notify \
80widget_preview_slideshow 80widget_preview_slideshow \
81widget_preview_photocam
81 82
82LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@ 83LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
83 84
@@ -136,5 +137,6 @@ EXTRA_DIST = \
136 widget_preview_box.c \ 137 widget_preview_box.c \
137 widget_preview_notify.c \ 138 widget_preview_notify.c \
138 widget_preview_slideshow.c \ 139 widget_preview_slideshow.c \
140 widget_preview_photocam.c \
139 widget_preview_tmpl_foot.c \ 141 widget_preview_tmpl_foot.c \
140 widget_preview_tmpl_head.c 142 widget_preview_tmpl_head.c
diff --git a/doc/widgets/widget_preview_photocam.c b/doc/widgets/widget_preview_photocam.c
new file mode 100644
index 000000000..29104cf3e
--- /dev/null
+++ b/doc/widgets/widget_preview_photocam.c
@@ -0,0 +1,10 @@
1#include "widget_preview_tmpl_head.c"
2
3Evas_Object *o = elm_photocam_add(win);
4elm_photocam_file_set(o, PACKAGE_DATA_DIR"/images/insanely_huge_test_image.jpg");
5elm_photocam_zoom_mode_set(o, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
6evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
7elm_win_resize_object_add(win, o);
8evas_object_show(o);
9
10#include "widget_preview_tmpl_foot.c"
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 6dc6f4e8a..a96fbdf4f 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -95,7 +95,8 @@ SRCS = \
95 entry_example.c \ 95 entry_example.c \
96 slideshow_example.c \ 96 slideshow_example.c \
97 progressbar_example.c \ 97 progressbar_example.c \
98 notify_example_01.c 98 notify_example_01.c \
99 photocam_example_01.c
99 100
100pkglib_PROGRAMS = 101pkglib_PROGRAMS =
101 102
@@ -180,7 +181,8 @@ pkglib_PROGRAMS += \
180 entry_example \ 181 entry_example \
181 slideshow_example \ 182 slideshow_example \
182 progressbar_example \ 183 progressbar_example \
183 notify_example_01 184 notify_example_01 \
185 photocam_example_01
184 186
185# This variable will hold the list of screenshots that will be made 187# This variable will hold the list of screenshots that will be made
186# by "make screenshots". Each item in the list is of the form: 188# by "make screenshots". Each item in the list is of the form:
@@ -238,7 +240,8 @@ SCREENSHOTS = \
238 progressbar_example:progressbar_example.png:0.0 \ 240 progressbar_example:progressbar_example.png:0.0 \
239 notify_example_01:notify_example_01.png:0.0 \ 241 notify_example_01:notify_example_01.png:0.0 \
240 notify_example_01:notify_example_01_a.png:6.0 \ 242 notify_example_01:notify_example_01_a.png:6.0 \
241 slideshow_example:slideshow_example.png:1.0 243 slideshow_example:slideshow_example.png:1.0 \
244 photocam_example_01:photocam_example_01.png:3
242 245
243HTML_SS_DIR=$(top_builddir)/doc/html/screenshots 246HTML_SS_DIR=$(top_builddir)/doc/html/screenshots
244LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots 247LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots
diff --git a/src/examples/photocam_example_01.c b/src/examples/photocam_example_01.c
new file mode 100644
index 000000000..9c08add68
--- /dev/null
+++ b/src/examples/photocam_example_01.c
@@ -0,0 +1,93 @@
1//Compile with:
2//gcc -g `pkg-config --cflags --libs elementary` -DPACKAGE_DATA_DIR="\"<directory>\"" photocam_example_01.c -o photocam_example_01
3
4#include <Elementary.h>
5#ifdef HAVE_CONFIG_H
6# include "elementary_config.h"
7#endif
8
9static void _fit(void *data, Evas_Object *obj, void *event_info);
10static void _unfit(void *data, Evas_Object *obj, void *event_info);
11static void _zoom(void *data, Evas_Object *obj, void *event_info);
12static void _bring_in(void *data, Evas_Object *obj, void *event_info);
13
14EAPI int
15elm_main(int argc, char **argv)
16{
17 Evas_Object *win, *bg, *bx, *obj, *photocam;
18
19 win = elm_win_add(NULL, "photocam", ELM_WIN_BASIC);
20 elm_win_title_set(win, "Photocam");
21 elm_win_autodel_set(win, EINA_TRUE);
22 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
23
24 bg = elm_bg_add(win);
25 elm_win_resize_object_add(win, bg);
26 evas_object_show(bg);
27
28 photocam = elm_photocam_add(win);
29 elm_photocam_file_set(photocam, PACKAGE_DATA_DIR"/images/insanely_huge_test_image.jpg");
30 elm_photocam_bounce_set(photocam, EINA_FALSE, EINA_TRUE);
31 evas_object_smart_callback_add(photocam, "loaded,detail", _bring_in, NULL);
32 evas_object_resize(photocam, 500, 400);
33 evas_object_show(photocam);
34
35 obj = elm_button_add(win);
36 elm_object_text_set(obj, "Fit");
37 evas_object_show(obj);
38 evas_object_resize(obj, 50, 30);
39 evas_object_move(obj, 10, 410);
40 evas_object_smart_callback_add(obj, "clicked", _fit, photocam);
41
42 obj = elm_button_add(win);
43 elm_object_text_set(obj, "Unfit");
44 evas_object_show(obj);
45 evas_object_resize(obj, 70, 30);
46 evas_object_move(obj, 70, 410);
47 evas_object_smart_callback_add(obj, "clicked", _unfit, photocam);
48
49 obj = elm_slider_add(win);
50 elm_object_text_set(obj, "Zoom");
51 evas_object_show(obj);
52 evas_object_resize(obj, 300, 30);
53 evas_object_move(obj, 150, 410);
54 evas_object_smart_callback_add(obj, "changed", _zoom, photocam);
55
56 evas_object_resize(win, 500, 440);
57 evas_object_show(win);
58
59 elm_run();
60
61 return 0;
62}
63ELM_MAIN()
64
65static void
66_bring_in(void *data, Evas_Object *obj, void *event_info)
67{
68 int w, h;
69 elm_photocam_image_size_get(obj, &w, &h);
70 elm_photocam_image_region_bring_in(obj, w/2, h/2, 500, 400);
71}
72
73static void
74_fit(void *data, Evas_Object *obj, void *event_info)
75{
76 int x, y, w, h;
77 elm_photocam_region_get(data, &x, &y, &w, &h);
78 printf("region: {%d, %d, %d, %d}\n", x, y, w, h);
79 elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
80}
81
82static void
83_unfit(void *data, Evas_Object *obj, void *event_info)
84{
85 elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
86}
87
88static void
89_zoom(void *data, Evas_Object *obj, void *event_info)
90{
91 double z = elm_slider_value_get(obj) * 8;
92 elm_photocam_zoom_set(data, z);
93}
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index af715f91a..65b1be284 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -14416,48 +14416,245 @@ extern "C" {
14416 * @} 14416 * @}
14417 */ 14417 */
14418 14418
14419 /* photocam */ 14419 /**
14420 * @defgroup Photocam Photocam
14421 *
14422 * @image html img/widget/photocam/preview-00.png
14423 * @image latex img/widget/photocam/preview-00.eps
14424 *
14425 * This is a widget specifically for displaying high-resolution digital
14426 * camera photos giving speedy feedback (fast load), low memory footprint
14427 * and zooming and panning as well as fitting logic. It is entirely focused
14428 * on jpeg images, and takes advantage of properties of the jpeg format (via
14429 * evas loader features in the jpeg loader).
14430 *
14431 * Signals that you can add callbacks for are:
14432 * @li "clicked" - This is called when a user has clicked the photo without
14433 * dragging around.
14434 * @li "press" - This is called when a user has pressed down on the photo.
14435 * @li "longpressed" - This is called when a user has pressed down on the
14436 * photo for a long time without dragging around.
14437 * @li "clicked,double" - This is called when a user has double-clicked the
14438 * photo.
14439 * @li "load" - Photo load begins.
14440 * @li "loaded" - This is called when the image file load is complete for the
14441 * first view (low resolution blurry version).
14442 * @li "load,detail" - Photo detailed data load begins.
14443 * @li "loaded,detail" - This is called when the image file load is complete
14444 * for the detailed image data (full resolution needed).
14445 * @li "zoom,start" - Zoom animation started.
14446 * @li "zoom,stop" - Zoom animation stopped.
14447 * @li "zoom,change" - Zoom changed when using an auto zoom mode.
14448 * @li "scroll" - the content has been scrolled (moved)
14449 * @li "scroll,anim,start" - scrolling animation has started
14450 * @li "scroll,anim,stop" - scrolling animation has stopped
14451 * @li "scroll,drag,start" - dragging the contents around has started
14452 * @li "scroll,drag,stop" - dragging the contents around has stopped
14453 *
14454 * @ref tutorial_photocam shows the API in action.
14455 * @{
14456 */
14457 /**
14458 * @brief Types of zoom available.
14459 */
14420 typedef enum _Elm_Photocam_Zoom_Mode 14460 typedef enum _Elm_Photocam_Zoom_Mode
14421 { 14461 {
14422 ELM_PHOTOCAM_ZOOM_MODE_MANUAL = 0, 14462 ELM_PHOTOCAM_ZOOM_MODE_MANUAL = 0, /**< Zoom controled normally by elm_photocam_zoom_set */
14423 ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, 14463 ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, /**< Zoom until photo fits in photocam */
14424 ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL, 14464 ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL, /**< Zoom until photo fills photocam */
14425 ELM_PHOTOCAM_ZOOM_MODE_LAST 14465 ELM_PHOTOCAM_ZOOM_MODE_LAST
14426 } Elm_Photocam_Zoom_Mode; 14466 } Elm_Photocam_Zoom_Mode;
14427 14467 /**
14468 * @brief Add a new Photocam object
14469 *
14470 * @param parent The parent object
14471 * @return The new object or NULL if it cannot be created
14472 */
14428 EAPI Evas_Object *elm_photocam_add(Evas_Object *parent) EINA_ARG_NONNULL(1); 14473 EAPI Evas_Object *elm_photocam_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
14474 /**
14475 * @brief Set the photo file to be shown
14476 *
14477 * @param obj The photocam object
14478 * @param file The photo file
14479 * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
14480 *
14481 * This sets (and shows) the specified file (with a relative or absolute
14482 * path) and will return a load error (same error that
14483 * evas_object_image_load_error_get() will return). The image will change and
14484 * adjust its size at this point and begin a background load process for this
14485 * photo that at some time in the future will be displayed at the full
14486 * quality needed.
14487 */
14429 EAPI Evas_Load_Error elm_photocam_file_set(Evas_Object *obj, const char *file) EINA_ARG_NONNULL(1); 14488 EAPI Evas_Load_Error elm_photocam_file_set(Evas_Object *obj, const char *file) EINA_ARG_NONNULL(1);
14489 /**
14490 * @brief Returns the path of the current image file
14491 *
14492 * @param obj The photocam object
14493 * @return Returns the path
14494 *
14495 * @see elm_photocam_file_set()
14496 */
14430 EAPI const char *elm_photocam_file_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 14497 EAPI const char *elm_photocam_file_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
14498 /**
14499 * @brief Set the zoom level of the photo
14500 *
14501 * @param obj The photocam object
14502 * @param zoom The zoom level to set
14503 *
14504 * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
14505 * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
14506 * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
14507 * be greater than 0. It is usggested to stick to powers of 2. (1, 2, 4, 8,
14508 * 16, 32, etc.).
14509 */
14431 EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom) EINA_ARG_NONNULL(1); 14510 EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom) EINA_ARG_NONNULL(1);
14511 /**
14512 * @brief Get the zoom level of the photo
14513 *
14514 * @param obj The photocam object
14515 * @return The current zoom level
14516 *
14517 * This returns the current zoom level of the photocam object. Note that if
14518 * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
14519 * (which is the default), the zoom level may be changed at any time by the
14520 * photocam object itself to account for photo size and photocam viewpoer
14521 * size.
14522 *
14523 * @see elm_photocam_zoom_set()
14524 * @see elm_photocam_zoom_mode_set()
14525 */
14432 EAPI double elm_photocam_zoom_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 14526 EAPI double elm_photocam_zoom_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
14527 /**
14528 * @brief Set the zoom mode
14529 *
14530 * @param obj The photocam object
14531 * @param mode The desired mode
14532 *
14533 * This sets the zoom mode to manual or one of several automatic levels.
14534 * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
14535 * elm_photocam_zoom_set() and will stay at that level until changed by code
14536 * or until zoom mode is changed. This is the default mode. The Automatic
14537 * modes will allow the photocam object to automatically adjust zoom mode
14538 * based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will adjust zoom so
14539 * the photo fits EXACTLY inside the scroll frame with no pixels outside this
14540 * area. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but ensure no
14541 * pixels within the frame are left unfilled.
14542 */
14433 EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode) EINA_ARG_NONNULL(1); 14543 EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode) EINA_ARG_NONNULL(1);
14544 /**
14545 * @brief Get the zoom mode
14546 *
14547 * @param obj The photocam object
14548 * @return The current zoom mode
14549 *
14550 * This gets the current zoom mode of the photocam object.
14551 *
14552 * @see elm_photocam_zoom_mode_set()
14553 */
14434 EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 14554 EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
14555 /**
14556 * @brief Get the current image pixel width and height
14557 *
14558 * @param obj The photocam object
14559 * @param w A pointer to the width return
14560 * @param h A pointer to the height return
14561 *
14562 * This gets the current photo pixel width and height (for the original).
14563 * The size will be returned in the integers @p w and @p h that are pointed
14564 * to.
14565 */
14435 EAPI void elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h) EINA_ARG_NONNULL(1); 14566 EAPI void elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h) EINA_ARG_NONNULL(1);
14567 /**
14568 * @brief Get the area of the image that is currently shown
14569 *
14570 * @param obj
14571 * @param x A pointer to the X-coordinate of region
14572 * @param y A pointer to the Y-coordinate of region
14573 * @param w A pointer to the width
14574 * @param h A pointer to the height
14575 *
14576 * @see elm_photocam_image_region_show()
14577 * @see elm_photocam_image_region_bring_in()
14578 */
14436 EAPI void elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1); 14579 EAPI void elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1);
14580 /**
14581 * @brief Set the viewed portion of the image
14582 *
14583 * @param obj The photocam object
14584 * @param x X-coordinate of region in image original pixels
14585 * @param y Y-coordinate of region in image original pixels
14586 * @param w Width of region in image original pixels
14587 * @param h Height of region in image original pixels
14588 *
14589 * This shows the region of the image without using animation.
14590 */
14437 EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1); 14591 EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1);
14592 /**
14593 * @brief Bring in the viewed portion of the image
14594 *
14595 * @param obj The photocam object
14596 * @param x X-coordinate of region in image original pixels
14597 * @param y Y-coordinate of region in image original pixels
14598 * @param w Width of region in image original pixels
14599 * @param h Height of region in image original pixels
14600 *
14601 * This shows the region of the image using animation.
14602 */
14438 EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1); 14603 EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1);
14604 /**
14605 * @brief Set the paused state for photocam
14606 *
14607 * @param obj The photocam object
14608 * @param paused The pause state to set
14609 *
14610 * This sets the paused state to on(EINA_TRUE) or off (EINA_FALSE) for
14611 * photocam. The default is off. This will stop zooming using animation on
14612 * zoom levels changes and change instantly. This will stop any existing
14613 * animations that are running.
14614 */
14439 EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) EINA_ARG_NONNULL(1); 14615 EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) EINA_ARG_NONNULL(1);
14616 /**
14617 * @brief Get the paused state for photocam
14618 *
14619 * @param obj The photocam object
14620 * @return The current paused state
14621 *
14622 * This gets the current paused state for the photocam object.
14623 *
14624 * @see elm_photocam_paused_set()
14625 */
14440 EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 14626 EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
14627 /**
14628 * @brief Get the internal low-res image used for photocam
14629 *
14630 * @param obj The photocam object
14631 * @return The internal image object handle, or NULL if none exists
14632 *
14633 * This gets the internal image object inside photocam. Do not modify it. It
14634 * is for inspection only, and hooking callbacks to. Nothing else. It may be
14635 * deleted at any time as well.
14636 */
14441 EAPI Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 14637 EAPI Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
14638 /**
14639 * @brief Set the photocam scrolling bouncing.
14640 *
14641 * @param obj The photocam object
14642 * @param h_bounce bouncing for horizontal
14643 * @param v_bounce bouncing for vertical
14644 */
14442 EAPI void elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) EINA_ARG_NONNULL(1); 14645 EAPI void elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) EINA_ARG_NONNULL(1);
14646 /**
14647 * @brief Get the photocam scrolling bouncing.
14648 *
14649 * @param obj The photocam object
14650 * @param h_bounce bouncing for horizontal
14651 * @param v_bounce bouncing for vertical
14652 *
14653 * @see elm_photocam_bounce_set()
14654 */
14443 EAPI void elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) EINA_ARG_NONNULL(1); 14655 EAPI void elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) EINA_ARG_NONNULL(1);
14444 /* smart callbacks called: 14656 /**
14445 * "clicked" - when image clicked 14657 * @}
14446 * "press" - when mouse/finger held down initially on image
14447 * "longpressed" - when mouse/finger held for long time on image
14448 * "clicked,double" - when mouse/finger double-clicked
14449 * "load" - when photo load begins
14450 * "loaded" - when photo load done
14451 * "load,detail" - when detailed image load begins
14452 * "loaded,detail" - when detailed image load done
14453 * "zoom,start" - when zooming started
14454 * "zoom,stop" - when zooming stopped
14455 * "zoom,change" - when auto zoom mode changed zoom level
14456 * "scroll - the content has been scrolled (moved)
14457 * "scroll,anim,start" - scrolling animation has started
14458 * "scroll,anim,stop" - scrolling animation has stopped
14459 * "scroll,drag,start" - dragging the contents around has started
14460 * "scroll,drag,stop" - dragging the contents around has stopped
14461 */ 14658 */
14462 14659
14463 /* map */ 14660 /* map */
diff --git a/src/lib/elm_photocam.c b/src/lib/elm_photocam.c
index f32b6e2c7..3c625b5fb 100644
--- a/src/lib/elm_photocam.c
+++ b/src/lib/elm_photocam.c
@@ -1,48 +1,15 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#include "elm_priv.h" 2#include "elm_priv.h"
3 3
4/** 4/*
5 * @defgroup Photocam Photocam
6 *
7 * This is a widget specifically for displaying high-resolution digital
8 * camera photos giving speedy feedback (fast load), low memory footprint
9 * and zooming and panning as well as fitting logic. It is entirely focused
10 * on jpeg images, and takes advantage of properties of the jpeg format (via
11 * evas loader features in the jpeg loader).
12 *
13 * Signals that you can add callbacks for are:
14 *
15 * "clicked" - This is called when a user has clicked the photo without dragging
16 * around.
17 * "press" - This is called when a user has pressed down on the photo.
18 * "longpressed" - This is called when a user has pressed down on the photo for
19 * a long time without dragging around.
20 * "clicked,double" - This is called when a user has double-clicked the photo.
21 * "load" - Photo load begins.
22 * "loaded" - This is called when the image file load is complete for the first
23 * view (low resolution blurry version).
24 * "load,detail" - Photo detailed data load begins.
25 * "loaded,detail" - This is called when the image file load is complete for
26 * the detailed image data (full resolution needed).
27 * "zoom,start" - Zoom animation started.
28 * "zoom,stop" - Zoom animation stopped.
29 * "zoom,change" - Zoom changed when using an auto zoom mode.
30 * "scroll" - the content has been scrolled (moved)
31 * "scroll,anim,start" - scrolling animation has started
32 * "scroll,anim,stop" - scrolling animation has stopped
33 * "scroll,drag,start" - dragging the contents around has started
34 * "scroll,drag,stop" - dragging the contents around has stopped
35 *
36 * ---
37 *
38 * TODO (maybe - optional future stuff): 5 * TODO (maybe - optional future stuff):
39 * 6 *
40 * 1. wrap photo in theme edje so u can have styling around photo (like white 7 * 1. wrap photo in theme edje so u can have styling around photo (like white
41 * photo bordering). 8 * photo bordering).
42 * 2. exif handling 9 * 2. exif handling
43 * 3. rotation flags in exif handling (nasty! should have rot in evas) 10 * 3. rotation flags in exif handling (nasty! should have rot in evas)
44 *
45 */ 11 */
12
46typedef struct _Widget_Data Widget_Data; 13typedef struct _Widget_Data Widget_Data;
47typedef struct _Pan Pan; 14typedef struct _Pan Pan;
48typedef struct _Grid Grid; 15typedef struct _Grid Grid;
@@ -1067,14 +1034,6 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
1067 return EINA_TRUE; 1034 return EINA_TRUE;
1068} 1035}
1069 1036
1070/**
1071 * Add a new Photocam object
1072 *
1073 * @param parent The parent object
1074 * @return The new object or NULL if it cannot be created
1075 *
1076 * @ingroup Photocam
1077 */
1078EAPI Evas_Object * 1037EAPI Evas_Object *
1079elm_photocam_add(Evas_Object *parent) 1038elm_photocam_add(Evas_Object *parent)
1080{ 1039{
@@ -1175,22 +1134,6 @@ elm_photocam_add(Evas_Object *parent)
1175 return obj; 1134 return obj;
1176} 1135}
1177 1136
1178/**
1179 * Set the photo file to be shown
1180 *
1181 * This sets (and shows) the specified file (with a relative or absolute path)
1182 * and will return a load error (same error that
1183 * evas_object_image_load_error_get() will return). The image will change and
1184 * adjust its size at this point and begin a background load process for this
1185 * photo that at some time in the future will be displayed at the full quality
1186 * needed.
1187 *
1188 * @param obj The photocam object
1189 * @param file The photo file
1190 * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
1191 *
1192 * @ingroup Photocam
1193 */
1194EAPI Evas_Load_Error 1137EAPI Evas_Load_Error
1195elm_photocam_file_set(Evas_Object *obj, const char *file) 1138elm_photocam_file_set(Evas_Object *obj, const char *file)
1196{ 1139{
@@ -1241,14 +1184,6 @@ elm_photocam_file_set(Evas_Object *obj, const char *file)
1241 return evas_object_image_load_error_get(wd->img); 1184 return evas_object_image_load_error_get(wd->img);
1242} 1185}
1243 1186
1244/*
1245 * Returns the path of the current image file
1246 *
1247 * @param obj The photocam object
1248 * @return Returns the path
1249 *
1250 * @ingroup Photocam
1251 */
1252EAPI const char * 1187EAPI const char *
1253elm_photocam_file_get(const Evas_Object *obj) 1188elm_photocam_file_get(const Evas_Object *obj)
1254{ 1189{
@@ -1258,20 +1193,6 @@ elm_photocam_file_get(const Evas_Object *obj)
1258 return wd->file; 1193 return wd->file;
1259} 1194}
1260 1195
1261/**
1262 * Set the zoom level of the photo
1263 *
1264 * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
1265 * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
1266 * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
1267 * be greater than 0. It is usggested to stick to powers of 2. (1, 2, 4, 8,
1268 * 16, 32, etc.).
1269 *
1270 * @param obj The photocam object
1271 * @param zoom The zoom level to set
1272 *
1273 * @ingroup Photocam
1274 */
1275EAPI void 1196EAPI void
1276elm_photocam_zoom_set(Evas_Object *obj, double zoom) 1197elm_photocam_zoom_set(Evas_Object *obj, double zoom)
1277{ 1198{
@@ -1457,19 +1378,6 @@ done:
1457 evas_object_smart_callback_call(obj, SIG_ZOOM_CHANGE, NULL); 1378 evas_object_smart_callback_call(obj, SIG_ZOOM_CHANGE, NULL);
1458} 1379}
1459 1380
1460/**
1461 * Get the zoom level of the photo
1462 *
1463 * This returns the current zoom level of the photocam object. Note that if
1464 * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
1465 * (which is the default), the zoom level may be changed at any time by the
1466 * photocam object itself to account for photo size and photocam viewpoer size
1467 *
1468 * @param obj The photocam object
1469 * @return The current zoom level
1470 *
1471 * @ingroup Photocam
1472 */
1473EAPI double 1381EAPI double
1474elm_photocam_zoom_get(const Evas_Object *obj) 1382elm_photocam_zoom_get(const Evas_Object *obj)
1475{ 1383{
@@ -1479,24 +1387,6 @@ elm_photocam_zoom_get(const Evas_Object *obj)
1479 return wd->zoom; 1387 return wd->zoom;
1480} 1388}
1481 1389
1482/**
1483 * Set the zoom mode
1484 *
1485 * This sets the zoom mode to manual or one of several automatic levels.
1486 * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
1487 * elm_photocam_zoom_set() and will stay at that level until changed by code
1488 * or until zoom mode is changed. This is the default mode.
1489 * The Automatic modes will allow the photocam object to automatically
1490 * adjust zoom mode based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will
1491 * adjust zoom so the photo fits EXACTLY inside the scroll frame with no pixels
1492 * outside this area. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but
1493 * ensure no pixels within the frame are left unfilled.
1494 *
1495 * @param obj The photocam object
1496 * @param mode The desired mode
1497 *
1498 * @ingroup Photocam
1499 */
1500EAPI void 1390EAPI void
1501elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode) 1391elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
1502{ 1392{
@@ -1512,16 +1402,6 @@ elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
1512 } 1402 }
1513} 1403}
1514 1404
1515/**
1516 * Get the zoom mode
1517 *
1518 * This gets the current zoom mode of the photocam object
1519 *
1520 * @param obj The photocam object
1521 * @return The current zoom mode
1522 *
1523 * @ingroup Photocam
1524 */
1525EAPI Elm_Photocam_Zoom_Mode 1405EAPI Elm_Photocam_Zoom_Mode
1526elm_photocam_zoom_mode_get(const Evas_Object *obj) 1406elm_photocam_zoom_mode_get(const Evas_Object *obj)
1527{ 1407{
@@ -1531,19 +1411,6 @@ elm_photocam_zoom_mode_get(const Evas_Object *obj)
1531 return wd->mode; 1411 return wd->mode;
1532} 1412}
1533 1413
1534/**
1535 * Get the current image pixel width and height
1536 *
1537 * This gets the current photo pixel width and height (for the original).
1538 * The size will be returned in the integers @p w and @p h that are pointed
1539 * to.
1540 *
1541 * @param obj The photocam object
1542 * @param w A pointer to the width return
1543 * @param h A pointer to the height return
1544 *
1545 * @ingroup Photocam
1546 */
1547EAPI void 1414EAPI void
1548elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h) 1415elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
1549{ 1416{
@@ -1554,12 +1421,6 @@ elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
1554 if (h) *h = wd->size.imh; 1421 if (h) *h = wd->size.imh;
1555} 1422}
1556 1423
1557/**
1558 * Get the current area of the image that is currently shown
1559 *
1560 * This gets the region
1561 *
1562 */
1563EAPI void 1424EAPI void
1564elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) 1425elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
1565{ 1426{
@@ -1612,19 +1473,6 @@ elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
1612 } 1473 }
1613} 1474}
1614 1475
1615/**
1616 * Set the viewed portion of the image
1617 *
1618 * This sets the region of the image to be viewed
1619 *
1620 * @param obj The photocam object
1621 * @param x X-coordinate of region in image original pixels
1622 * @param y Y-coordinate of region in image original pixels
1623 * @param w Width of region in image original pixels
1624 * @param h Height of region in image original pixels
1625 *
1626 * @ingroup Photocam
1627 */
1628EAPI void 1476EAPI void
1629elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__) 1477elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1630{ 1478{
@@ -1652,19 +1500,6 @@ elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UN
1652 elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh); 1500 elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh);
1653} 1501}
1654 1502
1655/**
1656 * Bring in the viewed portion of the image
1657 *
1658 * This brings in the region of the image over time
1659 *
1660 * @param obj The photocam object
1661 * @param x X-coordinate of region in image original pixels
1662 * @param y Y-coordinate of region in image original pixels
1663 * @param w Width of region in image original pixels
1664 * @param h Height of region in image original pixels
1665 *
1666 * @ingroup Photocam
1667 */
1668EAPI void 1503EAPI void
1669elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__) 1504elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1670{ 1505{
@@ -1693,18 +1528,6 @@ elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h
1693 elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh); 1528 elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh);
1694} 1529}
1695 1530
1696/**
1697 * Set the paused state for photocam
1698 *
1699 * This sets the paused state to on (1) or off (0) for photocam. The default
1700 * is on. This will stop zooming using animation ch change zoom levels and
1701 * change instantly. This will stop any existing animations that are running.
1702 *
1703 * @param obj The photocam object
1704 * @param paused The pause state to set
1705 *
1706 * @ingroup Photocam
1707 */
1708EAPI void 1531EAPI void
1709elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) 1532elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
1710{ 1533{
@@ -1725,16 +1548,6 @@ elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
1725 } 1548 }
1726} 1549}
1727 1550
1728/**
1729 * Get the paused state for photocam
1730 *
1731 * This gets the current paused state for the photocam object.
1732 *
1733 * @param obj The photocam object
1734 * @return The current paused state
1735 *
1736 * @ingroup Photocam
1737 */
1738EAPI Eina_Bool 1551EAPI Eina_Bool
1739elm_photocam_paused_get(const Evas_Object *obj) 1552elm_photocam_paused_get(const Evas_Object *obj)
1740{ 1553{
@@ -1744,18 +1557,6 @@ elm_photocam_paused_get(const Evas_Object *obj)
1744 return wd->paused; 1557 return wd->paused;
1745} 1558}
1746 1559
1747/**
1748 * Get the internal low-res image used for photocam
1749 *
1750 * This gets the internal image object inside photocam. Do not modify it. It
1751 * is for inspection only, and hooking callbacks to. Nothing else. It may be
1752 * deleted at any time as well.
1753 *
1754 * @param obj The photocam object
1755 * @return The internal image object handle, or NULL if none exists
1756 *
1757 * @ingroup Photocam
1758 */
1759EAPI Evas_Object * 1560EAPI Evas_Object *
1760elm_photocam_internal_image_get(const Evas_Object *obj) 1561elm_photocam_internal_image_get(const Evas_Object *obj)
1761{ 1562{
@@ -1765,14 +1566,6 @@ elm_photocam_internal_image_get(const Evas_Object *obj)
1765 return wd->img; 1566 return wd->img;
1766} 1567}
1767 1568
1768/**
1769 * Set the photocam scrolling bouncing.
1770 *
1771 * @param obj The photocam object
1772 * @param h_bounce bouncing for horizontal
1773 * @param v_bounce bouncing for vertical
1774 * @ingroup Photocam
1775 */
1776EAPI void 1569EAPI void
1777elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) 1570elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
1778{ 1571{
@@ -1782,15 +1575,6 @@ elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce
1782 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce); 1575 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
1783} 1576}
1784 1577
1785
1786/**
1787 * Get the photocam scrolling bouncing.
1788 *
1789 * @param obj The photocam object
1790 * @param h_bounce bouncing for horizontal
1791 * @param v_bounce bouncing for vertical
1792 * @ingroup Photocam
1793 */
1794EAPI void 1578EAPI void
1795elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) 1579elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
1796{ 1580{