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
119 /*#define ENABLE_CAM_POWER_CONTROL*/
121 /* #define USE_CAMERA_APP_SHUTTER_SOUND 1 */
122 /* #define ENABLE_CAPTURE_ANIMATION */
127 Evas_Object *win_main;
128 Ecore_X_Window main_xid;
129 Ecore_Pipe *main_pipe;
130 CamLaunchType launch_type;
131 CamAppCoreState appcore_state;
134 app_device_orientation_e rot_current;
135 app_device_orientation_e rot_previous;
141 int previous_win_rotate_angle;
142 gboolean is_rotating;
144 int camcorder_rotate;
146 Evas_Object *layout_main; /* layout widget based on EDJ */
147 Evas_Object *black_screen;
149 #ifdef ENABLE_CAPTURE_ANIMATION
150 Evas_Object *shutter_screen;
151 Evas_Object *shutter_move_image;
153 CamRectangle shutter_src_rect;
154 CamRectangle shutter_des_rect;
160 int camfw_video_width;
161 int camfw_video_height;
163 double af_start_x; /* area start coordination */
164 double af_start_y; /* area start coordination */
168 double camera_focus_w; /* size of focus image */
169 double camera_focus_h; /* size of focus image */
171 int touch_lcd_x; /* lcd x */
172 int touch_lcd_y; /* lcd y */
174 int preview_offset_x;
175 int preview_offset_y;
179 int target_direction;
180 Evas_Object *toolbar_edje;
182 Evas_Object *toolbar_edje_landscape;
183 Evas_Object *toolbar_edje_portrait;
184 Evas_Object *toolbar_edje_landscape_inverse;
185 Evas_Object *toolbar_edje_portrait_inverse;
186 char *toolbar_edj_file;
190 Evas_Object *edje_landscape;
191 Evas_Object *edje_portrait;
192 Evas_Object *edje_landscape_inverse;
193 Evas_Object *edje_portrait_inverse;
196 Evas_Object *camera_icon;
197 Evas_Object *camcorder_icon;
203 Evas_Object *edje_landscape;
204 Evas_Object *edje_portrait;
205 Evas_Object *edje_landscape_inverse;
206 Evas_Object *edje_portrait_inverse;
208 Evas_Object *thumbnail_image;
211 Ecore_Timer *conti_shot_timer;
214 Evas_Object *toolbar_0_icon; /*setting icon*/
215 Evas_Object *toolbar_1_icon;
216 Evas_Object *toolbar_2_icon;
217 Evas_Object *toolbar_3_icon;
218 Evas_Object *toolbar_4_icon;
226 Evas_Object *shutterbtn;
227 Evas_Object *shutterbtn_camera_icon;
228 Evas_Object *shutterbtn_camcorder_icon;
230 Evas_Object *backbtn;
232 Evas_Object *focus_edje;
233 Evas_Object *indicator_edje;
234 Evas_Object *zoom_edje;
235 Evas_Object *zoom_text_min_edje;
236 Evas_Object *zoom_text_max_edje;
237 Evas_Object *recording_edje;
238 Evas_Object *capturebtn_edje;
241 #ifdef GUIDE_LINE_ENALBE
242 Evas_Object *guideline_edje;
245 Evas_Object *progressbar_edje;
246 Evas_Object *progressbar;
248 Elm_Object_Item *timer_item;
249 Elm_Object_Item *setting_select_item;
251 Evas_Object *radio; /* radio button */
252 Evas_Object *guideline_radio; /* radio button */
253 Evas_Object *timer_radio;
254 Evas_Object *genlist;
256 int effect_radio_index;
257 int timer_radio_index;
259 Evas_Object *toolbar_popup; /*I think this evas_object have no use,fix me*/
260 Evas_Object *toolbar_setting_popup;
261 Evas_Object *toolbar_setting_ctxpopup;
262 Evas_Object *toolbar_setting_popup_content;
263 bool toolbar_show_setting_popup;
264 Ecore_Idler *toolbar_setting_popup_idler;
266 bool toolbar_show_edit_shortcuts_popup;
268 Evas_Object *setting_ctxpopup;
269 Evas_Object *ctxpopup_area;
270 Evas_Object *setting_ctxpopup_area;
272 Evas_Object *edit_shortcuts_popup;
273 Evas_Object *edit_shortcuts_popup_ctx;
274 Evas_Object *edit_shortcuts_popup_scroll;
275 Evas_Object *edit_shortcuts_popup_description;/*note: text part*/
278 Evas_Object *layout_edje;
279 Evas_Object *gengrid;
280 Eina_List *item_list;
283 Evas_Object *progress_popup;
284 Evas_Object *progress_popup_bar;
286 Ecore_Event_Handler *key_up;
287 Ecore_Event_Handler *key_down;
288 Ecore_Event_Handler *mouse_up;
289 Ecore_Event_Handler *mouse_down;
290 Ecore_Event_Handler *mouse_move;
292 Ecore_Idler *recording_commit;
294 /* Idle handler of capture callback. wh01.cho@samsung.com. 2010-12-15. */
295 Ecore_Idler *still_captured_idle;
296 Ecore_Idler *capture_idle;
297 GList *capture_cb_list;
298 #ifdef ENABLE_CAPTURE_ANIMATION
299 MMCamcorderCaptureDataType capture_datatype;
302 Ecore_Timer *rec_icon_updater;
303 Ecore_Timer *rec_time_updater;
304 Ecore_Timer *rec_pause_timer;
306 Ecore_Timer *popup_timer;
307 Evas_Object *waring_popup;
308 Evas_Object *confirm_popup;
312 Ecore_Idler *auto_shot_idle;
315 Ecore_Timer *timeout_checker;
316 Ecore_Timer *auto_close_timer;
317 Ecore_Timer *setting_toolbar_hide_timer;
319 Ecore_Timer *continuous_af_timer;
321 Ecore_Timer *toolbar_toggle_timer;
324 bool timer_activated;
325 Ecore_Timer *timer_timer;
327 Evas_Object *timer_icon_edje;
329 CamAppData *camapp_handle;
330 ShortCutData *shortcut_data; /*save now moving or touch shortcut*/
334 /*app service mime type*/
335 char *aul_service_mime;
336 /*camera app is called by this app using app service */
339 CamExeArgs *exe_args;
341 /* Thread for file register */
342 #ifdef USE_FILE_REG_THREAD
343 pthread_t file_reg_thread;
344 pthread_mutex_t file_reg_mutex;
345 pthread_cond_t file_reg_cond;
346 GQueue *file_reg_queue;
349 ui_gadget_h imageviewer_ug;
350 gboolean ug_is_deleting_process; /*note: now ug is deleting process, and run into camera preview process*/
351 service_h imageviewer_service;
356 Ecore_Idler *update_thumbnail_idler;
357 Ecore_Timer *thumbnail_hide_timer;
359 Ecore_Timer *longpress_timer;
361 gboolean shutter_move;
362 /*checking exist result snapshot popup*/
363 gboolean is_showing_snapshot_popup;
365 int cancel_key_press;
368 gboolean path_in_return;
370 int displayed_setting_popup;
371 int enable_mode_change;
372 int stop_continuous_shot;
373 /*check out low battery */
374 gboolean battery_status;
375 /*check torch light*/
376 gboolean torchlight_on;
378 /* during the call */
380 int foucs_out_from_quickview;
381 #ifdef USE_CAMERA_APP_SHUTTER_SOUND
384 Evas_Object *auto_close_popup;
385 Evas_Object *restore_default_popup;
386 Evas_Object *zoom_warring_popup;
387 int auto_close_count;
389 int last_camera_zoom_mode;
392 Evas_Object *shot_mode_guide_popup;
394 service_h service_handle;
395 cam_menu_composer* setting_menu_composer;
397 /*note: remained_count*/
404 gboolean open_cam_ext_handle();
405 gboolean open_cam_handle(void* data);
406 void close_cam_ext_handle();
407 gboolean cam_toolbar_menu_config_init(void *data, int mode);
408 gboolean cam_toolbar_menu_config_update(void *data);
410 int update_ts_main(void *data);
412 #endif /* __DEF_CAM_H__ */