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://www.tizenopensource.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>
39 #define DISABLE_FOR_DEMO 0
41 #ifdef USE_FIFO_THREAD
42 #define CAM_FIFO_PATH "/tmp/cam_cmd_fifo"
44 #define CAM_FIFO_CMD_EXIT "EXIT"
45 #define CAM_FIFO_CMD_START "START"
47 #define CAM_CAPTURE_AUTO_START "CAPTURE_AUTO_START"
49 #define MAX_NUM_OF_FIFO_TOKEN 6
53 # define PREFIX "/opt/apps/org.tizen.camera-app/"
56 #define PACKAGE "camera"
57 #define GRP_MAIN "main"
58 #define LOCALEDIR PREFIX"/res/locale"
60 #define EDJ_PATH PREFIX"/res/edje"
61 #define CAM_IMAGE_PATH PREFIX"/res/images/"
63 #define CAM_MAIN_LAYOUT_EDJ_NAME EDJ_PATH"/cam_main_layout.edj"
65 #define CAM_RECORDING_EDJ_NAME EDJ_PATH"/cam_recording_edje.edj"
66 #define CAM_RECORDING_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_inverse.edj"
67 #define CAM_RECORDING_VERTICAL_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical.edj"
68 #define CAM_RECORDING_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_recording_edje_vertical_inverse.edj"
70 #define CAM_TOOLBAR_LAYOUT_EDJ_NAME EDJ_PATH"/cam_toolbar_layout.edj"
71 #define CAM_TOOLBAR_LAYOUT_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_inverse.edj"
72 #define CAM_TOOLBAR_LAYOUT_VERTICAL_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical.edj"
73 #define CAM_TOOLBAR_LAYOUT_VERTICAL_INVERSE_EDJ_NAME EDJ_PATH"/cam_toolbar_layout_vertical_inverse.edj"
75 #define CAM_SETTING_POPUP_STYLE_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera.edj"
76 #define CAM_SETTING_POPUP_STYLE_WITH_RADIO_EDJ_NAME EDJ_PATH"/style_ctxpopup_camera_with_radio.edj"
77 #define CAM_SETTING_POPUP_LAYOUT_EDJ_NAME EDJ_PATH"/cam_setting_popup_layout.edj"
78 #define CAM_SLIDER_STYLE_EDJ_NAME EDJ_PATH"/style_slider_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"
83 #define CAM_ZOOM_EDJ_NAME EDJ_PATH"/cam_zoom_layout.edj"
84 #define CAM_ZOOM_EDJ_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_inverse.edj"
85 #define CAM_ZOOM_EDJ_VERTICAL_NAME EDJ_PATH"/cam_zoom_layout_vertical.edj"
86 #define CAM_ZOOM_EDJ_VERTICAL_INVERSE_NAME EDJ_PATH"/cam_zoom_layout_vertical_inverse.edj"
88 #define IMAGE_VIEWER_VIEW_MODE_KEY_NAME "View Mode"
89 #define IMAGE_VIEWER_FILE_PATH_KEY_NAME "Path"
90 #define IMAGE_VIEWER_SET_AS_TYPE "Setas type"
91 #define IMAGE_VIEWER_UG_NAME "image-viewer-efl"
93 #define AF_FAIL PREFIX"/share/camera/sounds/af_fail.wav"
94 #define SHUTTER PREFIX"/share/camera/sounds/Shutter_02.wav"
95 #define RECORD_START_SOUND PREFIX"/share/camera/sounds/cam_start_01.wav"
96 #define RECORD_STOP_SOUND PREFIX"/share/camera/sounds/cam_stop_01.wav"
98 #define PICTURE_PATH PREFIX"/share/camera/pictures"
99 #define VIDEO_PATH PREFIX"/share/camera/videos"
101 #define PREVIEW_WIDTH 640
102 #define PREVIEW_HEIGHT 480
104 #define WINDOW_W 640 /* 400 */ /*1280*/
105 #define WINDOW_H 480 /* 240 */ /*720*/
107 #define AUL_SERVICE_MIME_TYPE_IMAGE "image/jpg"
108 #define AUL_SERVICE_MIME_TYPE_VIDEO "video/3gp"
109 #define APP_SERVICE_DEFAULT_CALLER_NAME "3rd_Party_App"
110 #define APP_SERVICE_MESSAGE_APP "message"
112 #define FAKE_IMAGE_PKG_NAME "org.tizen.camera"
114 #define DEFAULT_WIN_ANGLE (270)
116 #define CAM_FILE_PATH_MAX 1024
117 #define EFL_TEMP_CODE
118 /* #define USE_CAMERA_APP_SHUTTER_SOUND 1 */
119 /* #define ENABLE_CAPTURE_ANIMATION */
124 Evas_Object *win_main;
125 Ecore_X_Window main_xid;
126 Ecore_Pipe *main_pipe;
127 CamLaunchType launch_type;
128 CamAppCoreState appcore_state;
131 app_device_orientation_e rot_current;
132 app_device_orientation_e rot_previous;
138 int previous_win_rotate_angle;
139 gboolean is_rotating;
141 int camcorder_rotate;
143 Evas_Object *layout_main; /* layout widget based on EDJ */
144 Evas_Object *black_screen;
146 #ifdef ENABLE_CAPTURE_ANIMATION
147 Evas_Object *shutter_screen;
148 Evas_Object *shutter_move_image;
150 CamRectangle shutter_src_rect;
151 CamRectangle shutter_des_rect;
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 */
165 double camera_focus_w; /* size of focus image */
166 double camera_focus_h; /* size of focus image */
168 int touch_lcd_x; /* lcd x */
169 int touch_lcd_y; /* lcd y */
171 int preview_offset_x;
172 int preview_offset_y;
176 int target_direction;
177 Evas_Object *toolbar_edje;
179 Evas_Object *toolbar_edje_landscape;
180 Evas_Object *toolbar_edje_portrait;
181 Evas_Object *toolbar_edje_landscape_inverse;
182 Evas_Object *toolbar_edje_portrait_inverse;
183 char *toolbar_edj_file;
187 Evas_Object *edje_landscape;
188 Evas_Object *edje_portrait;
189 Evas_Object *edje_landscape_inverse;
190 Evas_Object *edje_portrait_inverse;
193 Evas_Object *camera_icon;
194 Evas_Object *camcorder_icon;
200 Evas_Object *edje_landscape;
201 Evas_Object *edje_portrait;
202 Evas_Object *edje_landscape_inverse;
203 Evas_Object *edje_portrait_inverse;
205 Evas_Object *thumbnail_image;
208 Ecore_Timer *conti_shot_timer;
211 Evas_Object *toolbar_0_icon; /*setting icon*/
212 Evas_Object *toolbar_1_icon;
213 Evas_Object *toolbar_2_icon;
214 Evas_Object *toolbar_3_icon;
215 Evas_Object *toolbar_4_icon;
223 Evas_Object *shutterbtn;
224 Evas_Object *shutterbtn_camera_icon;
225 Evas_Object *shutterbtn_camcorder_icon;
227 Evas_Object *backbtn;
229 Evas_Object *focus_edje;
230 Evas_Object *indicator_edje;
231 Evas_Object *zoom_edje;
232 Evas_Object *zoom_text_min_edje;
233 Evas_Object *zoom_text_max_edje;
234 Evas_Object *recording_edje;
235 Evas_Object *capturebtn_edje;
238 #ifdef GUIDE_LINE_ENALBE
239 Evas_Object *guideline_edje;
242 Evas_Object *progressbar_edje;
243 Evas_Object *progressbar;
245 Elm_Object_Item *timer_item;
246 Elm_Object_Item *setting_select_item;
248 Evas_Object *radio; /* radio button */
249 Evas_Object *guideline_radio; /* radio button */
250 Evas_Object *timer_radio;
251 Evas_Object *genlist;
253 int effect_radio_index;
254 int timer_radio_index;
256 Evas_Object *toolbar_popup; /*I think this evas_object have no use,fix me*/
257 Evas_Object *toolbar_setting_popup;
258 Evas_Object *toolbar_setting_ctxpopup;
259 Evas_Object *toolbar_setting_popup_content;
260 bool toolbar_show_setting_popup;
261 Ecore_Idler *toolbar_setting_popup_idler;
263 bool toolbar_show_edit_shortcuts_popup;
265 Evas_Object *setting_ctxpopup;
266 Evas_Object *ctxpopup_area;
267 Evas_Object *setting_ctxpopup_area;
269 Evas_Object *edit_shortcuts_popup;
270 Evas_Object *edit_shortcuts_popup_ctx;
271 Evas_Object *edit_shortcuts_popup_scroll;
272 Evas_Object *edit_shortcuts_popup_description;/*note: text part*/
275 Evas_Object *layout_edje;
276 Evas_Object *gengrid;
277 Eina_List *item_list;
280 Evas_Object *progress_popup;
281 Evas_Object *progress_popup_bar;
283 Ecore_Event_Handler *key_up;
284 Ecore_Event_Handler *key_down;
285 Ecore_Event_Handler *mouse_up;
286 Ecore_Event_Handler *mouse_down;
287 Ecore_Event_Handler *mouse_move;
289 Ecore_Idler *recording_commit;
291 /* Idle handler of capture callback. wh01.cho@samsung.com. 2010-12-15. */
292 Ecore_Idler *still_captured_idle;
293 Ecore_Idler *capture_idle;
294 GList *capture_cb_list;
295 #ifdef ENABLE_CAPTURE_ANIMATION
296 MMCamcorderCaptureDataType capture_datatype;
299 Ecore_Timer *rec_icon_updater;
300 Ecore_Timer *rec_time_updater;
301 Ecore_Timer *rec_pause_timer;
303 Ecore_Timer *popup_timer;
304 Evas_Object *waring_popup;
305 Evas_Object *confirm_popup;
309 Ecore_Idler *auto_shot_idle;
312 Ecore_Timer *timeout_checker;
313 Ecore_Timer *auto_close_timer;
314 Ecore_Timer *setting_toolbar_hide_timer;
316 Ecore_Timer *continuous_af_timer;
318 Ecore_Timer *toolbar_toggle_timer;
321 bool timer_activated;
322 Ecore_Timer *timer_timer;
324 Evas_Object *timer_icon_edje;
326 CamAppData *camapp_handle;
327 ShortCutData *shortcut_data; /*save now moving or touch shortcut*/
331 /*app service mime type*/
332 char *aul_service_mime;
333 /*camera app is called by this app using app service */
336 CamExeArgs *exe_args;
338 /* Thread for file register */
339 #ifdef USE_FILE_REG_THREAD
340 pthread_t file_reg_thread;
341 pthread_mutex_t file_reg_mutex;
342 pthread_cond_t file_reg_cond;
343 GQueue *file_reg_queue;
346 pthread_t camera_start_thread;
348 ui_gadget_h imageviewer_ug;
349 gboolean ug_is_deleting_process; /*note: now ug is deleting process, and run into camera preview process*/
350 service_h imageviewer_service;
355 Ecore_Idler *update_thumbnail_idler;
356 Ecore_Timer *thumbnail_hide_timer;
358 Ecore_Timer *longpress_timer;
360 gboolean shutter_move;
361 /*checking exist result snapshot popup*/
362 gboolean is_showing_snapshot_popup;
364 int cancel_key_press;
367 gboolean path_in_return;
369 int displayed_setting_popup;
370 int enable_mode_change;
371 int stop_continuous_shot;
372 /*check out low battery */
373 gboolean battery_status;
374 /*check torch light*/
375 gboolean torchlight_on;
377 /* during the call */
379 int foucs_out_from_quickview;
380 #ifdef USE_CAMERA_APP_SHUTTER_SOUND
383 Evas_Object *auto_close_popup;
384 Evas_Object *restore_default_popup;
385 Evas_Object *zoom_warring_popup;
386 int auto_close_count;
388 int last_camera_zoom_mode;
391 Evas_Object *shot_mode_guide_popup;
393 service_h service_handle;
394 cam_menu_composer* setting_menu_composer;
396 /*note: remained_count*/
403 gboolean open_cam_ext_handle();
404 gboolean open_cam_handle(void* data);
405 void close_cam_ext_handle();
406 gboolean cam_toolbar_menu_config_init(void *data, int mode);
407 gboolean cam_toolbar_menu_config_update(void *data);
409 int update_ts_main(void *data);
411 #endif /* __DEF_CAM_H__ */