2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <Elementary.h>
28 #include "cam_property.h"
30 #include "edc_string.h"
34 #include <ui-gadget.h>
36 #include <media_content.h>
40 #define DISABLE_FOR_DEMO 0
42 #ifdef USE_FIFO_THREAD
43 #define CAM_FIFO_PATH "/tmp/cam_cmd_fifo"
45 #define CAM_FIFO_CMD_EXIT "EXIT"
46 #define CAM_FIFO_CMD_START "START"
48 #define CAM_CAPTURE_AUTO_START "CAPTURE_AUTO_START"
50 #define MAX_NUM_OF_FIFO_TOKEN 6
53 #define PACKAGE "ug-camera-efl"
54 #define GRP_MAIN "main"
56 #define EDJ_PATH "/usr/ug/res/edje/"PACKAGE
57 #define CAM_IMAGE_PATH "/usr/ug/res/images/"PACKAGE"/src_images/"
59 #define CAM_MAIN_LAYOUT_EDJ_NAME EDJ_PATH"/cam_main_layout.edj"
61 #define CAM_RECORDING_EDJ_NAME EDJ_PATH"/cam_recording_edje.edj"
62 #define CAM_RECORDING_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_inverse.edj"
63 #define CAM_RECORDING_VERTICAL_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical.edj"
64 #define CAM_RECORDING_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical_inverse.edj"
66 #define CAM_TOOLBAR_LAYOUT_EDJ_NAME EDJ_PATH"/cam_toolbar_layout.edj"
67 #define CAM_TOOLBAR_LAYOUT_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_inverse.edj"
68 #define CAM_TOOLBAR_LAYOUT_VERTICAL_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical.edj"
69 #define CAM_TOOLBAR_LAYOUT_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical_inverse.edj"
71 #define CAM_SETTING_POPUP_STYLE_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera.edj"
72 #define CAM_SETTING_POPUP_STYLE_WITH_RADIO_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera_with_radio.edj"
73 #define CAM_SETTING_POPUP_LAYOUT_EDJ_NAME EDJ_PATH"/cam_setting_popup_layout.edj"
74 #define CAM_SLIDER_STYLE_EDJ_NAME EDJ_PATH"/style_slider_camera.edj"
75 #define CAM_LABEL_STYLE_EDJ_NAME EDJ_PATH"/style_label_camera.edj"
76 #define CAM_BUTTON_STYLE_EDJ_NAME EDJ_PATH"/style_button_camera.edj"
79 #define CAM_SHOTCUTS_EDIT_CTXPOPUP_EDJ_NAME EDJ_PATH"/cam_ctxpopup_shortcuts.edj"
81 #define CAM_UTILS_EDJ_NAME EDJ_PATH"/cam_utils.edj"
82 #define CAM_INDICATOR_EDJ_NAME EDJ_PATH"/cam_indicator_layout.edj"
84 #define CAM_EV_EDJ_NAME EDJ_PATH"/cam_ev_layout.edj"
85 #define CAM_EV_EDJ_INVERSE_NAME EDJ_PATH"/cam_ev_layout_inverse.edj"
86 #define CAM_EV_EDJ_VERTICAL_NAME EDJ_PATH"/cam_ev_layout_vertical.edj"
87 #define CAM_EV_EDJ_VERTICAL_INVERSE_NAME EDJ_PATH"/cam_ev_layout_vertical_inverse.edj"
89 #define CAM_ZOOM_EDJ_NAME EDJ_PATH"/cam_zoom_layout.edj"
90 #define CAM_ZOOM_EDJ_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_inverse.edj"
91 #define CAM_ZOOM_EDJ_VERTICAL_NAME EDJ_PATH"/cam_zoom_layout_vertical.edj"
92 #define CAM_ZOOM_EDJ_VERTICAL_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_vertical_inverse.edj"
94 #define CAM_IMAGE_EDJ_NAME EDJ_PATH"/cam_images.edj"
96 #define IMAGE_VIEWER_VIEW_MODE_KEY_NAME "View Mode"
97 #define IMAGE_VIEWER_FILE_PATH_KEY_NAME "Path"
98 #define IMAGE_VIEWER_SET_AS_TYPE "Setas type"
99 #define IMAGE_VIEWER_RESOLUTION "Resolution"
100 #define IMAGE_VIEWER_UG_NAME "image-viewer-efl"
102 #define LOCATION_UG_NAME "setting-location-efl"
104 #define PREVIEW_WIDTH 640
105 #define PREVIEW_HEIGHT 480
107 #define WINDOW_W 640 /* 400 */ /*1280*/
108 #define WINDOW_H 480 /* 240 */ /*720*/
110 #define SERVICE_MIME_TYPE_IMAGE_1 "image/jpg"
111 #define SERVICE_MIME_TYPE_IMAGE_2 "image/jpeg"
112 #define SERVICE_MIME_TYPE_VIDEO_1 "video/3gp"
113 #define SERVICE_MIME_TYPE_VIDEO_2 "video/3gpp"
114 #define SERVICE_OPTIONAL_KEY_ALLOW_SWITCH "http://tizen.org/appcontrol/data/camera/allow_switch"
117 #define DEFAULT_WIN_ANGLE (270)
119 #define CAM_FILE_PATH_MAX 1024
120 #define EFL_TEMP_CODE
121 /* #define USE_CAMERA_APP_SHUTTER_SOUND 1 */
122 #define ENABLE_CAPTURE_ANIMATION
127 Evas_Object *ug_base;
128 Evas_Object *win_main;
129 Ecore_X_Window main_xid;
130 Ecore_Pipe *main_pipe;
133 app_device_orientation_e rot_current;
134 app_device_orientation_e rot_previous;
139 gboolean is_rotating;
140 gboolean is_processing; /*note: programm busy flag, now just used for bust shot processing popup*/
141 gboolean is_capture_animation_processing;
143 int camcorder_rotate;
145 Evas_Object *gesture; /* gesture layout */
147 #ifdef ENABLE_CAPTURE_ANIMATION
148 Evas_Object *shutter_screen;
149 CamRectangle shutter_src_rect;
150 CamRectangle shutter_des_rect;
151 Evas_Object *rect_image;
157 int camfw_video_width;
158 int camfw_video_height;
160 double af_start_x; /* area start coordination */
161 double af_start_y; /* area start coordination */
164 double camera_focus_w; /* size of focus image */
165 double camera_focus_h; /* size of focus image */
167 int touch_lcd_x; /* lcd x */
168 int touch_lcd_y; /* lcd y */
170 int preview_offset_x;
171 int preview_offset_y;
175 int target_direction;
176 Evas_Object *toolbar_edje;
178 Evas_Object *toolbar_edje_landscape;
179 Evas_Object *toolbar_edje_portrait;
180 Evas_Object *toolbar_edje_landscape_inverse;
181 Evas_Object *toolbar_edje_portrait_inverse;
182 char *toolbar_edj_file;
186 Evas_Object *edje_landscape;
187 Evas_Object *edje_portrait;
188 Evas_Object *edje_landscape_inverse;
189 Evas_Object *edje_portrait_inverse;
191 Evas_Object *thumbnail_image;
196 cam_menubar_data toolbar_menu_arrays[CAM_MENU_BAR_LEFT_MAX_NUM];
200 Evas_Object *shutterbtn;
201 Evas_Object *shutterbtn_camera_icon;
202 Evas_Object *recordingbtn;
203 Evas_Object *recording_stop_btn;
204 Evas_Object *backbtn;
205 Evas_Object *caf_button;
207 Evas_Object *focus_edje;
208 Evas_Object *indicator_edje;
209 Evas_Object *ev_edje;
210 Evas_Object *ev_icon_minus_edje;
211 Evas_Object *ev_icon_plus_edje;
212 Evas_Object *pinch_edje;
213 Evas_Object *zoom_edje;
214 Evas_Object *zoom_text_min_edje;
215 Evas_Object *zoom_text_max_edje;
216 Evas_Object *recording_edje;
217 Evas_Object *capturebtn_edje;
219 Evas_Object *guideline_edje;
221 Evas_Object *progressbar_edje;
222 Evas_Object *progressbar;
224 Evas_Object *gps_radio; /* radio button */
225 Evas_Object *guideline_radio; /* radio button */
226 Evas_Object *autocontrast_radio;
227 Evas_Object *antishake_radio;
228 Evas_Object *outdoor_visibility_radio;
229 Evas_Object *burst_shot_mode_radio;
230 Evas_Object *capture_by_voice_radio;
231 Evas_Object *save_as_flip_radio;
232 Elm_Object_Item *setting_select_item;
234 Evas_Object *genlist;
235 Evas_Object *sub_genlist;
236 Evas_Object *sub_menu_group;
240 bool show_setting_popup_after_rotate;
241 bool show_edit_shortcuts_popup_after_rotate;
243 Evas_Object *toolbar_setting_popup;
244 Evas_Object *toolbar_setting_popup_area;
246 Evas_Object *setting_ctxpopup;
247 Evas_Object *ctxpopup_area;
249 Evas_Object *edit_shortcuts_popup;
250 Evas_Object *edit_shortcuts_popup_ctx;
251 Evas_Object *edit_shortcuts_popup_scroll;
252 Evas_Object *edit_shortcuts_popup_description;/*note: text part*/
254 Evas_Object *tip_popup;
259 Evas_Object *layout_edje;
260 Evas_Object *gengrid;
261 Eina_List *item_list;
265 Evas_Object *progress_popup;
266 Evas_Object *progress_popup_bar;
268 Ecore_Event_Handler *key_up;
269 Ecore_Event_Handler *key_down;
270 Ecore_Event_Handler *mouse_up;
271 Ecore_Event_Handler *mouse_down;
273 Ecore_Idler *recording_commit;
275 /* Idle handler of capture callback. wh01.cho@samsung.com. 2010-12-15. */
276 Ecore_Idler *still_captured_idle;
277 Ecore_Idler *capture_idle;
278 GList *capture_cb_list;
280 Ecore_Timer *rec_icon_updater;
281 Ecore_Timer *rec_time_updater;
282 Ecore_Timer *rec_pause_timer;
284 Ecore_Timer *check_af_timer;
285 Ecore_Timer *continuous_shot_timer;
286 Ecore_Timer *shutter_long_tap_timer; /*long tap timer for AF*/
287 gboolean emit_continuous_shutter; /*record: continous have been emitted*/
288 gboolean continuous_shot_by_hard_key; /* continuous shot triggered by hard key */
290 Evas_Object *waring_popup;
291 Evas_Object *confirm_popup;
295 Ecore_Idler *auto_shot_idle;
299 Evas_Object *bestshot_thumbnails_edje;
302 Ecore_Timer *timeout_checker;
303 Ecore_Timer *setting_toolbar_hide_timer;
305 Ecore_Timer *gps_animation_timer;
306 Ecore_Timer *battery_animation_timer;
308 Ecore_Timer *continuous_af_timer;
309 Ecore_Timer *focus_guide_hide_timer;
313 bool timer_activated;
314 Ecore_Timer *timer_timer;
316 Evas_Object *timer_icon_edje;
318 CamAppData *camapp_handle;
319 ShortCutData *shortcut_data; /*save now moving or touch shortcut*/
320 ShortCutData *swap_data; /*save now covering shortcuts*/
324 /* ug service mime type*/
327 CamExeArgs *exe_args;
329 /* Thread for file register */
330 pthread_t file_reg_thread;
331 pthread_mutex_t file_reg_mutex;
332 pthread_cond_t file_reg_cond;
333 GQueue *file_reg_queue;
335 pthread_t camera_start_thread;
337 ui_gadget_h camera_ug;
339 ui_gadget_h imageviewer_ug;
340 gboolean ug_is_deleting_process; /*note: now ug is deleting process, and run into camera preview process*/
341 service_h imageviewer_service;
343 ui_gadget_h location_ug;
348 Ecore_Idler *update_thumbnail_idler;
350 Ecore_Timer *longpress_timer;
353 int cancel_key_press;
356 gboolean path_in_return;
357 int displayed_setting_popup;
358 int enable_mode_change;
359 int stop_continuous_shot;
360 /*check out low battery */
361 gboolean battery_status;
362 /*check torch light*/
363 gboolean torchlight_on;
368 #ifdef USE_CAMERA_APP_SHUTTER_SOUND
371 int last_camera_zoom_mode;
374 Evas_Object *shot_mode_guide_popup;
376 service_h service_handle;
377 cam_menu_composer* setting_menu_composer;
378 cam_menu_composer* sub_menu_composer;
380 /*note: remained_count*/
383 CamErrorType error_type;
389 gboolean open_cam_ext_handle();
390 void close_cam_ext_handle();
391 gboolean cam_toolbar_menu_config_init(void *data, int mode);
392 gboolean cam_toolbar_menu_config_update(void *data);
394 #endif /* __DEF_CAM_H__ */