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"
116 #define DEFAULT_WIN_ANGLE (270)
118 #define CAM_FILE_PATH_MAX 1024
119 #define EFL_TEMP_CODE
120 /* #define USE_CAMERA_APP_SHUTTER_SOUND 1 */
121 #define ENABLE_CAPTURE_ANIMATION
126 Evas_Object *ug_base;
127 Evas_Object *win_main;
128 Ecore_X_Window main_xid;
129 Ecore_Pipe *main_pipe;
132 app_device_orientation_e rot_current;
133 app_device_orientation_e rot_previous;
138 gboolean is_rotating;
139 gboolean is_processing; /*note: programm busy flag, now just used for bust shot processing popup*/
140 gboolean is_capture_animation_processing;
142 int camcorder_rotate;
144 Evas_Object *gesture; /* gesture layout */
146 #ifdef ENABLE_CAPTURE_ANIMATION
147 Evas_Object *shutter_screen;
148 CamRectangle shutter_src_rect;
149 CamRectangle shutter_des_rect;
150 Evas_Object *rect_image;
156 int camfw_video_width;
157 int camfw_video_height;
159 double af_start_x; /* area start coordination */
160 double af_start_y; /* area start coordination */
163 double camera_focus_w; /* size of focus image */
164 double camera_focus_h; /* size of focus image */
166 int touch_lcd_x; /* lcd x */
167 int touch_lcd_y; /* lcd y */
169 int preview_offset_x;
170 int preview_offset_y;
174 int target_direction;
175 Evas_Object *toolbar_edje;
177 Evas_Object *toolbar_edje_landscape;
178 Evas_Object *toolbar_edje_portrait;
179 Evas_Object *toolbar_edje_landscape_inverse;
180 Evas_Object *toolbar_edje_portrait_inverse;
181 char *toolbar_edj_file;
185 Evas_Object *edje_landscape;
186 Evas_Object *edje_portrait;
187 Evas_Object *edje_landscape_inverse;
188 Evas_Object *edje_portrait_inverse;
190 Evas_Object *thumbnail_image;
195 cam_menubar_data toolbar_menu_arrays[CAM_MENU_BAR_LEFT_MAX_NUM];
199 Evas_Object *shutterbtn;
200 Evas_Object *shutterbtn_camera_icon;
201 Evas_Object *recordingbtn;
202 Evas_Object *recording_stop_btn;
203 Evas_Object *backbtn;
204 Evas_Object *caf_button;
206 Evas_Object *focus_edje;
207 Evas_Object *indicator_edje;
208 Evas_Object *ev_edje;
209 Evas_Object *ev_icon_minus_edje;
210 Evas_Object *ev_icon_plus_edje;
211 Evas_Object *pinch_edje;
212 Evas_Object *zoom_edje;
213 Evas_Object *zoom_text_min_edje;
214 Evas_Object *zoom_text_max_edje;
215 Evas_Object *recording_edje;
216 Evas_Object *capturebtn_edje;
218 Evas_Object *guideline_edje;
220 Evas_Object *progressbar_edje;
221 Evas_Object *progressbar;
223 Evas_Object *gps_radio; /* radio button */
224 Evas_Object *guideline_radio; /* radio button */
225 Evas_Object *autocontrast_radio;
226 Evas_Object *antishake_radio;
227 Evas_Object *outdoor_visibility_radio;
228 Evas_Object *burst_shot_mode_radio;
229 Evas_Object *capture_by_voice_radio;
230 Evas_Object *save_as_flip_radio;
231 Elm_Object_Item *setting_select_item;
233 Evas_Object *genlist;
234 Evas_Object *sub_genlist;
235 Evas_Object *sub_menu_group;
239 bool show_setting_popup_after_rotate;
240 bool show_edit_shortcuts_popup_after_rotate;
242 Evas_Object *toolbar_setting_popup;
243 Evas_Object *toolbar_setting_popup_area;
245 Evas_Object *setting_ctxpopup;
246 Evas_Object *ctxpopup_area;
248 Evas_Object *edit_shortcuts_popup;
249 Evas_Object *edit_shortcuts_popup_ctx;
250 Evas_Object *edit_shortcuts_popup_scroll;
251 Evas_Object *edit_shortcuts_popup_description;/*note: text part*/
253 Evas_Object *tip_popup;
258 Evas_Object *layout_edje;
259 Evas_Object *gengrid;
260 Eina_List *item_list;
264 Evas_Object *progress_popup;
265 Evas_Object *progress_popup_bar;
267 Ecore_Event_Handler *key_up;
268 Ecore_Event_Handler *key_down;
269 Ecore_Event_Handler *mouse_up;
270 Ecore_Event_Handler *mouse_down;
272 Ecore_Idler *recording_commit;
274 /* Idle handler of capture callback. wh01.cho@samsung.com. 2010-12-15. */
275 Ecore_Idler *still_captured_idle;
276 Ecore_Idler *capture_idle;
277 GList *capture_cb_list;
279 Ecore_Timer *rec_icon_updater;
280 Ecore_Timer *rec_time_updater;
281 Ecore_Timer *rec_pause_timer;
283 Ecore_Timer *check_af_timer;
284 Ecore_Timer *continuous_shot_timer;
285 Ecore_Timer *shutter_long_tap_timer; /*long tap timer for AF*/
286 gboolean emit_continuous_shutter; /*record: continous have been emitted*/
287 gboolean continuous_shot_by_hard_key; /* continuous shot triggered by hard key */
289 Evas_Object *waring_popup;
290 Evas_Object *confirm_popup;
294 Ecore_Idler *auto_shot_idle;
298 Evas_Object *bestshot_thumbnails_edje;
301 Ecore_Timer *timeout_checker;
302 Ecore_Timer *setting_toolbar_hide_timer;
304 Ecore_Timer *gps_animation_timer;
305 Ecore_Timer *battery_animation_timer;
307 Ecore_Timer *continuous_af_timer;
308 Ecore_Timer *focus_guide_hide_timer;
312 bool timer_activated;
313 Ecore_Timer *timer_timer;
315 Evas_Object *timer_icon_edje;
317 CamAppData *camapp_handle;
318 ShortCutData *shortcut_data; /*save now moving or touch shortcut*/
319 ShortCutData *swap_data; /*save now covering shortcuts*/
323 /* ug service mime type*/
326 CamExeArgs *exe_args;
328 /* Thread for file register */
329 pthread_t file_reg_thread;
330 pthread_mutex_t file_reg_mutex;
331 pthread_cond_t file_reg_cond;
332 GQueue *file_reg_queue;
334 pthread_t camera_start_thread;
336 ui_gadget_h camera_ug;
338 ui_gadget_h imageviewer_ug;
339 gboolean ug_is_deleting_process; /*note: now ug is deleting process, and run into camera preview process*/
340 service_h imageviewer_service;
342 ui_gadget_h location_ug;
347 Ecore_Idler *update_thumbnail_idler;
349 Ecore_Timer *longpress_timer;
352 int cancel_key_press;
355 gboolean path_in_return;
356 int displayed_setting_popup;
357 int enable_mode_change;
358 int stop_continuous_shot;
359 /*check out low battery */
360 gboolean battery_status;
361 /*check torch light*/
362 gboolean torchlight_on;
367 #ifdef USE_CAMERA_APP_SHUTTER_SOUND
370 int last_camera_zoom_mode;
373 Evas_Object *shot_mode_guide_popup;
375 service_h service_handle;
376 cam_menu_composer* setting_menu_composer;
377 cam_menu_composer* sub_menu_composer;
379 /*note: remained_count*/
382 CamErrorType error_type;
388 gboolean open_cam_ext_handle();
389 void close_cam_ext_handle();
390 gboolean cam_toolbar_menu_config_init(void *data, int mode);
391 gboolean cam_toolbar_menu_config_update(void *data);
393 #endif /* __DEF_CAM_H__ */