NABI issue 43925
[apps/osp/Camera.git] / src / CmCameraForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file                CmCameraForm.cpp
19  * @brief               This is the implementation file for CameraForm class.
20  */
21
22 #include "CmCameraApp.h"
23 #include "CmCameraForm.h"
24 #include "CmCameraStarterThread.h"
25 #include "CmCameraPresentationModel.h"
26 #include "CmCameraSettingsPresentationModel.h"
27
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Base::Runtime;
32 using namespace Tizen::Content;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Io;
35 using namespace Tizen::Media;
36 using namespace Tizen::System;
37 using namespace Tizen::Telephony;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41
42 static const int INDEX_FREE_SPACE_BUFFER_LEN = 10;
43 static const int MAX_CAMERA_EXPOSURE_VALUE = 8;
44 static const int CAMERA_EXPOSURE_VALUE_ZERO = 0;
45 static const int CAMERA_EXPOSURE_VALUE_ONE = 1;
46 static const int SLIDER_RECTVALID_X_POS = 430;
47 static const int CAMERA_EXPOSURE_TIMER_VALUE = 2000;
48 static const int CAMERA_SCREEN_OVERLAY_HELP_TIMER_VALUE = 3000;
49 static const int CAMERA_GUIDELINE_ENABLE = 1;
50 static const int FLASH_MODE_OFF = 0;
51 static const int FLASH_MODE_ON = 1;
52 static const int FLASH_MODE_AUTO = 2;
53 static const int X_ACTION_PANEL_SHUTTER_ICON_LANDSCAPE_HD = 20;
54 static const int Y_ACTION_PANEL_SHUTTER_ICON_LANDSCAPE_HD = 73;
55 static const int X_ACTION_PANEL_SHUTTER_ICON_PORTRAIT_HD = 73;
56 static const int Y_ACTION_PANEL_SHUTTER_ICON_PORTRAIT_HD = 20;
57 static const int X_EXPOSURE_PANEL_SIDER_LANDSCAPE = 40;
58 static const int Y_EXPOSURE_PANEL_SIDER_LANDSCAPE = 190;
59 static const int W_EXPOSURE_PANEL_SIDER_LANDSCAPE = 60;
60 static const int H_EXPOSURE_PANEL_SIDER_LANDSCAPE = 336;
61 static const int X_EXPOSURE_PANEL_SIDER_PORTRAIT = 190;
62 static const int Y_EXPOSURE_PANEL_SIDER_PORTRAIT = 40;
63 static const int W_EXPOSURE_PANEL_SIDER_PORTRAIT = 336;
64 static const int H_EXPOSURE_PANEL_SIDER_PORTRAIT = 60;
65 static const int OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON = 20;
66 static const int FONT_SIZE_SETTING_MENU_ITEM = 34;
67 static const int FONT_SIZE_SETTING_SUB_MENU_ITEM = 34;
68 static const int H_SETTING_MENU_TITLE_TOP_MARGIN_PORTRAIT = 26;
69 static const int H_SETTING_MENU_TITLE_TOP_MARGIN_LANDSCAPE = 94;
70 static const int H_SETTING_MENU_PANEL_TITLE = 50;
71 static const int H_SETTING_MENU_ITEM = 65;
72 static const int X_SETTING_MENU_LIST_PORTRAIT = 36;
73 static const int Y_SETTING_MENU_LIST_PORTRAIT = 135;
74 static const int W_SETTING_MENU_LIST_PORTRAIT = 538;
75 static const int H_SETTING_MENU_LIST_PORTRAIT = 380;
76 static const int H_SETTING_MENU_LIST_MARGIN = 200;
77 static const int X_SETTING_MENU_LIST_LANDSCAPE = 38;
78 static const int Y_SETTING_MENU_LIST_LANDSCAPE = 74;
79 static const int Y_SETTING_MENU_LIST_LANDSCAPE_MARGIN = 130;
80 static const int W_SETTING_MENU_LIST_LANDSCAPE = 538;
81 static const int H_SETTING_MENU_LIST_LANDSCAPE = 360;
82 static const int X_SETTING_MENU_CONTESTS = 34;
83 static const int Y_SETTING_MENU_CONTESTS = 0;
84 static const int W_SETTING_MENU_CONTESTS = 280;
85 static const int H_SETTING_MENU_CONTESTS = 65;
86 static const int X_SETTING_MENU_CONTENTS_VALUE = 280;
87 static const int Y_SETTING_MENU_CONTENTS_VALUE = 0;
88 static const int W_SETTING_MENU_CONTENTS_VALUE = 290;
89 static const int H_SETTING_MENU_CONTENTS_VALUE = 65;
90 static const int H_SETTING_SUBMENU_ITEM = 88;
91 static const int X_FLASH_SETTING_SUBMENU_RADIO_ICON_MARGIN = 390;
92 static const int X_WHITE_BALANCE_RADIO_ICON_MARGIN = 376;
93 static const int X_SETTING_SUBMENU_RADIO_ICON = 0;
94 static const int X_SETTING_SUBMENU_RADIO_ICON_MARGIN = 350;
95 static const int Y_SETTING_SUBMENU_RADIO_ICON = 0;
96 static const int W_SETTING_SUBMENU_RADIO_ICON = 84;
97 static const int H_SETTING_SUBMENU_RADIO_ICON = 84;
98 static const int X_SETTING_SUBMENU_ICON_ZERO = 0;
99 static const int X_SETTING_SUBMENU_ICON = 75;
100 static const int X_SETTING_SUBMENU_ICON_MARGIN = 65;
101 static const int Y_SETTING_SUBMENU_ICON = 0;
102 static const int W_SETTING_SUBMENU_ICON = 88;
103 static const int H_SETTING_SUBMENU_ICON = 88;
104 static const int X_SETTING_SUBMENU_2TEXT_ITEM = 75;
105 static const int Y_SETTING_SUBMENU_2TEXT_ITEM = 0;
106 static const int W_SETTING_SUBMENU_2TEXT_ITEM = 320;
107 static const int H_SETTING_SUBMENU_2TEXT_ITEM = 84;
108 static const int X_SETTING_SUBMENU_3TEXT_ITEM = 165;
109 static const int X_FLASH_SETTING_SUBMENU_3TEXT_ITEM = 57;
110 static const int X_SETTING_SUBMENU_3TEXT_ITEM_MARGIN = 70;
111 static const int Y_SETTING_SUBMENU_3TEXT_ITEM = 0;
112 static const int W_SETTING_SUBMENU_3TEXT_ITEM = 250;
113 static const int H_SETTING_SUBMENU_3TEXT_ITEM = 84;
114 static const int X_SUBMENU_PANEL_START_PORTRAIT = 170;
115 static const int X_SUBMENU_PANEL_START_LANDSCAPE = 340;
116 static const int Y_SUBMENU_PANEL_OFFSET_PORTRAIT = 150;
117 static const int X_SUBMENU_TIMER_MODE_PANEL = 340;
118 static const int Y_SUBMENU_TIMER_MODE_PANEL = 120;
119 static const int W_SUBMENU_TIMER_MODE_PANEL = 460;
120 static const int H_SUBMENU_TIMER_MODE_PANEL = 445;
121 static const int X_SUBMENU_TIMER_MODE_LIST = 20;
122 static const int Y_SUBMENU_TIMER_MODE_LIST = 64;
123 static const int W_SUBMENU_TIMER_MODE_LIST = 431;
124 static const int H_SUBMENU_TIMER_MODE_LIST = 420;
125 static const int X_SUBMENU_ISO_MODE_PANEL = 340;
126 static const int Y_SUBMENU_ISO_MODE_PANEL = 205;
127 static const int W_SUBMENU_ISO_MODE_PANEL = 460;
128 static const int X_SUBMENU_ISO_MODE_LIST = 20;
129 static const int Y_SUBMENU_ISO_MODE_LIST = 64;
130 static const int H_SUBMENU_ISO_MODE_PANEL_MARGIN = 88;
131 static const int W_SUBMENU_ISO_MODE_LIST = 431;
132 static const int H_SUBMENU_ISO_MODE_LIST_MARGIN = 90;
133 static const int X_SUBMENU_WB_MODE_PANEL = 340;
134 static const int Y_SUBMENU_WB_MODE_PANEL = 205;
135 static const int W_SUBMENU_WB_MODE_PANEL = 460;
136 static const int H_SUBMENU_WB_MODE_PANEL_MARGIN = 88;
137 static const int X_SUBMENU_WB_MODE_LIST = 20;
138 static const int Y_SUBMENU_WB_MODE_LIST = 64;
139 static const int W_SUBMENU_WB_MODE_LIST = 431;
140 static const int H_SUBMENU_WB_MODE_LIST = 90;
141 static const int W_SUBMENU_WB_MODE_LIST_MARGIN = 90;
142 static const int X_SUBMENU_GUIDELINE_MODE_PANEL = 340;
143 static const int Y_SUBMENU_GUIDELINE_MODE_PANEL = 260;
144 static const int W_SUBMENU_GUIDELINE_MODE_PANEL = 460;
145 static const int H_SUBMENU_GUIDELINE_MODE_PANEL = 265;
146 static const int X_SUBMENU_GUIDELINE_MODE_LIST = 20;
147 static const int Y_SUBMENU_GUIDELINE_MODE_LIST = 64;
148 static const int W_SUBMENU_GUIDELINE_MODE_LIST = 431;
149 static const int H_SUBMENU_GUIDELINE_MODE_LIST = 240;
150 static const int X_SUBMENU_STORAGE_MODE_PANEL = 340;
151 static const int Y_SUBMENU_STORAGE_MODE_PANEL = 320;
152 static const int W_SUBMENU_STORAGE_MODE_PANEL = 460;
153 static const int H_SUBMENU_STORAGE_MODE_PANEL = 265;
154 static const int X_SUBMENU_STORAGE_MODE_LIST = 20;
155 static const int Y_SUBMENU_STORAGE_MODE_LIST = 64;
156 static const int W_SUBMENU_STORAGE_MODE_LIST = 431;
157 static const int H_SUBMENU_STORAGE_MODE_LIST = 240;
158 static const int X_FLASH_MODE_SETTING_LIST_LANDSCAPE = 38;
159 static const int Y_FLASH_MODE_SETTING_LIST_LANDSCAPE = 94;
160 static const int Y_FLASH_MODE_SETTING_LIST_LANDSCAPE_MARGIN = 150;
161 static const int W_FLASH_MODE_SETTING_LIST_LANDSCAPE = 480;
162 static const int H_FLASH_MODE_SETTING_LIST_LANDSCAPE = 350;
163 static const int H_WHITE_BALANC_SETTING_LIST_LANDSCAPE_MARGIN = 200;
164 static const int X_FLASH_MODE_SETTING_LIST_PORTRAIT = 112;
165 static const int Y_FLASH_MODE_SETTING_LIST_PORTRAIT = 85;
166 static const int Y_FLASH_MODE_SETTING_LIST_PORTRAIT_MARGIN = 50;
167 static const int W_FLASH_MODE_SETTING_LIST_PORTRAIT = 480;
168 static const int H_FLASH_MODE_SETTING_LIST_PORTRAIT = 350;
169 static const int H_WHITE_BALANC_SETTING_LIST_PORTRAIT_MARGIN = 200;
170 static const int H_FLASH_MODE_TITLE_TOP_MARGIN = 28;
171 static const int X_FLASH_MODE_LIST_START_POS_PORTRAIT = 288;
172 static const int CAMERA_PANEL_SUM_SIZE = 320;
173 static const int PREVIEW_OVERLAY_PANEL_SIZE = 960;
174 static const int PREVIEW_OVERLAY_PANEL_SIZE_MARGIN = 80;
175 static const int X_PREVIEW_OVERLAY_PORTRAIT = 0;
176 static const int Y_PREVIEW_OVERLAY_PORTRAIT = 160;
177 static const int W_PREVIEW_OVERLAY_PORTRAIT = 720;
178 static const int H_PREVIEW_OVERLAY_PORTRAIT = 960;
179 static const int W_FULL_PREVIEW_OVERLAY_PORTRAIT = 720;
180 static const int X_PREVIEW_OVERLAY_LANDSCAPE = 160;
181 static const int Y_PREVIEW_OVERLAY_LANDSCAPE = 0;
182 static const int W_PREVIEW_OVERLAY_LANDSCAPE = 960;
183 static const int H_PREVIEW_OVERLAY_LANDSCAPE = 720;
184 static const int W_FULL_PREVIEW_OVERLAY_LANDSCAPE = 1280;
185 static const int W_THUMBNAIL_SCALE_SIZE = 80;
186 static const int H_THUMBNAIL_SCALE_SIZE = 80;
187 static const int X_THUMBNAIL_BUTTON_IMG = 14;
188 static const int Y_THUMBNAIL_BUTTON_IMG = 14;
189 static const int X_BASE_POS = 0;
190 static const int Y_BASE_POS = 0;
191 static const int BITS_PER_BYTE = 8;
192 static const int BYTE_BUFFER_START_POS = 0;
193 static const int BYTE_ARRAY_START_POS = 0;
194 static const int CAMERA_TIMER_ONE_MILLI_SEC = 1;
195 static const int FRAME_SKIP = 4;
196 static const int REG_DEFAULT_VAULE_ZERO = 0;
197 static const int STORAGE_VALUE_ZERO = 0;
198 static const int STORAGE_DISPLAY_PLACE = 300;
199 static const int DIVIDE_BY_TWO = 2;
200 static const int INDEX_UNIT_TWENTY = 20;
201 static const int INDEX_UNIT_ZERO = 0;
202 static const int INDEX_UNIT_ONE = 1;
203 static const int DEVICE_PORTRAIT = 1;
204 static const int CAMERA_FOCUS_NOT_READY = 0;
205 static const int CAMERA_FOCUS_READY = 1;
206 static const int CAMERA_FOCUS_FAIL = 2;
207 static const int CAMERA_TIMER_LIMIT = 120000;
208 static const int SETTING_TIMER_CAPTURE_0_SEC = 0;
209 static const int SETTING_TIMER_CAPTURE_2_SEC = 1;
210 static const int SETTING_TIMER_CAPTURE_5_SEC = 2;
211 static const int SETTING_TIMER_CAPTURE_10_SEC = 3;
212 static const int SETTING_TIMER_2_SEC_COUNT = 2;
213 static const int SETTING_TIMER_5_SEC_COUNT = 5;
214 static const int SETTING_TIMER_10_SEC_COUNT = 10;
215 static const int CAMERA_CHARGING_TIMER = 1000;
216 static const int PREVIEW_FAIL_TIMER = 1000;
217 static const int CAMERA_TIMER_1_SEC = 1000;
218 static const int CAMERA_TIMER_2_SEC = 2000;
219 static const int CAMERA_TIMER_5_SEC = 5000;
220 static const int CAMERA_TIMER_10_SEC = 10000;
221 static const int SUBMENU_ISO_AUTO = 0;
222 static const int SUBMENU_ISO_100 = 1;
223 static const int SUBMENU_ISO_200 = 2;
224 static const int SUBMENU_ISO_400 = 3;
225 static const int SUBMENU_ISO_800 = 4;
226 static const int SUBMENU_GUIDELINE_OFF = 0;
227 static const int SUBMENU_GUIDELINE_ON = 1;
228 static const int SUBMENU_MODE_OFF = 0;
229 static const int SUBMENU_MODE_ON = 1;
230 static const int SUBMENU_MODE_AUTO = 2;
231 static const int SUBMENU_STORAGE_TYPE_PHONE = 0;
232 static const int SUBMENU_STORAGE_TYPE_MEMORYCARD = 1;
233 static const int SUBMENU_TIMER_COUNT = 4;
234 static const int MAX_ISO_COUNT= 9;
235 static const int SUBMENU_GUIDELINE_COUNT = 2;
236 static const int SUBMENU_STORAGE_TYPE_COUNT = 2;
237 static const int MAX_SUBMENU_CONTENT = 10;
238 static const int DRAW_INITIALIZED = 0;
239 static const int DRAW_MOVED = 1;
240 static const int DRAW_RELEASED = 2;
241 static const int DISABLE_GUIDELINE = 0;
242 static const int EXPOSURE_TIMER_IS_ALIVE = 1;
243 static const int MAX_SETTING_MENU_COUNT = 2;
244 static const int MAX_GENERAL_TAB_SETTING_MENU_COUNT = 5;
245 static const int MAX_FLASH_MENU_COUNT = 3;
246 static const int MAX_WHITE_BALANCE_MENU_COUNT = 5;
247 static const int MENU_COUNT_CLEAR = 0;
248 static const int MENU_MODE_DISABLE = -1;
249 static const int MENU_TWO_ELEMENT = 2;
250 static const int MENU_THREE_ELEMENT = 3;
251
252 static const int UI_INDICATOR_STORAGE_FREE_SPACE_BUFFER_LEN = 2048;
253 static const int MULTIPLY_BY_TEN = 10;
254 static const int NORMAL_MODE_RATIO = 13;
255 static const int PREVIEW_RESOLOTION_WIDTH = 640;
256 static const int PREVIEW_RESOLOTION_HEIGHT = 480;
257 static const int MODE_AUTO = 0;
258 static const int MODE_WHITEBALANCE_INCANDESCENT = 1;
259 static const int MODE_FLUORESCENT = 2;
260 static const int MODE_DAYLIGHT = 3;
261 static const int MODE_CLOUDY = 4;
262 static const int X_INDICATOR_BATTERY_PORTRAIT = 300;
263 static const int Y_INDICATOR_BATTERY_PORTRAIT = 4;
264 static const int X_INDICATOR_BATTERY_LANDSCAPE = 582;
265 static const int Y_INDICATOR_BATTERY_LANDSCAPE = 4;
266 static const int X_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_PORTRAIT = 10;
267 static const int Y_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_PORTRAIT = 7;
268 static const int X_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_LANDSCAPE = 7;
269 static const int Y_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_LANDSCAPE = 55;
270 static const int UNIT_VALUE_ZERO = 0;
271 static const int DISPLAY_WVGA = 1200;
272 static const int SCREEN_OVERLAY_HELP_ENABLE = 1;
273 static const int SCREEN_OVERLAY_HELP_DISABLE = 0;
274 static const int BACK_BUTTON_X_POS = 63;
275 static const int BACK_BUTTON_Y_POS = 63;
276 static const int STRING_BUFFER_SIZE = 32;
277 static const int SUPPORTED_CAMERA_NUM = 1;
278
279 static const int BRIGHTNESS_DIVIDER_PORTRAIT_MODE = 31;
280
281 static const wchar_t* IDS_MENU_SETTING_MAIN_MENU_NAME = L"SettingMainMenu";
282 static const wchar_t* IDS_MENU_SETTING_GEN_MAIN_MENU_NAME = L"SettingGenMainMenu";
283 static const wchar_t* IDS_GENERAL_SETTING_SUB_MENU= L"GeneralSettingsSubMenu";
284 static const wchar_t* IDS_CAMERA_SETTING_SUB_MENU= L"CameraSettingsSubMenu";
285 static const wchar_t* IDS_MENU_WB_MENU_NAME = L"WBMenu";
286 static const wchar_t* IDS_WB_BUTTON_NAME = L"WhiteBalanceButton";
287 static const wchar_t* IDS_MENU_FLASH_MENU_NAME  = L"FlashMenu";
288 static const wchar_t* IDS_FLASH_BUTTON_NAME = L"FlashButton";
289 static const wchar_t* IDS_THUMBNAIL_PANLE_NAME = L"ThumbnailPanel";
290 static const wchar_t* IDS_CAMERA_INFO_PANEL_NAME = L"CameraInfoPanel";
291 static const wchar_t* IDS_SETTING_UI_PANEL_NAME = L"SettingPanel";
292 static const wchar_t* IDS_ACTION_UI_PANEL_NAME = L"ActionPanel";
293 static const wchar_t* IDS_ACTION_UI_PANEL_CAPTURE_NAME = L"ActionCapture";
294 static const wchar_t* IDS_ACTION_UI_CAMERA_MODE = L"ActionCameraMode";
295 static const wchar_t* IDS_INIT_REG_KEY = L"NONE";
296 static const wchar_t* PHOTO_SIZE_640_480 = L"640X480(4:3)";
297 static const wchar_t* PHOTO_SIZE_1280_720 = L"1280X720(16:9)";
298 static const wchar_t* PHOTO_SIZE_3264_2488 = L"3264X2448(4:3)";
299 static const wchar_t* PHOTO_SIZE_3264_2176 = L"3264X2176(16:9)";
300 static const wchar_t* PHOTO_SIZE_3264_1836 = L"3264X1836(16:9)";
301 static const wchar_t* PHOTO_SIZE_2048_1536 = L"2048X1536(4:3)";
302 static const wchar_t* PHOTO_SIZE_2048_1152 = L"2048X1152(16:9)";
303
304 CameraForm::CameraForm(void)
305         : __pOverlayPanel(null)
306         , __screenMode(SCREEN_MODE_NORMAL)
307         , __cameraTabMainMenuCount(MENU_MODE_DISABLE)
308         , __cameraTabSubMenuCount(MENU_MODE_DISABLE)
309         , __cameraTabSettingMode(CAMERA_TAB_SUB_MENU_CONTENT_MAX)
310         , __generalTabMainMenuCount(MENU_MODE_DISABLE)
311         , __generalTabSubMenuCount(MENU_MODE_DISABLE)
312         , __generalTabSettingMode(GENERAL_TAB_SUB_MENU_CONTENT_MAX)
313         , __settingWhiteBalance(0)
314         , __settingIsoIndex(0)
315         , __settingTimeInterval(0)
316         , __settingExposure(0)
317         , __primaryCurrentResolutionIndex(0)
318         , __secondaryCurrentResolutionIndex(0)
319         , __isTimerRunning(false)
320         , __previewResolutionWidth(0)
321         , __previewResolutionHeight(0)
322         , __captureResolutionWidth(0)
323         , __captureResolutionHeight(0)
324         , __lowMemoryCapacity(false)
325         , __isMemoryFull(false)
326         , __isLockScreenMode(false)
327         , __resolutionChange(false)
328         , __isToggleCameraDirection(false)
329         , __isOrientationChanged(false)
330         , __isProhibitionTouchEvent(false)
331         , __pSettingPanel(null)
332         , __pActionPanel(null)
333         , __dir(ORIENTATION_STATUS_NONE)
334         , __deviceOrientation(DEVICE_PORTRAIT)
335         , __pSettingLine(null)
336         , __pCameraIconLabel(null)
337         , __pCamcoderIconLabel(null)
338         , __pShutterButton(null)
339         , __pThumbnailButton(null)
340         , __pBatteryState(null)
341         , __pButtonPoint(Point(0, 0))
342         , __pPreviewResolutionList(null)
343         , __pCaptureResolutionList(null)
344         , __pIsoList(null)
345         , __pSettingMenuString(null)
346         , __pSettingGeneralMenuString(null)
347         , __pCameraStarterThread(null)
348         , __pCameraSetting(null)
349         , __pGeneralSetting(null)
350         , __pCameraSettingLable(null)
351         , __pGeneralSettingLable(null)
352         , __pFileEventManager(null)
353         , __uri(L"")
354         , __mime(L"")
355         , __formStatusFrameDeattivated(false)
356 {
357         AppLogDebug("ENTER");
358         AppLogDebug("EXIT");
359 }
360
361 CameraForm::~CameraForm(void)
362 {
363         AppLogDebug("ENTER");
364         AppLogDebug("EXIT");
365 }
366
367 result
368 CameraForm::OnInitializing(void)
369 {
370         AppLogDebug("ENTER");
371         result r = E_SUCCESS;
372         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
373                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
374         Rectangle rectPanel = Rectangle(0, 0, W_FULL_PREVIEW_OVERLAY_LANDSCAPE, X_PREVIEW_OVERLAY_LANDSCAPE);
375         Point currentPosition;
376         int storageType = STORAGE_TYPE_PHONE;
377         int timerInterval = 0;
378         String filePath = L"";
379
380         _appControlActionCompleted = false;
381         __formStatusFrameDeattivated = false;
382
383         SetFormBackEventListener(this);
384         AddOrientationEventListener(*this);
385         SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
386         __dir = GetOrientationStatus();
387         __deviceOrientation = __dir;
388         AppLogDebug("__dir = %d && __deviceOrientation = %d", __dir, __deviceOrientation);
389
390         _pCameraPresentationModel->SetOrientation(__dir);
391         _pCurrentSourceForm = SOURCE_FORM_CAMERA;
392
393         InitAppTimer();
394         InitPreviewFailPopupTimer();
395         InitIntervalValueTimer();
396         InitCaptureStartTimer();
397         InitTouchAutoFocusStartTimer();
398         InitChargingTimer();
399         InitChargingCompletedTimer();
400
401         r = _pCameraPresentationModel->GetValue(STORAGE_TYPE, storageType);
402         if (r != E_SUCCESS)
403         {
404                 storageType = STORAGE_TYPE_PHONE;
405         }
406
407         if (storageType == STORAGE_TYPE_MEMORYCARD && _pCameraPresentationModel->IsStorageCardMounted() == false)
408         {
409                 r = _pCameraPresentationModel->SetValue(STORAGE_TYPE, STORAGE_TYPE_PHONE);
410                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
411                 _pCameraPresentationModel->SetStorageCardState(CameraPresentationModel::STORAGE_CARD_STATE_UNMOUNT);
412         }
413
414         r = _pCameraPresentationModel->GetValue(STORAGE_TYPE, storageType);
415         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
416
417         r = _pCameraPresentationModel->GetValue(TIMER_INTERVAL, timerInterval);
418         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
419
420         _pCameraInfoPanel = new (std::nothrow) CameraInfoPanel();
421         TryCatch(_pCameraInfoPanel != null, r = E_FAILURE, "_pCameraInfoPanel is null");
422
423         if (__dir == ORIENTATION_STATUS_PORTRAIT
424                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
425         {
426                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
427                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
428                 currentPosition.x = (rect.width / DIVIDE_BY_TWO);
429                 currentPosition.y = (rect.height / DIVIDE_BY_TWO);
430         }
431         else
432         {
433                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
434                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
435                 currentPosition.x = (rect.width / DIVIDE_BY_TWO);
436                 currentPosition.y = (rect.height / DIVIDE_BY_TWO);
437         }
438
439         if (__dir == ORIENTATION_STATUS_PORTRAIT
440                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
441         {
442                 rectPanel = Rectangle(X_BASE_POS, Y_BASE_POS, W_FULL_PREVIEW_OVERLAY_PORTRAIT, X_PREVIEW_OVERLAY_LANDSCAPE);
443         }
444         else
445         {
446                 rectPanel = Rectangle(X_BASE_POS, Y_BASE_POS, W_FULL_PREVIEW_OVERLAY_LANDSCAPE, X_PREVIEW_OVERLAY_LANDSCAPE);
447         }
448
449         r = _pCameraInfoPanel->Initialize(rect);
450         TryCatch(r == E_SUCCESS, , "_pCameraInfoPanel Initialize fail[%s]", GetErrorMessage(r));
451
452         _pCameraInfoPanel->SetCurrentPoint(currentPosition);
453         _pCameraInfoPanel->SetDrawMarkerFocus(true);
454         _pCameraInfoPanel->SetDrawMarkerFocusType(CAMERA_FOCUS_NOT_READY);
455         _pCameraInfoPanel->SetPreviewResolutionSize(REG_DEFAULT_VAULE_ZERO);
456         _pCameraInfoPanel->SetCurrentMode(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
457         _pCameraInfoPanel->SetStorageType(storageType);
458         _pCameraInfoPanel->SetTimerType(timerInterval);
459         _pCameraInfoPanel->SetDrawIndicator(true);
460         _pCameraInfoPanel->SetDrawIndicatorStroageInfo(false);
461         _pCameraInfoPanel->AddTouchEventListener(*this);
462         _pCameraInfoPanel->SetName(IDS_CAMERA_INFO_PANEL_NAME);
463         AddOrientationEventListener(*_pCameraInfoPanel);
464         AddControl(_pCameraInfoPanel);
465         SetControlAlwaysOnTop(*_pCameraInfoPanel, true);
466
467         SetBackgroundColor(COLOR_PANEL_BACKGROUND_BLACK);
468         InitSettingMenuPanel();
469         InitActionMenuPanel();
470         InitScreenOverlayHelp();
471         CheckBatteryStatus();
472
473         HideUiPanel(false);
474
475         __pFileEventManager = new (std::nothrow) FileEventManager();
476         r = __pFileEventManager->Construct(*this);
477         TryCatch(r == E_SUCCESS, , "__pFileEventManager Construct fail[%s]", GetErrorMessage(r));
478
479         filePath = _pCameraPresentationModel->GetfilePath(storageType);
480         AppLogDebug("filePath %ls", filePath.GetPointer());
481
482         if (File::IsFileExist(filePath))
483         {
484                 r = __pFileEventManager->AddPath(filePath, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
485                 __pFileEventPath = filePath;
486         }
487         AppLogDebug("FileEventManager()::AddPath() fail[%s]", GetErrorMessage(r));
488
489
490         r = _pCameraPresentationModel->GetValue(PRIMARY_RESOLUTION_INDEX, __primaryCurrentResolutionIndex);
491         r = _pCameraPresentationModel->GetValue(SECONDARY_RESOLUTION_INDEX, __secondaryCurrentResolutionIndex);
492
493         AppLogDebug("EXIT");
494         return r;
495
496 CATCH:
497         if (_pCameraInfoPanel)
498         {
499                 delete _pCameraInfoPanel;
500                 _pCameraInfoPanel = null;
501         }
502
503         ShowCameraFailPopup();  
504
505         AppLogDebug("EXIT - CATCH");
506         return r;
507 }
508
509 result
510 CameraForm::OnTerminating(void)
511 {
512         AppLogDebug("ENTER");
513         result r = E_SUCCESS;
514
515         _pCameraPresentationModel->KeepScreenOnState(false, true);
516
517         _pCameraPresentationModel->RemovePresentationChangedEventListener(null);
518
519         if (_pCameraInfoPanel != null)
520         {
521                 _pCameraInfoPanel->SetDrawIndicatorStroageInfo(false);
522         }
523
524         RemoveAllEventListener();
525
526         _pCameraPresentationModel->SetStorageCardChageState(CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN);
527
528         r = _pCameraPresentationModel->SetValue(OVERLAY_HELP_ENABLE, SCREEN_OVERLAY_HELP_DISABLE);
529         AppLogDebug("SetValue Reg Fail[%s]", GetErrorMessage(r));
530
531         if (__isLockScreenMode)
532         {
533                 AppLogDebug("OnTerminating KEY_POWER_HOLD");
534
535                 __isLockScreenMode = false;
536         }
537
538         __lowMemoryCapacity = false;
539
540         __isTimerRunning = false;
541
542         _pCameraPresentationModel->SetIntervalTimerRun(false);
543
544         __resolutionChange = false;
545
546         __isToggleCameraDirection = false;
547
548         __isOrientationChanged = false;
549
550         __isProhibitionTouchEvent = false;
551
552         _pCameraPresentationModel = null;
553         __pCameraStarterThread = null;
554
555         __formStatusFrameDeattivated = false;
556
557         DeleteTimer();
558
559         if (__pPreviewResolutionList)
560         {
561                 __pPreviewResolutionList->RemoveAll(true);
562                 delete __pPreviewResolutionList;
563         }
564
565         if (__pCaptureResolutionList)
566         {
567                 __pCaptureResolutionList->RemoveAll(true);
568                 delete __pCaptureResolutionList;
569         }
570
571         if (__pIsoList)
572         {
573                 __pIsoList->RemoveAll(true);
574                 delete __pIsoList;
575         }
576
577         if (__pSettingMenuString)
578         {
579                 int idx = 0;
580                 for (idx = 0; idx < MAX_SETTING_MENU_COUNT; ++idx)
581                 {
582                         delete [] __pSettingMenuString[idx];
583                 }
584                 delete __pSettingMenuString;
585         }
586
587         if (__pSettingGeneralMenuString)
588         {
589                 int idx = 0;
590                 for (idx = 0; idx < MAX_GENERAL_TAB_SETTING_MENU_COUNT; ++idx)
591                 {
592                         delete [] __pSettingGeneralMenuString[idx];
593                 }
594                 delete __pSettingGeneralMenuString;
595         }
596
597         if (__pFileEventManager != null)
598         {
599                 delete __pFileEventManager;
600                 __pFileEventManager = null;
601         }
602
603         AppLogDebug("EXIT");
604         return r;
605 }
606
607 void
608 CameraForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
609 {
610         AppLogDebug("ENTER");
611         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
612                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
613         Rectangle clientRect = GetClientAreaBounds();
614         result r = E_SUCCESS;
615         int regVal = 0;
616         Dimension previewResolutionDim;
617         Dimension captureResolutionDim;
618         int previewResolutionSize = 0;
619
620         int storageType = STORAGE_TYPE_PHONE;
621         BufferInfo bufferinfo;
622         bool isRunStartPreviewThread = false;
623         bool isInitCameraStaus = false;
624         bool isCharging = false;
625         BatteryLevel batteryLevel;
626
627         __isTimerRunning = false;
628
629         _pCameraPresentationModel->SetIntervalTimerRun(false);
630
631         StartInitAppTimer();
632
633         StartPreviewFailPopupTimer();
634
635         _batteryStatus = GetCurrentBatteryState();
636         AppLogDebug("_batteryStatus [%d]", _batteryStatus);
637
638         StartInitChargingTimer();
639
640         _pCameraPresentationModel->AddPresentationChangedEventListener(*this);
641
642         _pCameraPresentationModel->KeepScreenOnState(true, false);
643
644         r = _pCameraPresentationModel->SetMode(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
645         TryReturnVoid(r == E_SUCCESS, "SetMode() failed:%s", GetErrorMessage(r));
646
647         Update();
648
649         previewResolutionDim = _pCameraPresentationModel->GetPreviewResolution();
650
651         AppLogDebug("CameraForm::GetPreviewResolution(W:%d, H:%d)", previewResolutionDim.width, previewResolutionDim.height);
652
653         __previewResolutionWidth = previewResolutionDim.width;
654         __previewResolutionHeight = previewResolutionDim.height;
655
656         captureResolutionDim = _pCameraPresentationModel->GetCaptureResolution();
657
658         __captureResolutionWidth = captureResolutionDim.width;
659         __captureResolutionHeight = captureResolutionDim.height;
660
661         AppLogDebug("CameraForm::captureResolutionDim(W:%d, H:%d)", captureResolutionDim.width, captureResolutionDim.height);
662
663         if (__pOverlayPanel)
664         {
665                 RemoveControl(__pOverlayPanel);
666                 __pOverlayPanel = null;
667         }
668
669         AppLogDebug("__screenMode [%d]", __screenMode);
670
671         r = SetScreenMode(__screenMode, true);
672         TryReturnVoid(r == E_SUCCESS, "SetScreenMode() failed:%s", GetErrorMessage(r));
673
674         if (__dir == ORIENTATION_STATUS_PORTRAIT
675                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
676         {
677                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
678                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
679         }
680         else
681         {
682                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
683                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
684         }
685
686         if (_pCameraInfoPanel->GetDrawPopupTimer() == true)
687         {
688                 _pCameraInfoPanel->SetDrawPopupTimer(false);
689
690                 _pCameraInfoPanel->Invalidate(true);
691         }
692
693         r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, regVal);
694         TryReturnVoid(r == E_SUCCESS, "Read Reg fail[%s]", GetErrorMessage(r));
695
696         if (regVal == DISABLE_GUIDELINE)
697         {
698                 DrawMarker(false);
699         }
700         else
701         {
702                 DrawMarker(true);
703         }
704
705         InDrawFocus();
706
707         r = _pCameraPresentationModel->SetValue(CURRENT_MODE, CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
708         TryReturnVoid(r == E_SUCCESS, "Write Reg fail[%s]", GetErrorMessage(r));
709
710         MakeSettingPopupTab(false);
711
712         HidePopup();
713
714         isInitCameraStaus = _pCameraPresentationModel->GetInitCameraStatus();
715         AppLogDebug("isInitCameraStaus [%d]", isInitCameraStaus);
716
717         if (isInitCameraStaus)
718         {
719                 isRunStartPreviewThread = (static_cast<CameraApp*>(UiApp::GetInstance()))->GetUsedRunStartPreviewThread();
720                 AppLogDebug("isRunStartPreviewThread [%d]", isRunStartPreviewThread);
721
722                 if (isRunStartPreviewThread)
723                 {
724                         r = RunStartPreviewThread();
725                         TryReturnVoid(r == E_SUCCESS, "RunStartPreviewThread fail[%s]", GetErrorMessage(r));
726
727                         (static_cast<CameraApp*>(UiApp::GetInstance()))->SetUsedRunStartPreviewThread(false);
728                 }
729                 else
730                 {
731                         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
732                         TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
733
734                         _pCameraPresentationModel->StartPreview(&bufferinfo);
735                 }
736
737                 _pCameraPresentationModel->SetContinuousAutoFocus();
738
739                 previewResolutionSize = __previewResolutionWidth * __previewResolutionHeight; 
740
741                 _pCameraInfoPanel->SetPreviewResolutionSize(previewResolutionSize);
742
743                 SetCameraSettingsDevice();
744         }
745
746         _pCameraPresentationModel->GetValue(STORAGE_TYPE, storageType);
747
748         if (storageType == STORAGE_TYPE_MEMORYCARD && _pCameraPresentationModel->IsStorageCardMounted() == false)
749         {
750                 r = _pCameraPresentationModel->SetValue(STORAGE_TYPE, STORAGE_TYPE_PHONE);
751                 _pCameraPresentationModel->SetStorageCardState(CameraPresentationModel::STORAGE_CARD_STATE_UNMOUNT);
752         }
753
754         batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
755         isCharging = _pCameraPresentationModel->IsCharging();
756
757         AppLogDebug("batteryLevel = %d", batteryLevel);
758         if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
759         {
760                 if (isCharging == false)
761                 {
762                         return;
763                 }
764         }
765
766         CheckBatteryStatus();
767
768         AppLogDebug("EXIT");
769 }
770
771 void
772 CameraForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
773 {
774         AppLogDebug("ENTER");
775         __isTimerRunning = false;
776
777         _pCameraPresentationModel->SetIntervalTimerRun(false);
778
779         __resolutionChange = false;
780
781         __isToggleCameraDirection = false;
782
783         __isOrientationChanged = false;
784
785         __isProhibitionTouchEvent = false;
786
787         OnHelpCloseTimerExpired();
788
789         CancelTimer();
790
791         MakeSettingPopupTab(false);
792
793         HideUiQuickMenu();
794
795         HideUiSettingMenu();
796
797         if (_isUsedTimerCaptured == true)
798         {
799                 _timeCount = 0;
800
801                 _isUsedTimerCaptured = false;
802
803                 if (_pCameraInfoPanel->GetDrawPopupTimer() == true)
804                 {
805                         _pCameraInfoPanel->SetDrawPopupTimer(false);
806
807                         _pCameraInfoPanel->Invalidate(true);
808                 }
809         }
810
811         if (_pCameraInfoPanel->GetDrawExposure() == true)
812         {
813                 _pCameraInfoPanel->SetDrawExposure(false);
814
815                 HidePopup();
816                 Invalidate(true);
817         }
818
819         if (__pOverlayPanel)
820         {
821                 RemoveControl(__pOverlayPanel);
822                 __pOverlayPanel = null;
823         }
824
825         _pCameraInfoPanel->SetDrawIndicatorStroageInfo(false);
826         AppLogDebug("EXIT");
827 }
828
829 void
830 CameraForm::Update(void)
831 {
832         AppLogDebug("ENTER");
833         Bitmap* pThumbnailBitmap = null;
834         Bitmap* pRotateBitmap = null;
835         Bitmap* pBitmap = null;
836         Dimension dimScaleSize = Dimension(W_THUMBNAIL_SCALE_SIZE, H_THUMBNAIL_SCALE_SIZE);
837         Point ptThumbnailImg = Point(X_THUMBNAIL_BUTTON_IMG, Y_THUMBNAIL_BUTTON_IMG);
838         result r = E_SUCCESS;
839
840         HideUiActionButton();
841
842         if (GetAppLaunchType() != APP_LAUNCH_TYPE_REQUESET)
843         {
844                 TryCatch(_pThumbnailPanel != null, , "_pThumbnailPanel is null");
845
846                 pThumbnailBitmap = _pCameraPresentationModel->GetLatestThumbnail();
847
848                 if (pThumbnailBitmap == null)
849                 {
850                         AppLogDebug("CameraForm::Update :: pThumbnailBitmap = null");
851
852                         _pThumbnailPanel->SetShowState(true);
853
854                         Draw();
855                         Show();
856                 }
857                 else
858                 {
859                         AppLogDebug("CameraForm::Update :: pThumbnailBitmap is not null");
860
861                         pRotateBitmap = RotationImageN(pThumbnailBitmap, IMAGE_ROTATION_0);
862                         TryCatch(pRotateBitmap != null, , "pRotateBitmap is null");
863
864                         r = pRotateBitmap->Scale(dimScaleSize);
865                         TryCatch(r == E_SUCCESS, , "Bitmap::Scale() fail[%s]", GetErrorMessage(r));
866
867                         _pThumbnailPanel->SetOldBitmap(pRotateBitmap);
868                         delete pRotateBitmap;
869                         pRotateBitmap = null;
870
871                         Draw();
872                         Show();
873                 }
874         }
875         else
876         {
877                 AppLogDebug("CameraForm::Update :: Not thummail");
878
879                 _pThumbnailPanel->SetShowState(false);
880                 _pThumbnailPanel->Draw();
881                 _pThumbnailPanel->Show();
882
883                 __pThumbnailButton->SetShowState(true);
884                 TryCatch(_pThumbnailPanel != null, , "_pThumbnailPanel is null");
885
886                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG);
887                 TryCatch(pBitmap != null, , "pBitmap is null");
888
889                 __pThumbnailButton->SetNormalBitmap(ptThumbnailImg, *pBitmap);
890
891                 delete pBitmap;
892                 pBitmap = null;
893
894                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG);
895                 TryCatch(pBitmap != null, , "pBitmap is null");
896
897                 __pThumbnailButton->SetPressedBitmap(ptThumbnailImg, *pBitmap);
898
899                 delete pBitmap;
900                 pBitmap = null;
901
902                 __pThumbnailButton->Draw();
903                 __pThumbnailButton->Show();
904
905                 Draw();
906                 Show();
907         }
908
909         AppLogDebug("EXIT");
910         return;
911
912 CATCH:
913         delete pRotateBitmap;
914         pRotateBitmap = null;
915         return;
916 }
917
918 result
919 CameraForm::OnCapuredPerform(void)
920 {
921         AppLogDebug("ENTER");
922         result r = E_SUCCESS;
923         Point currentPosition;
924         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
925                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
926         int guideLineEnable = 0;
927         BufferInfo bufferinfo;
928         Bitmap* pThumbnailBitmap = null;
929         Bitmap* pRotateBitmap = null;
930
931         pThumbnailBitmap = _pCameraPresentationModel->GetLatestThumbnail();
932 //      TryCatch(pThumbnailBitmap != null, , "pThumbnailBitmap is null");
933         if (pThumbnailBitmap == null)
934         {
935                 AppLogDebug("OnCapuredPerform::pThumbnailBitmap = null");
936
937                 _pThumbnailPanel->SetShowState(true);
938                 Invalidate(true);
939         }
940         else
941         {
942                 if (__dir == ORIENTATION_STATUS_PORTRAIT
943                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
944                 {
945                         rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
946                                                         W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);                
947                 }
948                 else
949                 {
950                         rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
951                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
952                 }
953
954                 pRotateBitmap = RotationImageN(pThumbnailBitmap, IMAGE_ROTATION_0);
955                 TryCatch(pRotateBitmap != null, , "pRotateBitmap is null");
956
957                 r = pRotateBitmap->Scale(Dimension(W_THUMBNAIL_SCALE_SIZE, H_THUMBNAIL_SCALE_SIZE));
958                 TryCatch(r == E_SUCCESS, , "pRotateBitmap::Scale() fail[%s]", GetErrorMessage(r));
959
960                 _pThumbnailPanel->SetNewBitmap(pRotateBitmap);
961                 _pThumbnailPanel->SetDrawSliderImg();
962
963                 delete pRotateBitmap;
964                 pRotateBitmap = null;
965         }
966
967         if (__formStatusFrameDeattivated)
968         {
969                 AppLogDebug("CAMERA_ACTION_EVENT_FRAME_DEACTIVATED after CAMERA_ACTION_EVENT_CAPTURED event");
970         }
971         else
972         {
973                 TryCatch(_pAppTimer != null, , "_pAppTimer is null");
974                 _pAppTimer->Cancel();
975
976                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
977                 TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
978
979                 r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
980                 TryCatch(r == E_SUCCESS, , "GetBackgroundBufferInfo start fail[%s]", GetErrorMessage(r));
981
982                 _pCameraPresentationModel->StartPreview(&bufferinfo);
983
984                 _pCameraPresentationModel->SetContinuousAutoFocus();
985         }
986
987         r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, guideLineEnable);
988         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
989
990         if (guideLineEnable == DISABLE_GUIDELINE)
991         {
992                 r = DrawMarker(false);
993         }
994         else
995         {
996                 r = DrawMarker(true);
997         }
998         TryCatch(r == E_SUCCESS, , "DrawMarker() fail[%s]", GetErrorMessage(r));
999
1000         InDrawFocus();
1001
1002         StopPopupTimer();
1003
1004         _isUsedTimerCaptured = false;
1005
1006         Update();
1007
1008         AppLogDebug("EXIT");
1009         return r;
1010
1011 CATCH:
1012         if (pRotateBitmap)
1013         {
1014                 delete pRotateBitmap;
1015                 pRotateBitmap = null;
1016         }
1017
1018         return r;
1019 }
1020
1021 void
1022 CameraForm::OnCameraActionPerformed(CameraActionEvent event)
1023 {
1024         AppLogDebug("ENTER");
1025         result r = E_SUCCESS;
1026
1027         AppLogDebug("OnCameraActionPerformed - event %d", event);
1028         switch (event)
1029         {
1030         case CAMERA_ACTION_EVENT_AUTO_FOCUSED:
1031                 {
1032                         AppLogDebug("CAMERA_ACTION_EVENT_AUTO_FOCUSED");
1033                         DrawFocus(CAMERA_FOCUS_READY);
1034                 }
1035                 break;
1036
1037         case CAMERA_ACTION_EVENT_TOUCH_AUTO_FOCUSED:
1038                 {
1039                         AppLogDebug("CAMERA_ACTION_EVENT_TOUCH_AUTO_FOCUSED");
1040                         DrawFocus(CAMERA_FOCUS_READY);
1041
1042                         TryReturnVoid(_pTouchAutoFocusTimer != null, "_pTouchAutoFocusTimer is null");
1043                         _pTouchAutoFocusTimer->Cancel();
1044
1045                         r = _pTouchAutoFocusTimer->Start(CAMERA_TIMER_2_SEC);
1046                         TryReturnVoid(r == E_SUCCESS, "Faled Start Timer[%s]", GetErrorMessage(r));
1047                 }
1048                 break;
1049
1050         case CAMERA_ACTION_EVENT_AUTO_FOCUS_FAILED:
1051                 {
1052                         AppLogDebug("CAMERA_ACTION_EVENT_AUTO_FOCUS_FAILED");
1053                         DrawFocus(CAMERA_FOCUS_FAIL);
1054                 }
1055                 break;
1056
1057         case CAMERA_ACTION_EVENT_CAMERA_PREVIEWED:
1058                 {
1059                         AppLogDebug("CAMERA_ACTION_EVENT_CAMERA_PREVIEWED.");
1060                 }
1061                 break;
1062
1063         case CAMERA_ACTION_EVENT_CAPTURED:
1064                 {
1065                         AppLogDebug("CAMERA_ACTION_EVENT_CAPTURED");
1066                         int requestType = 0;
1067                         BufferInfo bufferinfo;
1068                         bool isCharging = false;
1069                         BatteryLevel batteryLevel;
1070
1071                         _pCameraPresentationModel->UpdateThumbnail(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
1072
1073                         requestType = _pCameraPresentationModel->GetAppControlRequestType();
1074
1075                         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET && requestType == CameraPresentationModel::APP_CONTROL_REQUEST_TYPE_SUCCEEDED)
1076                         {
1077                                 AppLogDebug("Camera Captured after TerminateApp");
1078                                 CameraApp* pCameraApp = static_cast<CameraApp*>(CameraApp::GetInstance());
1079                                 pCameraApp->SetFrameEnabled(false);
1080
1081                                 r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
1082                                 TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
1083
1084                                 _pCameraPresentationModel->StartPreview(&bufferinfo);
1085
1086                                 __isProhibitionTouchEvent = true;
1087
1088                                 r = TerminateApp();
1089                                 AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
1090                         }
1091                         else
1092                         {
1093                                 OnCapuredPerform();
1094                         }
1095
1096                         batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
1097                         isCharging = _pCameraPresentationModel->IsCharging();
1098
1099                         AppLogDebug("batteryLevel = %d", batteryLevel);
1100                         AppLogDebug("isCharging = %d", isCharging);
1101
1102                         if (isCharging == false)
1103                         {
1104                                 if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
1105                                 {
1106                                         r = TerminateApp();
1107                                         AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
1108                                 }
1109                         }
1110                 }
1111                 break;
1112
1113         case CAMERA_ACTION_EVENT_ERROR_OCCURRED:
1114                 {
1115                         AppLogDebug("CAMERA_ACTION_EVENT_ERROR_OCCURRED.");
1116
1117                         result r = E_SUCCESS;
1118                         BufferInfo bufferinfo;
1119
1120                         if (__pBatteryState != null)
1121                         {
1122                                 __pBatteryState->SetShowState(true);
1123                                 __pBatteryState->Draw();
1124                                 __pBatteryState->Show();
1125                         }
1126
1127                         if (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_ERROR)
1128                         {
1129                                 AppLogDebug("Camera State is CAMERA_STATE_ERROR");
1130                                 _pCameraPresentationModel->StopCamera();
1131
1132                                 r = _pCameraPresentationModel->InitializeCamera();
1133                                 TryReturnVoid(r == E_SUCCESS, "InitializeCamera [%s]", GetErrorMessage(r));
1134
1135                                 r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
1136                                 TryReturnVoid(r == E_SUCCESS, "__pOverlayPanel->GetBackgroundBufferInfo() fail(%s)", GetErrorMessage(r));
1137
1138                                 _pCameraPresentationModel->StartPreview(&bufferinfo);
1139                                 _pCameraPresentationModel->SetContinuousAutoFocus();
1140                         }
1141                 }
1142                 break;
1143
1144         case CAMERA_ACTION_EVENT_FRAME_ACTIVATED:
1145                 {
1146                         AppLogDebug("CAMERA_ACTION_EVENT_FRAME_ACTIVATED.");
1147                         bool isEnabled = false;
1148                         bool isInitCameraStaus = false;
1149                         bool isCharging = false;
1150                         BatteryLevel batteryLevel = BATTERY_FULL;
1151                         int mem = 0;
1152
1153                         __formStatusFrameDeattivated = false;
1154
1155                         CameraApp* pCameraApp = static_cast<CameraApp*>(CameraApp::GetInstance());
1156                         isEnabled = pCameraApp->IsFrameEnabled();
1157
1158                         if (isEnabled == false)
1159                         {
1160                                 pCameraApp->SetFrameEnabled(true);
1161                         }
1162
1163                         isInitCameraStaus = _pCameraPresentationModel->GetInitCameraStatus();
1164                         AppLogDebug("isInitCameraStaus = %d", isInitCameraStaus);
1165
1166                         if (isInitCameraStaus == false)
1167                         {
1168                                 AppLogDebug("InitCamera is fail");
1169                                 return;
1170                         }
1171
1172                         if (_pCameraPresentationModel->IsCameraPoweredOn())
1173                         {
1174                                 result r = E_SUCCESS;
1175                                 BufferInfo bufferinfo;
1176                                 AppLogDebug("CAMERA_ACTION_EVENT_FRAME_ACTIVATED:CameraPoweredOn");
1177
1178                                 if (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_ERROR)
1179                                 {
1180                                         AppLogDebug("Camera State is CAMERA_STATE_ERROR");
1181                                         _pCameraPresentationModel->StopCamera();
1182
1183                                         r = _pCameraPresentationModel->InitializeCamera();
1184                                         TryReturnVoid(r == E_SUCCESS, "InitializeCamcorder [%s]", GetErrorMessage(r));
1185
1186                                         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
1187                                         TryReturnVoid(r == E_SUCCESS, "__pOverlayPanel->GetBackgroundBufferInfo() fail(%s)", GetErrorMessage(r));
1188
1189                                         _pCameraPresentationModel->StartPreview(&bufferinfo);
1190                                         _pCameraPresentationModel->SetContinuousAutoFocus();
1191                                 }
1192                                 batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
1193                                 isCharging = _pCameraPresentationModel->IsCharging();
1194
1195                                 AppLogDebug("batteryLevel = %d", batteryLevel);
1196                                 
1197                                 if(mem < MIN_MEMORY_NEEDED)
1198                                 {
1199                                         ShowMemoryFullPopup();
1200                                         return;
1201                                 }
1202
1203                                 if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
1204                                 {
1205                                         if (isCharging == false)
1206                                         {
1207                                                 ShowLowBatteryPopup();
1208                                                 return;
1209                                         }
1210                                 }
1211
1212                                 if (CheckCallStatus())
1213                                 {
1214                                         return;
1215                                 }
1216                         }
1217                         else
1218                         {
1219                                 AppLogDebug("CAMERA_ACTION_EVENT_FRAME_ACTIVATED");
1220
1221                                 if (!CheckCallStatus())
1222                                 {
1223                                         GetCameraToForeground();
1224                                 }
1225
1226                                 batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
1227                                 isCharging = _pCameraPresentationModel->IsCharging();
1228
1229                                 AppLogDebug("batteryLevel = %d", batteryLevel);
1230                                 if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
1231                                 {
1232                                         if (isCharging == false)
1233                                         {
1234                                                 ShowLowBatteryPopup();
1235                                                 return;
1236                                         }
1237                                 }
1238
1239                                 CheckBatteryStatus();
1240                         }
1241
1242                         HideUiActionButton();
1243                         Invalidate(true);
1244
1245                         if (_pThumbnailPanel != null)
1246                         {
1247                                 _pThumbnailPanel->DeleteOldBitmap();
1248                         }
1249  
1250                         DrawThumbnail();
1251                 }
1252                 break;
1253
1254         case CAMERA_ACTION_EVENT_FRAME_DEACTIVATED:
1255                 {
1256                         AppLogDebug("CAMERA_ACTION_EVENT_FRAME_DEACTIVATED");
1257                         bool isInitCameraStaus = false;
1258
1259                         __formStatusFrameDeattivated = true;
1260
1261                         isInitCameraStaus = _pCameraPresentationModel->GetInitCameraStatus();
1262                         AppLogDebug("isInitCameraStaus = %d", isInitCameraStaus);
1263
1264                         if (isInitCameraStaus == false)
1265                         {
1266                                 AppLogDebug("InitCamera is fail");
1267                                 return;
1268                         }
1269
1270                         MakeSettingPopupTab(false);
1271
1272                         HideUiActionButton();
1273                         Invalidate(true);
1274
1275                         if (_pThumbnailPanel != null)
1276                         {
1277                                 _pThumbnailPanel->DeleteOldBitmap();
1278                         }
1279
1280                         DrawThumbnail();
1281
1282                         HideUiQuickMenu();
1283
1284                         if (_pResetPopUp != null && _pResetPopUp->IsVisible())
1285                         {
1286                                 _pResetPopUp->SetShowState(false);
1287                         }
1288
1289                         if (_isUsedTimerCaptured == true)
1290                         {
1291                                 _timeCount = 0;
1292
1293                                 _isUsedTimerCaptured = false;
1294
1295                                 if (_pCameraInfoPanel->GetDrawPopupTimer() == true)
1296                                 {
1297                                         _pCameraInfoPanel->SetDrawPopupTimer(false);
1298
1299                                         _pCameraInfoPanel->Invalidate(true);
1300                                 }
1301                         }
1302                         SendCameraToBackground();
1303                 }
1304                 break;
1305
1306         case CAMERA_ACTION_EVENT_INITIALIZE_FAILED:
1307                 {
1308                         AppLogDebug("CAMERA_ACTION_EVENT_INITIALIZE_FAILED");
1309
1310                         ShowCameraFailPopup();
1311                 }
1312                 break;
1313
1314         case CAMERA_ACTION_EVENT_PREVIEW_START_FAILED:
1315                 {
1316                         if (CheckCallStatus())
1317                         {
1318                                 AppLogDebug("Preview Fail And InCall");
1319                                 return;
1320                         }
1321
1322                         if (_pCameraPresentationModel->GetStartPreviewException())
1323                         {
1324                                 AppLogDebug("CAMERA_ACTION_EVENT_PREVIEW_START_FAILED");
1325
1326                                 ShowCameraFailPopup();
1327                         }
1328                 }
1329                 break;
1330
1331         case CAMERA_ACTION_EVENT_BATTERY_LEVEL_CHANGED:
1332                 {
1333                         AppLogDebug("CAMERA_ACTION_EVENT_BATTERY_LEVEL_CHANGED");
1334                         bool isCharging = false;
1335                         BatteryLevel batteryLevel;
1336
1337                         batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
1338                         isCharging = _pCameraPresentationModel->IsCharging();
1339
1340                         AppLogDebug("batteryLevel = %d", batteryLevel);
1341                         AppLogDebug("isCharging = %d", isCharging);
1342
1343                 if (isCharging == false)
1344                 {
1345                         if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
1346                         {
1347                                 _pCameraPresentationModel->SetAppControlRequestType(CameraPresentationModel::APP_CONTROL_REQUEST_TYPE_FAILED);
1348
1349                                 if ((_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_CAPTURING
1350                                                 || _pCameraPresentationModel->GetCameraState() == CAMERA_STATE_CAPTURED)
1351                                                 && __isTimerRunning == false)
1352                                 {
1353                                         AppLogDebug("CAPTURING or CAPTURED");
1354                                         ShowLowBatteryPopup();
1355                                         r = TerminateApp();
1356                                 }
1357                                 else
1358                                 {
1359                                         r = TerminateApp();
1360                                         AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
1361                                 }
1362                         }
1363                         else
1364                         {
1365                                 CheckBatteryStatus();
1366                         }
1367                 }
1368                 else
1369                 {
1370                         CheckBatteryStatus();
1371                 }
1372         }
1373                 break;
1374
1375         case CAMERA_ACTION_EVENT_BATTERY_LEVEL_CHARGING:
1376                 {
1377                         AppLogDebug("CAMERA_ACTION_EVENT_BATTERY_LEVEL_CHARGING");
1378
1379                         _batteryStatus = GetCurrentBatteryState();
1380
1381                         AppLogDebug("_batteryStatus = %d", _batteryStatus);
1382
1383                         CheckBatteryStatus();
1384                 }
1385                 break;
1386
1387         case CAMERA_ACTION_EVENT_STORAGE_CARD_UNMOUNT:
1388                 {
1389                         AppLogDebug("CAMERA_ACTION_EVENT_STORAGE_CARD_UNMOUNT");
1390
1391                         int requestType = 0;
1392
1393                         requestType = _pCameraPresentationModel->GetAppControlRequestType();
1394
1395                         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET && requestType == CameraPresentationModel::APP_CONTROL_REQUEST_TYPE_FAILED)
1396                         {
1397                                 AppLogDebug("Camera Captured after TerminateApp()");
1398
1399                                 r = TerminateApp();
1400                                 AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
1401                         }
1402                         else
1403                         {
1404                                 _pCameraPresentationModel->UpdateThumbnail(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
1405
1406                                 Update();
1407
1408                                 OnTimerCapturePause();
1409                                 UpdatePopUp();
1410                         }
1411                 }
1412                 break;
1413
1414         default:
1415                 break;
1416         }
1417         AppLogDebug("EXIT");
1418 }
1419
1420 result
1421 CameraForm::InitSettingMenuPanel(void)
1422 {
1423         AppLogDebug("ENTER");
1424         result r = E_SUCCESS;
1425         int cameraCount = 0;
1426
1427         __pSettingPanel = static_cast<Panel*>(GetControl(L"IDC_SETTING_PANEL"));
1428         TryCatch(__pSettingPanel != null, r = E_SYSTEM, "__pSettingPanel is null, Make panel fail!!!");
1429
1430         __pSettingPanel->AddTouchEventListener(*this);
1431         __pSettingPanel->SetName(IDS_SETTING_UI_PANEL_NAME);
1432
1433         _pFlashButton = static_cast<Button*>(GetControl(L"IDC_SET_FLASH_BUTTON"));
1434         TryCatch(_pFlashButton != null, r = E_SYSTEM, "_pFlashButton is null");
1435         _pFlashButton->AddTouchEventListener(*this);
1436
1437         _pFlashButton->SetActionId(IDA_BUTTON_CAMERA_FLASH);
1438         _pFlashButton->SetName(IDS_FLASH_BUTTON_NAME);
1439         _pFlashButton->AddActionEventListener(*this);
1440
1441         _pSelfShotButton = static_cast<Button*>(GetControl(L"IDC_SELF_SHOT_BUTTON"));
1442         TryCatch(_pSelfShotButton != null, r = E_SYSTEM, "_pSelfShotButton is null");
1443         _pSelfShotButton->AddTouchEventListener(*this);
1444
1445         _pSelfShotButton->SetActionId(IDA_BUTTON_CAMERA_SELF);
1446         _pSelfShotButton->AddActionEventListener(*this);
1447
1448         _pSettingButton = static_cast<Button*>(GetControl(L"IDC_SETTING_BUTTON"));
1449         TryCatch(_pSettingButton != null, r = E_SYSTEM, "pSettingButton is null");
1450         _pSettingButton->AddTouchEventListener(*this);
1451
1452         _pSettingButton->SetActionId(IDA_BUTTON_CAMERA_SETTING);
1453         _pSettingButton->AddActionEventListener(*this);
1454
1455         __pSettingLine = static_cast<Label*>(GetControl(L"IDC_SETTING_LINE"));
1456         TryCatch(__pSettingLine != null, r = E_SYSTEM, "pSettingButton is null");
1457         __pSettingLine->AddTouchEventListener(*this);
1458
1459         _pQuickSettingButton = static_cast<Button*>(GetControl(L"IDC_QUICK_SETTING_BUTTON"));
1460         TryCatch(_pQuickSettingButton != null, r = E_SYSTEM, "pQuickSettingButton is null");
1461         _pQuickSettingButton->AddTouchEventListener(*this);
1462
1463         _pQuickSettingButton->SetActionId(IDA_BUTTON_CAMERA_QUICK_SETTING);
1464         _pQuickSettingButton->AddActionEventListener(*this);
1465
1466         _pWhiteBalanceButton = static_cast<Button*>(GetControl(L"IDC_WB_BUTTON"));
1467         TryCatch(_pWhiteBalanceButton != null, r = E_SYSTEM, "_pWhiteBalanceButton is null");
1468
1469         _pWhiteBalanceButton->SetActionId(IDA_BUTTON_CAMERA_WB);
1470         _pWhiteBalanceButton->SetName(IDS_WB_BUTTON_NAME);
1471         _pWhiteBalanceButton->AddTouchEventListener(*this);
1472         _pWhiteBalanceButton->AddActionEventListener(*this);
1473
1474         _pExposureValueButton = static_cast<Button*>(GetControl(L"IDC_EV_BUTTON"));
1475         TryCatch(_pExposureValueButton != null, r = E_SYSTEM, "_pExposureValueButton is null");
1476
1477         _pExposureValueButton->SetActionId(IDA_BUTTON_CAMERA_EV);
1478         _pExposureValueButton->AddTouchEventListener(*this);
1479         _pExposureValueButton->AddActionEventListener(*this);
1480
1481         _pCloseButton = static_cast<Button*>(GetControl(L"IDC_CLOSE_BUTTON"));
1482         TryCatch(_pCloseButton != null, r = E_SYSTEM, "_pCloseButton is null");
1483         _pCloseButton->AddTouchEventListener(*this);
1484
1485         _pCloseButton->SetActionId(IDA_BUTTON_CLOSE_SETTING);
1486         _pCloseButton->AddActionEventListener(*this);
1487
1488         r = UpdateUiPanelIcon();
1489         //TryCatch(r == E_SUCCESS, r = E_SYSTEM, "UpdateSetUiPanelIcon() - fail[%s]", GetErrorMessage(r));
1490
1491         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_COUNT, cameraCount);
1492         AppLogDebug("GetMediaCapability [%s]", GetErrorMessage(r));
1493         if (cameraCount > SUPPORTED_CAMERA_NUM)
1494         {
1495                 _pSelfShotButton->SetEnabled(true);
1496         }
1497         else
1498         {
1499                 _pSelfShotButton->SetEnabled(false);
1500         }
1501         AppLogDebug("EXIT");
1502         return E_SUCCESS;
1503
1504 CATCH:
1505         _pFlashButton = null;
1506         _pSelfShotButton = null;
1507         _pSettingButton = null;
1508         __pSettingLine = null;
1509         _pQuickSettingButton = null;
1510         _pWhiteBalanceButton = null;
1511         _pExposureValueButton = null;
1512         _pCloseButton = null;
1513
1514         return r;
1515 }
1516
1517 void
1518 CameraForm::OnTouchModeSwitch(void)
1519 {
1520         AppLogDebug("ENTER");
1521         result r = E_SUCCESS;
1522
1523         if (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_PREVIEW)
1524         {
1525                 SceneManager* pSceneManager = SceneManager::GetInstance();
1526                 AppAssert(pSceneManager);
1527
1528                 AppLogDebug("GoForward to IDSCN_CAMCORDER!!!");
1529
1530                 r = _pCameraPresentationModel->SetValue(CURRENT_MODE, CameraPresentationModel::CAMERA_MODE_RECORD);
1531                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
1532
1533                 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CAMCORDER));
1534                 TryReturnVoid(r == E_SUCCESS, "SceneManager GoForward[%s]", GetErrorMessage(r));
1535         }
1536         else
1537         {
1538                 AppLogDebug("Prohibit to GoForward IDSCN_CAMCORDER!!!");
1539         }
1540         AppLogDebug("EXIT");
1541 }
1542
1543 void
1544 CameraForm::OnTouchDrawExposure(const Tizen::Graphics::Point& currentPosition)
1545 {
1546         AppLogDebug("ENTER");
1547         result r = E_SUCCESS;
1548
1549         AppLogDebug("X = %d Y = %d", currentPosition.x, currentPosition.y);
1550         if (__dir == ORIENTATION_STATUS_PORTRAIT
1551                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1552         {
1553                 r = DrawExposureSlider(currentPosition, DRAW_RELEASED);
1554                 _closeTimerValue = UNIT_VALUE_ZERO;
1555
1556                 TryReturnVoid(_pExposureCloseTimer != null, "_pExposureCloseTimer is null");
1557                 _pExposureCloseTimer->Cancel();
1558
1559                 r = _pExposureCloseTimer->StartAsRepeatable(CAMERA_EXPOSURE_TIMER_VALUE);
1560                 TryReturnVoid(r == E_SUCCESS, "_pExposureCloseTimer start fail[%s]", GetErrorMessage(r));
1561         }
1562         else
1563         {
1564                 r = DrawExposureSlider(currentPosition, DRAW_RELEASED);
1565                 _closeTimerValue = UNIT_VALUE_ZERO;
1566
1567                 TryReturnVoid(_pExposureCloseTimer != null, "_pExposureCloseTimer is null");
1568                 _pExposureCloseTimer->Cancel();
1569
1570                 r = _pExposureCloseTimer->StartAsRepeatable(CAMERA_EXPOSURE_TIMER_VALUE);
1571                 TryReturnVoid(r == E_SUCCESS, "_pExposureCloseTimer start fail[%s]", GetErrorMessage(r));
1572         }
1573         AppLogDebug("EXIT");
1574 }
1575
1576 void
1577 CameraForm::OnTouchLaunchImageview(void)
1578 {
1579         AppLogDebug("ENTER");
1580         int storageCardChageState = CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN;
1581         String fullFileName = L"";
1582
1583         if (_pCameraPresentationModel->GetLatestThumbnail() != null)
1584         {
1585                 storageCardChageState = _pCameraPresentationModel->GetStorageCardChageState();
1586
1587                 if (storageCardChageState == CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_MOUNT_TO_UNMOUNT)
1588                 {
1589                         AppLogDebug("MOUNT_TO_UNMOUNT : Don't LaunchImageview");
1590
1591                         _pCameraPresentationModel->SetStorageCardChageState(CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN);
1592
1593                         fullFileName = _pCameraPresentationModel->GetContentFilePath(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
1594
1595                         if (fullFileName == L"")
1596                         {
1597                                 AppLogDebug("file do not found");
1598                         }
1599                         else
1600                         {
1601                                 AppLogDebug("LaunchImageview : MOUNT_TO_UNMOUNT");
1602
1603                                 LaunchImageview();
1604                         }
1605                 }
1606                 else
1607                 {
1608                         AppLogDebug("LaunchImageview");
1609                         _pCameraPresentationModel->SetStorageCardChageState(CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN);
1610
1611                         fullFileName = _pCameraPresentationModel->GetContentFilePath(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
1612
1613                         if (fullFileName == L"")
1614                         {
1615                                 AppLogDebug("file do not found");
1616                         }
1617                         else
1618                         {
1619                                 LaunchImageview();
1620                         }
1621                 }
1622         }
1623         AppLogDebug("EXIT");
1624 }
1625
1626 void
1627 CameraForm::OnTimerCapturePause(void)
1628 {
1629         AppLogDebug("ENTER");
1630         if (__isTimerRunning == true)
1631         {
1632                 if (_pPopupTimer != null)
1633                 {
1634                         _pPopupTimer->Cancel();
1635
1636                         delete _pPopupTimer;
1637                         _pPopupTimer = null;
1638                 }
1639
1640                 _timeCount = INDEX_UNIT_ZERO;
1641
1642                 if (_isUsedTimerCaptured == true)
1643                 {
1644                         __isTimerRunning = false;
1645
1646                         _pCameraPresentationModel->SetIntervalTimerRun(false);
1647
1648                         _isUsedTimerCaptured = false;
1649
1650                         if (_pIntervalValueTimer != null)
1651                         {
1652                                 _pIntervalValueTimer->Cancel();
1653                         }
1654                         _pCameraInfoPanel->SetDrawPopupTimerUpdate(false);
1655
1656                         _pCameraInfoPanel->SetDrawPopupTimerCount(0);
1657
1658                         _pCameraInfoPanel->Invalidate(true);
1659
1660                         _pCameraInfoPanel->SetDrawPopupTimer(false);
1661
1662                         _pCameraInfoPanel->Invalidate(true);
1663
1664                         HideUiPanel(false);
1665                 }
1666         }
1667         AppLogDebug("EXIT");
1668 }
1669
1670 bool
1671 CameraForm::OnTouchDoHidePopup(void)
1672 {
1673         AppLogDebug("ENTER");
1674         bool doHidePopup = false;
1675
1676         if (_pListViewCameraTabMainMenu != null)
1677         {
1678                 if (_pListViewCameraTabMainMenu->GetShowState() == true)
1679                 {
1680                         doHidePopup = true;
1681                 }
1682         }
1683
1684         if (_pListViewGeneralTabMainMenu != null)
1685         {
1686                 if (_pListViewGeneralTabMainMenu->GetShowState() == true)
1687                 {
1688                         doHidePopup = true;
1689                 }
1690         }
1691
1692         if (_pListFlashMainMenu != null)
1693         {
1694                 if (_pListFlashMainMenu->GetShowState() == true)
1695                 {
1696                         doHidePopup = true;
1697                 }
1698         }
1699
1700         if (_pListWbMainMenu != null)
1701         {
1702                 if (_pListWbMainMenu->GetShowState() == true)
1703                 {
1704                         doHidePopup = true;
1705                 }
1706         }
1707
1708         if (_pListViewCameraTabSubMenu != null)
1709         {
1710                 if (_pListViewCameraTabSubMenu->GetShowState() == true)
1711                 {
1712                         doHidePopup = true;
1713                 }
1714         }
1715
1716         if (_pListViewGeneralTabSubMenu != null)
1717         {
1718                 if (_pListViewGeneralTabSubMenu->GetShowState() == true)
1719                 {
1720                         doHidePopup = true;
1721                 }
1722         }
1723
1724         if (_pCameraInfoPanel->GetDrawExposure() == true)
1725         {
1726                 doHidePopup = false;
1727         }
1728
1729         AppLogDebug("EXIT");
1730         return doHidePopup;
1731 }
1732
1733 void
1734 CameraForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1735 {
1736         AppLogDebug("ENTER");
1737         result r = E_SUCCESS;
1738         String controlName = L"";
1739
1740         if (_appControlActionCompleted)
1741         {
1742                 AppLogDebug("OnTouchPressed >> TerminateApp Execution");
1743                 return;
1744         }
1745
1746         controlName = source.GetName();
1747
1748         if ((__isProhibitionTouchEvent == true) && (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET))
1749         {
1750                 AppLogDebug("OnTouchPressed return");
1751                 return;
1752         }
1753
1754         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
1755         _pAppTimer->Cancel();
1756
1757         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
1758         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
1759
1760         if (_pCameraInfoPanel->GetDrawExposure() == true)
1761         {
1762                 TryReturnVoid(_pExposureCloseTimer != null, "_pExposureCloseTimer is null");
1763                 _pExposureCloseTimer->Cancel();
1764
1765                 r = _pExposureCloseTimer->StartAsRepeatable(CAMERA_EXPOSURE_TIMER_VALUE);
1766                 TryReturnVoid(r == E_SUCCESS, "_pExposureCloseTimer start fail[%s]", GetErrorMessage(r));
1767         }
1768         AppLogDebug("EXIT");
1769 }
1770
1771 void
1772 CameraForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1773 {
1774         AppLogDebug("ENTER");
1775         String controlName = source.GetName();
1776
1777         if ((__isProhibitionTouchEvent == true) && (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET))
1778         {
1779                 AppLogDebug("OnTouchLongPressed return");
1780                 return;
1781         }
1782
1783         if ((controlName.Equals(String(IDS_ACTION_UI_PANEL_CAPTURE_NAME))) && (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_PREVIEW))
1784         {
1785                 AppLogDebug("OnTouchLongPressed Action");
1786                 if (source.Equals(*__pShutterButton) == true)
1787                 {
1788                         _pCameraPresentationModel->SetContinuousAutoFocus();
1789                 }
1790         }
1791         AppLogDebug("EXIT");
1792 }
1793
1794 void
1795 CameraForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1796 {
1797         AppLogDebug("ENTER");
1798         String controlName = L"";
1799         int checkActivePanel = -1;
1800         bool doHidePopup = false;
1801
1802         if (_appControlActionCompleted)
1803         {
1804                 AppLogDebug("OnTouchPressed >> TerminateApp Execution");
1805                 return;
1806         }
1807         AppLogDebug("Source name is %ls",source.GetName().GetPointer());
1808         controlName = source.GetName();
1809
1810         if ((__isProhibitionTouchEvent == true) && (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET))
1811         {
1812                 AppLogDebug("OnTouchReleased return");
1813                 return;
1814         }
1815
1816         if (_pCameraInfoPanel->GetDrawExposure() == true)
1817         {
1818                 if (source.Equals(*__pShutterButton) == true)
1819                 {
1820                         _closeTimerValue = 0;
1821
1822                         if (_pExposureCloseTimer)
1823                         {
1824                                 _pExposureCloseTimer->Cancel();
1825                         }
1826
1827                         _pCameraInfoPanel->SetDrawExposure(false);
1828
1829                         Invalidate(true);
1830                 }
1831                 else
1832                 {
1833                         if (controlName.CompareTo(IDS_SETTING_UI_PANEL_NAME) != 0)
1834                         {
1835                                 OnTouchDrawExposure(currentPosition);
1836                         }
1837                 }
1838         }
1839
1840         doHidePopup = OnTouchDoHidePopup();
1841         AppLogDebug("doHidePopup = %d", doHidePopup);
1842
1843         if ((doHidePopup == false) && (_pCameraInfoPanel->GetDrawExposure() == false))
1844         {
1845                 if ((controlName.Equals(String(IDS_CAMERA_INFO_PANEL_NAME))) && (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_PREVIEW))
1846                 {
1847                         DrawTouchAutoFocus(currentPosition);
1848                 }
1849         }
1850         else
1851         {
1852                 if (!controlName.Equals(String(IDS_GENERAL_SETTING_SUB_MENU))
1853                                 && !controlName.Equals(String(IDS_CAMERA_SETTING_SUB_MENU)))
1854                 {
1855                         if (_pCameraInfoGeneralSubPanel != null)
1856                         {
1857                                 if (_pCameraInfoGeneralSubPanel->GetShowState())
1858                                 {
1859                                         checkActivePanel = 0;
1860                                 }
1861                         }
1862                         if (_pCameraInfoSubPanel != null)
1863                         {
1864                                 if (_pCameraInfoSubPanel->GetShowState())
1865                                 {
1866                                         checkActivePanel = 1;
1867                                 }
1868                         }
1869
1870                         if (checkActivePanel != -1)
1871                         {
1872                                 if (checkActivePanel == 0)
1873                                 {
1874                                         _pCameraInfoGeneralSubPanel->SetShowState(false);
1875                                 }
1876                                 else
1877                                 {
1878                                         _pCameraInfoSubPanel->SetShowState(false);
1879                                 }
1880                         }
1881                         else
1882                         {
1883                                 UpdatePopUp();
1884                         }
1885                 }
1886         }
1887
1888         if (source.Equals(*__pCameraSettingLable) == true)
1889         {
1890                 CheckCameraSettingLabel();
1891         }
1892
1893         if (source.Equals(*__pGeneralSettingLable) == true)
1894         {
1895                 CheckGeneralSettingLabel();
1896         }
1897
1898         if (controlName.Equals(String(IDS_THUMBNAIL_PANLE_NAME))
1899                 && _pThumbnailPanel->GetShowState() == true
1900                 && (GetAppLaunchType() != APP_LAUNCH_TYPE_REQUESET)
1901                 && _pCameraPresentationModel->GetCameraState()!= CAMERA_STATE_CAPTURED
1902         )
1903         {
1904                 if (source.Equals(*_pThumbnailPanel) == true)
1905                 {
1906                         AppLogDebug("Touch Thumbnail button");
1907                         OnTouchLaunchImageview();
1908                 }
1909         }
1910         AppLogDebug("EXIT");
1911 }
1912
1913 void
1914 CameraForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1915 {
1916         AppLogDebug("ENTER");
1917         String controlName = L"";
1918         result r = E_SUCCESS;
1919
1920         if (_appControlActionCompleted)
1921         {
1922                 AppLogDebug("OnTouchPressed >> TerminateApp Execution");
1923                 return;
1924         }
1925
1926         controlName = source.GetName();
1927
1928         if ((controlName.Equals(String(IDS_ACTION_UI_CAMERA_MODE))))
1929         {
1930                 OnTouchModeSwitch();
1931                 return;
1932         }
1933
1934         if (_pCameraInfoPanel->GetDrawExposure() == true)
1935         {
1936                 if (controlName.CompareTo(IDS_SETTING_UI_PANEL_NAME) != 0)
1937                 {
1938                         r = DrawExposureSlider(currentPosition, DRAW_MOVED);
1939                         TryReturnVoid(r == E_SUCCESS, "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
1940                         _closeTimerValue = 0;
1941
1942                         TryReturnVoid(_pExposureCloseTimer != null, "_pExposureCloseTimer is null");
1943                         _pExposureCloseTimer->Cancel();
1944                 }
1945         }
1946         AppLogDebug("EXIT");
1947 }
1948
1949 void
1950 CameraForm::OnAppTimerExpired(void)
1951 {
1952         AppLogDebug("ENTER");
1953         result r = E_SUCCESS;
1954         CameraApp* pCameraApp = static_cast<CameraApp*>(CameraApp::GetInstance());
1955
1956         DeleteTimer();
1957
1958         _pCameraPresentationModel->StopCamera();
1959
1960         r = SendAppControlResult(pCameraApp->GetRequestId());
1961         TryReturnVoid(r == E_SUCCESS, "SendAppControlResult [%s]", GetErrorMessage(r));
1962         AppLogDebug("EXIT");
1963 }
1964
1965 void
1966 CameraForm::OnPreviewFailPopupTimerExpired(void)
1967 {
1968         AppLogDebug("ENTER");
1969         if (CheckCallStatus())
1970         {
1971                 AppLogDebug("Preview Fail And InCall");
1972                 return;
1973         }
1974
1975         ShowCameraFailPopup();
1976         AppLogDebug("EXIT");
1977 }
1978
1979 void
1980 CameraForm::OnCaptureStartTimerExpired(void)
1981 {
1982         AppLogDebug("ENTER");
1983         result r = E_SUCCESS;
1984         int timerInterval = 0;
1985
1986         if (_pCaptureStartTimer)
1987         {
1988                 _pCaptureStartTimer->Cancel();
1989         }
1990
1991         timerInterval = GetTimerIntervalValue();
1992
1993         Invalidate(true);
1994
1995         _isUsedTimerCaptured = true;
1996
1997         r = SetTimerIntervalValue(timerInterval);
1998         TryReturnVoid(r == E_SUCCESS, "SetTimerIntervalValue() fail[%s]", GetErrorMessage(r));
1999
2000         _timeCount = 0;
2001
2002         r = DrawTimerPopup();
2003         TryReturnVoid(r == E_SUCCESS, "DrawTimerPopup() fail[%s]", GetErrorMessage(r));
2004         AppLogDebug("EXIT");
2005 }
2006
2007 void
2008 CameraForm::OnTouchAutoFocusTimerExpired(void)
2009 {
2010         AppLogDebug("ENTER");
2011         _pCameraPresentationModel->SetContinuousAutoFocus();
2012
2013         _pTouchAutoFocusTimer->Cancel();
2014         AppLogDebug("EXIT");
2015 }
2016
2017 void
2018 CameraForm::OnPopupTimerExpired(void)
2019 {
2020         AppLogDebug("ENTER");
2021         if (_pCameraPresentationModel->IsPreviewState() == true)
2022         {
2023                 _timeCount--;
2024
2025                 _pCameraInfoPanel->SetDrawPopupTimerUpdate(true);
2026
2027                 _pCameraInfoPanel->SetDrawPopupTimerCount(_timeCount);
2028
2029                 _pCameraInfoPanel->Invalidate(true);
2030
2031                 AppLogDebug("_timeCount=%d", _timeCount); 
2032
2033                 if (_timeCount == INDEX_UNIT_ZERO || _timeCount == INDEX_UNIT_ONE)
2034                 {
2035                         StopPopupTimer();
2036                 }
2037         }
2038         AppLogDebug("EXIT");
2039 }
2040
2041 void
2042 CameraForm::OnIntervalValueTimerExpired(void)
2043 {
2044         AppLogDebug("ENTER");
2045         result r = E_SUCCESS;
2046         bool focusSupport = false;
2047         int selfPortraitEnable = 0;
2048
2049         if (_isUsedTimerCaptured == true)
2050         {
2051                 _pCameraInfoPanel->SetDrawPopupTimerUpdate(false);
2052
2053                 _pCameraInfoPanel->SetDrawPopupTimerCount(0);
2054
2055                 _pCameraInfoPanel->Invalidate(true);
2056
2057                 _pCameraInfoPanel->SetDrawPopupTimer(false);
2058
2059                 _pCameraInfoPanel->Invalidate(true);
2060
2061                 HideUiQuickMenu();
2062
2063                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
2064                 TryReturnVoid(r == E_SUCCESS, "Reg getValue fail[%s]", GetErrorMessage(r));
2065
2066                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2067                 {
2068                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FOCUS, focusSupport);
2069                 }
2070                 else
2071                 {
2072                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_FOCUS, focusSupport);
2073                 }
2074
2075                 if (focusSupport == true && r == E_SUCCESS)
2076                 {
2077                         _pCameraInfoPanel->SetDrawMarkerFocus(true);
2078
2079                         DrawFocus(CAMERA_FOCUS_NOT_READY);
2080                 }
2081                 else
2082                 {
2083                         _pCameraInfoPanel->SetDrawMarkerFocus(false);
2084
2085                         _pCameraInfoPanel->Invalidate(true);
2086                 }
2087         }
2088
2089         _pCameraPresentationModel->Capture();
2090
2091         __isTimerRunning = false;
2092
2093         _pCameraPresentationModel->SetIntervalTimerRun(false);
2094
2095         if (__pBatteryState)
2096         {
2097                 __pBatteryState->SetShowState(true);
2098                 __pBatteryState->Draw();
2099                 __pBatteryState->Show();
2100         }
2101
2102         HideUiPanel(false);
2103
2104         Update();
2105         AppLogDebug("EXIT");
2106 }
2107
2108 void
2109 CameraForm::OnExposureCloseTimerExpired(void)
2110 {
2111         AppLogDebug("ENTER");
2112         _closeTimerValue++;
2113
2114         AppLogDebug("_closeTimerValue expire %d", _closeTimerValue);
2115
2116         if (_closeTimerValue == EXPOSURE_TIMER_IS_ALIVE)
2117         {
2118                 if (_pCameraInfoPanel->GetDrawExposure() == true)
2119                 {
2120                         _pCameraInfoPanel->SetDrawExposure(false);
2121
2122                         HidePopup();
2123                         Invalidate(true);
2124                 }
2125
2126                 _closeTimerValue = 0;
2127
2128                 _pExposureCloseTimer->Cancel();
2129         }
2130         AppLogDebug("EXIT");
2131 }
2132
2133 result
2134 CameraForm::OnChargingCompletedTimerExpired(void)
2135 {
2136         AppLogDebug("ENTER");
2137         Bitmap* pBitmap = null;
2138         result r = E_SUCCESS;
2139
2140         TryCatch(__pBatteryState != null, r = E_SYSTEM, "__pBattery is null");
2141
2142         if (__dir == ORIENTATION_STATUS_PORTRAIT || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2143         {
2144                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_PORTRAIT, Y_INDICATOR_BATTERY_PORTRAIT);
2145         }
2146         else
2147         {
2148                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_LANDSCAPE, Y_INDICATOR_BATTERY_LANDSCAPE);
2149         }
2150
2151         _chargingCount++;
2152
2153         if (_chargingCount % DIVIDE_BY_TWO)
2154         {
2155                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_20);
2156         }
2157         else
2158         {
2159                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_GLOW);
2160         }
2161         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2162
2163         if (_chargingCount >= BATTERY_STATE_20)
2164         {
2165                 _chargingCount = INDEX_UNIT_ZERO;
2166         }
2167
2168         _blinkCount++;
2169         __pBatteryState->SetBackgroundBitmap(*pBitmap);
2170         __pBatteryState->Invalidate(true);
2171
2172         AppLogDebug("_batteryStatus = %d", _batteryStatus);
2173         AppLogDebug("_chargingCount = %d", _chargingCount);
2174         AppLogDebug("_blinkCount = %d", _blinkCount);
2175
2176         delete pBitmap;
2177         pBitmap = null;
2178
2179         AppLogDebug("EXIT");
2180         return r;
2181
2182 CATCH:
2183         AppLogDebug("EXIT - CATCH");
2184         return r;
2185 }
2186
2187 result
2188 CameraForm::OnChargingTimerExpired(void)
2189 {
2190         AppLogDebug("ENTER");
2191         Bitmap* pBitmap = null;
2192         result r = E_SUCCESS;
2193         int maxChargingCnt = 0;
2194         int batteryLevel = 0;
2195         Battery::GetCurrentLevelInPercentage(batteryLevel);
2196
2197         TryCatch(__pBatteryState != null, r = E_SYSTEM, "__pBattery is null");
2198
2199         if (__dir == ORIENTATION_STATUS_PORTRAIT || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2200         {
2201                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_PORTRAIT, Y_INDICATOR_BATTERY_PORTRAIT);
2202         }
2203         else
2204         {
2205                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_LANDSCAPE, Y_INDICATOR_BATTERY_LANDSCAPE);
2206         }
2207
2208         AppLogDebug("batteryLevel = %d", batteryLevel);
2209
2210         _chargingCount++;
2211
2212         AppLogDebug("_batteryStatus = %d", _batteryStatus);
2213         AppLogDebug("_chargingCount = %d", _chargingCount);
2214
2215         if ((_batteryStatus == BATTERY_STATE_0 || _batteryStatus == BATTERY_STATE_1) && _chargingCount == INDEX_UNIT_ONE)
2216         {
2217                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_LOW);
2218         }
2219         else
2220         {
2221                 pBitmap = ResourceManager::GetBitmapN(_batteryStatus + _chargingCount);
2222         }
2223         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2224
2225         maxChargingCnt = (static_cast<int>(_batteryStatus)) + _chargingCount;
2226
2227         AppLogDebug("maxCount = %d", maxChargingCnt);
2228
2229         if (maxChargingCnt >= BATTERY_STATE_20)
2230         {
2231                 _chargingCount = INDEX_UNIT_ZERO;
2232         }
2233
2234         __pBatteryState->SetBackgroundBitmap(*pBitmap);
2235         __pBatteryState->Invalidate(true);
2236
2237         delete pBitmap;
2238         pBitmap = null;
2239
2240         AppLogDebug("EXIT");
2241         return r;
2242
2243 CATCH:
2244         AppLogDebug("EXIT - CATCH");
2245         return r;
2246 }
2247
2248 void
2249 CameraForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
2250 {
2251         AppLogDebug("ENTER");
2252         if (timer.Equals(*_pAppTimer))
2253         {
2254                 AppLogDebug("_pAppTimer");
2255                 OnAppTimerExpired();
2256         }
2257         else if (timer.Equals(*_pCaptureStartTimer))
2258         {
2259                 AppLogDebug("_pCaptureStartTimer");
2260                 OnCaptureStartTimerExpired();
2261         }
2262         else if (timer.Equals(*_pTouchAutoFocusTimer))
2263         {
2264                 AppLogDebug("_pTouchAutoFocusTimer");
2265                 OnTouchAutoFocusTimerExpired();
2266         }
2267         else if (timer.Equals(*_pPopupTimer))
2268         {
2269                 AppLogDebug("_pPopupTimer");
2270                 OnPopupTimerExpired();
2271         }
2272         else if (timer.Equals(*_pIntervalValueTimer))
2273         {
2274                 AppLogDebug("_pIntervalValueTimer");
2275                 OnIntervalValueTimerExpired();
2276                 StartInitChargingTimer();
2277         }
2278         else if (timer.Equals(*_pHelpCloseTimer))
2279         {
2280                 AppLogDebug("__pHelpCloseTimer");
2281                 OnHelpCloseTimerExpired();
2282         }
2283         else if (timer.Equals(*_pExposureCloseTimer))
2284         {
2285                 AppLogDebug("_pExposureCloseTimer");
2286                 OnExposureCloseTimerExpired();
2287         }
2288         else if (timer.Equals(*_pChargingTimer))
2289         {
2290                 result r = E_SUCCESS;
2291                 AppLogDebug("_pChargingTimer");
2292                 bool isCharging = false;
2293
2294                 _batteryStatus = GetCurrentBatteryState();
2295                 AppLogDebug("_batteryStatus = %d", _batteryStatus);
2296
2297                 isCharging = _pCameraPresentationModel->IsCharging();
2298
2299                 if (isCharging)
2300                 {
2301                         if (_batteryStatus == BATTERY_STATE_20)
2302                         {
2303                                 _chargingCount = INDEX_UNIT_ZERO;
2304
2305                                 _blinkCount = INDEX_UNIT_ZERO;
2306
2307                                 _pChargingTimer->Cancel();
2308
2309                                 StartInitChargingCompletedTimer();
2310                         }
2311                         else
2312                         {
2313                                 r = OnChargingTimerExpired();
2314                         }
2315                 }
2316                 else
2317                 {
2318                         _chargingCount = INDEX_UNIT_ZERO;
2319
2320                         _blinkCount = INDEX_UNIT_ZERO;
2321
2322                         _pChargingTimer->Cancel();
2323
2324                         if (_batteryStatus == BATTERY_STATE_20)
2325                         {
2326                                 AppLogDebug("_pChargingTimer -> __pChargingCompletedTimer");
2327
2328                                 StartInitChargingCompletedTimer();
2329                         }
2330                 }
2331         }
2332         else if (timer.Equals(*_pChargingCompletedTimer))
2333         {
2334                 result r = E_SUCCESS;
2335                 AppLogDebug("__pChargingCompletedTimer");
2336                 bool isCharging = false;
2337
2338                 isCharging = _pCameraPresentationModel->IsCharging();
2339
2340                 _batteryStatus = GetCurrentBatteryState();
2341                 AppLogDebug("_batteryStatus = %d", _batteryStatus);
2342
2343                 if (isCharging == false && _batteryStatus == BATTERY_STATE_20)
2344                 {
2345                         if (_blinkCount == INDEX_UNIT_TWENTY)
2346                         {
2347                                 AppLogDebug("__pChargingCompletedTimer cancel");
2348
2349                                 _chargingCount = INDEX_UNIT_ZERO;
2350
2351                                 _blinkCount = INDEX_UNIT_ZERO;
2352
2353                                 _pChargingCompletedTimer->Cancel();
2354
2355                                 CheckBatteryStatus();
2356                         }
2357                         else
2358                         {
2359                                 AppLogDebug("OnChargingCompletedTimerExpired");
2360
2361                                 r = OnChargingCompletedTimerExpired();
2362                         }
2363                 }
2364                 else
2365                 {
2366                         AppLogDebug("isCharging = true >> __pChargingCompletedTimer cancel");
2367
2368                         _chargingCount = INDEX_UNIT_ZERO;
2369
2370                         _blinkCount = INDEX_UNIT_ZERO;
2371
2372                         _pChargingCompletedTimer->Cancel();
2373
2374                         CheckBatteryStatus();
2375                 }
2376         }
2377         else if (timer.Equals(*_pPreviewFailPopupTimer))
2378         {
2379                 AppLogDebug("__pPreviewFailPopupTimer");
2380                 _pPreviewFailPopupTimer->Cancel();
2381
2382                 if (_pCameraPresentationModel->GetStartPreviewException())
2383                 {
2384                         OnPreviewFailPopupTimerExpired();
2385                 }
2386         }
2387         else
2388         {
2389                 AppLogDebug("Not expire");
2390         }
2391         AppLogDebug("EXIT");
2392 }
2393
2394 result
2395 CameraForm::InitActionMenuPanel(void)
2396 {
2397         AppLogDebug("ENTER");
2398         result r = E_SUCCESS;
2399         Rectangle rectThumbnailButton;
2400         Rectangle clientArea = GetClientAreaBounds();
2401
2402         __pActionPanel = static_cast<Panel*>(GetControl(L"IDC_ACTION_PANEL"));
2403         TryCatch(__pActionPanel != null, r = E_SYSTEM, "__pActionPanel is null, Make panel fail!!!");
2404
2405         __pActionPanel->AddTouchEventListener(*this);
2406         __pActionPanel->SetName(IDS_ACTION_UI_PANEL_NAME);
2407
2408         AppLogDebug("GetDisplayResolutionType = %d", _pCameraPresentationModel->GetDisplayResolutionType());
2409
2410         if (__dir == ORIENTATION_STATUS_PORTRAIT_REVERSE
2411                 || __dir == ORIENTATION_STATUS_PORTRAIT)
2412         {
2413                 if (clientArea.height == DISPLAY_WVGA)
2414                 {
2415                         _pCameraPresentationModel->SetDisplayResolutionType(CameraPresentationModel::DISPLAY_RESOLUTION_WVGA);
2416                 }
2417                 else
2418                 {
2419                         _pCameraPresentationModel->SetDisplayResolutionType(CameraPresentationModel::DISPLAY_RESOLUTION_HD);
2420                 }
2421         }
2422         else
2423         {
2424                 if (clientArea.width == DISPLAY_WVGA)
2425                 {
2426                         _pCameraPresentationModel->SetDisplayResolutionType(CameraPresentationModel::DISPLAY_RESOLUTION_WVGA);
2427                 }
2428                 else
2429                 {
2430                         _pCameraPresentationModel->SetDisplayResolutionType(CameraPresentationModel::DISPLAY_RESOLUTION_HD);
2431                 }
2432         }
2433
2434         __pBatteryState = static_cast<Label*>(GetControl(L"IDC_BATTERY_STATE"));
2435         TryCatch(__pBatteryState != null, r = E_SYSTEM, "__pBattery is null");
2436         __pBatteryState->AddTouchEventListener(*this);
2437         __pBatteryState->SetShowState(true);
2438
2439         __pCameraSetting = static_cast<Button*>(GetControl(L"IDC_CAMERA_SETTING_POPUP"));
2440         TryCatch(__pCameraSetting != null, r = E_SYSTEM, "__pCameraSetting is null");
2441         __pCameraSetting->SetActionId(IDA_BUTTON_SETTING_CAMERA);
2442         __pCameraSetting->AddActionEventListener(*this);
2443         __pCameraSetting->SetShowState(false);
2444
2445         __pGeneralSetting = static_cast<Button*>(GetControl(L"IDC_GENERAL_SETTING_POPUP"));
2446         TryCatch(__pGeneralSetting != null, r = E_SYSTEM, "__pGeneralSetting is null");
2447         __pGeneralSetting->SetActionId(IDA_BUTTON_SETTING_GENERAL);
2448         __pGeneralSetting->AddActionEventListener(*this);
2449         __pGeneralSetting->SetShowState(false);
2450
2451         __pCameraSettingLable = static_cast<Label*>(GetControl(L"IDC_CAMERA_SETTING_LABEL"));
2452         TryCatch(__pCameraSettingLable != null, r = E_SYSTEM, "__pCameraSettingLable is null");
2453         __pCameraSettingLable->AddTouchEventListener(*this);
2454         __pCameraSettingLable->SetShowState(false);
2455
2456         __pGeneralSettingLable = static_cast<Label*>(GetControl(L"IDC_GENERAL_SETTING_LABEL"));
2457         TryCatch(__pGeneralSettingLable != null, r = E_SYSTEM, "__pGeneralSettingLable is null");
2458         __pGeneralSettingLable->AddTouchEventListener(*this);
2459         __pGeneralSettingLable->SetShowState(false);
2460
2461         __pCameraIconLabel = static_cast<Label*>(GetControl(L"IDC_CAMERA_ICON_LABEL"));
2462         TryCatch(__pCameraIconLabel != null, r = E_SYSTEM, "__pCameraIconLabel is null");
2463         __pCameraIconLabel->AddTouchEventListener(*this);
2464
2465         __pSwButton = static_cast<Button*>(GetControl(L"IDC_MODE_CHANGE_MODE_BUTTON"));
2466         TryCatch(__pSwButton != null, r = E_SYSTEM, "__pSwButton is null");
2467
2468         __pSwButton->SetName(IDS_ACTION_UI_CAMERA_MODE);
2469         __pSwButton->AddTouchEventListener(*this);
2470         __pSwButton->AddKeyEventListener(*this);
2471
2472         __pSwButton->GetAccessibilityContainer()->AddAccessibilityListener(*this);
2473
2474         __pCamcoderIconLabel = static_cast<Label*>(GetControl(L"IDC_CAMCORDER_ICON_LABEL"));
2475         TryCatch(__pCamcoderIconLabel != null, r = E_SYSTEM, "__pCamcoderIconLabel is null");
2476         __pCamcoderIconLabel->AddTouchEventListener(*this);
2477
2478         __pShutterButton = static_cast<Button*>(GetControl(L"IDC_SHUTTER_BUTTON"));
2479         TryCatch(__pShutterButton != null, r = E_SYSTEM, "__pShutterButton is null");
2480
2481         __pShutterButton->SetActionId(IDA_BUTTON_CAMERA_SHUTTER);
2482         __pShutterButton->SetName(IDS_ACTION_UI_PANEL_CAPTURE_NAME);
2483         __pShutterButton->AddActionEventListener(*this);
2484         __pShutterButton->AddTouchEventListener(*this);
2485
2486         AppLogDebug("GetDisplayResolutionType = %d", _pCameraPresentationModel->GetDisplayResolutionType());
2487
2488         if (__dir == ORIENTATION_STATUS_PORTRAIT_REVERSE
2489                 || __dir == ORIENTATION_STATUS_PORTRAIT)
2490         {
2491                 rectThumbnailButton = Rectangle(X_THUMBNAIL_IMG_PANEL_PORTRAIT, Y_THUMBNAIL_IMG_PANEL_PORTRAIT,
2492                                                         W_THUMBNAIL_IMG_PANEL_PORTRAIT, H_THUMBNAIL_IMG_PANEL_PORTRAIT);
2493         }
2494         else
2495         {
2496                 rectThumbnailButton = Rectangle(X_THUMBNAIL_IMG_PANEL_LANDSCAPE, Y_THUMBNAIL_IMG_PANEL_LANDSCAPE,
2497                                                         W_THUMBNAIL_IMG_PANEL_LANDSCAPE, H_THUMBNAIL_IMG_PANEL_LANDSCAPE);
2498         }
2499
2500         _pThumbnailPanel = new (std::nothrow) CameraThumbnailPanel();
2501         r = _pThumbnailPanel->Initialize(rectThumbnailButton);
2502         TryCatch(r == E_SUCCESS, r = E_SYSTEM, "_pThumbnailPanel Create fail[%s]", GetErrorMessage(r));
2503
2504         _pThumbnailPanel->SetName(IDS_THUMBNAIL_PANLE_NAME);
2505         _pThumbnailPanel->AddTouchEventListener(*this);
2506         AddControl(_pThumbnailPanel);
2507         AddOrientationEventListener(*_pThumbnailPanel);
2508
2509         __pThumbnailButton = static_cast<Button*>(GetControl(L"IDC_BACK_BUTTON"));
2510         TryCatch(__pThumbnailButton != null, r = E_SYSTEM, "__pThumbnailButton is null");
2511         __pThumbnailButton->SetActionId(IDA_BUTTON_CAMERA_THUMBNAIL);
2512         __pThumbnailButton->AddActionEventListener(*this);
2513         __pThumbnailButton->AddTouchEventListener(*this);
2514         __pThumbnailButton->SetShowState(false);
2515
2516         r = UpdateUiActionPanelIcon();
2517         TryCatch(r == E_SUCCESS, r = E_SYSTEM, "UpdateUiActionPanelIcon() is fail[%s]", GetErrorMessage(r));
2518
2519         AppLogDebug("EXIT");
2520         return E_SUCCESS;
2521
2522 CATCH:
2523         __pCameraIconLabel = null;
2524         __pCamcoderIconLabel = null;
2525         __pBatteryState = null;
2526         __pSwButton = null;
2527         __pShutterButton = null;
2528         __pThumbnailButton = null;
2529         __pCameraSetting = null;
2530         __pGeneralSetting = null;
2531         __pCameraSettingLable = null;
2532         __pGeneralSettingLable = null;
2533
2534         delete _pThumbnailPanel;
2535         _pThumbnailPanel = null;
2536
2537         return r;
2538 }
2539
2540 result
2541 CameraForm::UpdateUiPanelIcon(void)
2542 {
2543         AppLogDebug("ENTER");
2544         result r = E_SUCCESS;
2545         Bitmap* pBitmap = null;
2546         Bitmap* pBitmapRotate = null;
2547         int selfPortraitEnable = CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY;
2548         int flashMode = 0;
2549         bool value = false;
2550         ImageRotationType rotationType = IMAGE_ROTATION_0;
2551
2552         TryCatch(_pFlashButton != null, r = E_SYSTEM, "_pFlashButton is null");
2553
2554         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
2555         TryCatch(r == E_SUCCESS, , "Read Reg Fail[%s]", GetErrorMessage(r));
2556
2557         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
2558         {
2559                 r = _pCameraPresentationModel->SetValue(FLASH_MODE_SECONDARY, FLASH_MODE_OFF);
2560                 TryCatch(r == E_SUCCESS, , "SetValue Reg Fail[%s]", GetErrorMessage(r));
2561
2562                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS_DIM);
2563                 TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2564
2565                 pBitmapRotate = RotationImageN(pBitmap, rotationType);
2566                 TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2567
2568                 _pFlashButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2569
2570                 delete pBitmap;
2571                 pBitmap = null;
2572
2573                 delete pBitmapRotate;
2574                 pBitmapRotate = null;
2575
2576                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS_DIM);
2577                 TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2578
2579                 pBitmapRotate = RotationImageN(pBitmap, rotationType);
2580                 TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2581
2582                 _pFlashButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2583
2584                 delete pBitmap;
2585                 pBitmap = null;
2586
2587                 delete pBitmapRotate;
2588                 pBitmapRotate = null;
2589         }
2590         else if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2591         {
2592                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
2593
2594                 if (value == true && r == E_SUCCESS)
2595                 {
2596                         r = _pCameraPresentationModel->GetValue(FLASH_MODE_PRIMARY, flashMode);
2597                         TryCatch(r == E_SUCCESS, , "Read Reg Fail[%s]", GetErrorMessage(r));
2598
2599                         switch (flashMode)
2600                         {
2601                         case FLASH_MODE_OFF:
2602                                 {
2603                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_NOR);
2604                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2605         
2606                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2607                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2608
2609                                         _pFlashButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2610
2611                                         delete pBitmap;
2612                                         pBitmap = null;
2613
2614                                         delete pBitmapRotate;
2615                                         pBitmapRotate = null;
2616
2617                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS);
2618                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2619
2620                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2621                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2622
2623                                         _pFlashButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2624
2625                                         delete pBitmap;
2626                                         pBitmap = null;
2627
2628                                         delete pBitmapRotate;
2629                                         pBitmapRotate = null;
2630                                 }
2631                                 break;
2632
2633                         case FLASH_MODE_ON:
2634                                 {
2635                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_ON_NOR);
2636                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2637
2638                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2639                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2640
2641                                         _pFlashButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2642
2643                                         delete pBitmap;
2644                                         pBitmap = null;
2645
2646                                         delete pBitmapRotate;
2647                                         pBitmapRotate = null;
2648
2649                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_ON_PRESS);
2650                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2651
2652                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2653                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2654
2655                                         _pFlashButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2656
2657                                         delete pBitmap;
2658                                         pBitmap = null;
2659
2660                                         delete pBitmapRotate;
2661                                         pBitmapRotate = null;
2662                                 }
2663                                 break;
2664
2665                         case FLASH_MODE_AUTO:
2666                                 {
2667                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_NOR);
2668                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2669
2670                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2671                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2672
2673                                         _pFlashButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2674
2675                                         delete pBitmap;
2676                                         pBitmap = null;
2677
2678                                         delete pBitmapRotate;
2679                                         pBitmapRotate = null;
2680
2681                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_PRESS);
2682                                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2683
2684                                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2685                                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2686
2687                                         _pFlashButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2688
2689                                         delete pBitmap;
2690                                         pBitmap = null;
2691
2692                                         delete pBitmapRotate;
2693                                         pBitmapRotate = null;
2694                                 }
2695                                 break;
2696
2697                         default:
2698                                 break;
2699                         }
2700                 }
2701                 else
2702                 {
2703                         r = _pCameraPresentationModel->SetValue(FLASH_MODE_PRIMARY, FLASH_MODE_OFF);
2704                         TryCatch(r == E_SUCCESS, , "Read Reg Fail[%s]", GetErrorMessage(r));
2705
2706                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS_DIM);
2707                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2708
2709                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2710                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2711
2712                         _pFlashButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2713
2714                         delete pBitmap;
2715                         pBitmap = null;
2716
2717                         delete pBitmapRotate;
2718                         pBitmapRotate = null;
2719
2720                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS_DIM);
2721
2722                         TryCatch(pBitmap != null, r = E_SYSTEM, "FlashButton::pBitmap is null");
2723
2724                         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2725                         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2726
2727                         _pFlashButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2728
2729                         delete pBitmap;
2730                         pBitmap = null;
2731
2732                         delete pBitmapRotate;
2733                         pBitmapRotate = null;
2734                 }
2735         }
2736
2737         _pFlashButton->Invalidate(true);
2738         TryCatch(_pSelfShotButton != null, r = E_SYSTEM, "_pSelfShotButton is null");
2739
2740         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2741         {
2742                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_BACK);
2743         }
2744         else if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
2745         {
2746                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FRONT);
2747         }
2748         TryCatch(pBitmap != null, r = E_SYSTEM, "SelfShot::pBitmap is null");
2749         
2750         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2751         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2752
2753         _pSelfShotButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2754
2755         delete pBitmap;
2756         pBitmap = null;
2757
2758         delete pBitmapRotate;
2759         pBitmapRotate = null;
2760
2761         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2762         {
2763                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_BACK_PRESS);
2764         }
2765         else if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
2766         {
2767                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FRONT_PRESS);
2768         }
2769         TryCatch(pBitmap != null, r = E_SYSTEM, "SelfShot::pBitmap is null");
2770
2771         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2772         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2773
2774         _pSelfShotButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2775
2776         delete pBitmap;
2777         pBitmap = null;
2778
2779         delete pBitmapRotate;
2780         pBitmapRotate = null;   
2781
2782         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2783         {
2784                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_BACK);
2785         }
2786         else
2787         {
2788                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_FRONT);
2789         }
2790         TryCatch(pBitmap != null, r = E_SYSTEM, "SelfShot::pBitmap is null");
2791
2792         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2793         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2794
2795         _pSelfShotButton->SetDisabledBackgroundBitmap(*pBitmapRotate);
2796
2797         delete pBitmap;
2798         pBitmap = null;
2799
2800         delete pBitmapRotate;
2801         pBitmapRotate = null;
2802
2803         if (__dir == ORIENTATION_STATUS_LANDSCAPE
2804                 || __dir == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
2805         {
2806                 rotationType = IMAGE_ROTATION_270;
2807         }
2808
2809         TryCatch(_pSettingButton != null, r = E_SYSTEM, "_pSettingButton is null");
2810
2811         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SETTING_NOR);
2812         TryCatch(pBitmap != null, r = E_SYSTEM, "Setting::pBitmap is null");
2813
2814         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2815         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "Setting::pBitmapRotate is null");
2816
2817         _pSettingButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2818
2819         delete pBitmap;
2820         pBitmap = null;
2821
2822         delete pBitmapRotate;
2823         pBitmapRotate = null;
2824
2825         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SETTING_PRESS);
2826         TryCatch(pBitmap != null, r = E_SYSTEM, "Setting::pBitmap is null");
2827
2828         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2829         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "Setting::pBitmapRotate is null");
2830
2831         _pSettingButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2832
2833         delete pBitmap;
2834         pBitmap = null;
2835
2836         delete pBitmapRotate;
2837         pBitmapRotate = null;
2838
2839         TryCatch(__pSettingLine != null, r = E_SYSTEM, "__pSettingLine is null");
2840
2841         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SETTING_LINE);
2842         TryCatch(pBitmap != null, r = E_SYSTEM, "SettingLine::pBitmap is null");
2843
2844         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2845         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SettingLine::pBitmapRotate is null");
2846
2847         __pSettingLine->SetBackgroundBitmap(*pBitmapRotate);
2848
2849         delete pBitmap;
2850         pBitmap = null;
2851
2852         delete pBitmapRotate;
2853         pBitmapRotate = null;
2854
2855         TryCatch(_pQuickSettingButton != null, r = E_SYSTEM, "_pQuickSettingButton is null");
2856
2857         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_QUICK_SETTING_NOR);
2858         TryCatch(pBitmap != null, r = E_SYSTEM, "QuickSetting::pBitmap is null");
2859
2860         _pQuickSettingButton->SetNormalBackgroundBitmap(*pBitmap);
2861
2862         delete pBitmap;
2863         pBitmap = null;
2864
2865         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_QUICK_SETTING_PRESS);
2866         TryCatch(pBitmap != null, r = E_SYSTEM, "QuickSetting::pBitmap is null");
2867
2868         _pQuickSettingButton->SetPressedBackgroundBitmap(*pBitmap);
2869
2870         delete pBitmap;
2871         pBitmap = null;
2872
2873         TryCatch(_pWhiteBalanceButton != null, r = E_SYSTEM, "_pWhiteBalanceButton is null");
2874
2875         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
2876         {
2877                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
2878         }
2879         else
2880         {
2881                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
2882         }
2883
2884         if (r == E_SUCCESS)
2885         {
2886                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_WHITEBALANCE);
2887                 TryCatch(pBitmap != null, r = E_SYSTEM, "WhiteBalance::pBitmap is null");
2888
2889                 _pWhiteBalanceButton->SetNormalBackgroundBitmap(*pBitmap);
2890
2891                 delete pBitmap;
2892                 pBitmap = null;
2893
2894                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_WHITEBALANCE_PRESS);
2895                 TryCatch(pBitmap != null, r = E_SYSTEM, "WhiteBalance::pBitmap is null");
2896
2897                 _pWhiteBalanceButton->SetPressedBackgroundBitmap(*pBitmap);
2898
2899                 delete pBitmap;
2900                 pBitmap = null;
2901         }
2902         else
2903         {
2904                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_WHITEBALANCE_DIM_PRESS);
2905                 TryCatch(pBitmap != null, r = E_SYSTEM, "WhiteBalance::pBitmap is null");
2906
2907                 _pWhiteBalanceButton->SetNormalBackgroundBitmap(*pBitmap);
2908
2909                 delete pBitmap;
2910                 pBitmap = null;
2911
2912                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_WHITEBALANCE_DIM_PRESS);
2913                 TryCatch(pBitmap != null, r = E_SYSTEM, "WhiteBalance::pBitmap is null");
2914
2915                 _pWhiteBalanceButton->SetPressedBackgroundBitmap(*pBitmap);
2916
2917                 delete pBitmap;
2918                 pBitmap = null;
2919         }
2920
2921         TryCatch(_pExposureValueButton != null, r = E_SYSTEM, "_pExposureValueButton is null");
2922
2923         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_EXPOSURE);
2924         TryCatch(pBitmap != null, r = E_SYSTEM, "ExposureValue::pBitmap is null");
2925
2926         _pExposureValueButton->SetNormalBackgroundBitmap(*pBitmap);
2927
2928         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_EXPOSURE_PRESS);
2929         TryCatch(pBitmap != null, r = E_SYSTEM, "ExposureValue::pBitmap is null");
2930
2931         _pExposureValueButton->SetPressedBackgroundBitmap(*pBitmap);
2932
2933         delete pBitmap;
2934         pBitmap = null;
2935
2936         TryCatch(_pCloseButton != null, r = E_SYSTEM, "_pCloseButton is null");
2937
2938         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_CLOSE);
2939         TryCatch(pBitmap != null, r = E_SYSTEM, "Close::pBitmap is null");
2940
2941         pBitmapRotate = RotationImageN(pBitmap, rotationType);
2942         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
2943
2944         _pCloseButton->SetNormalBackgroundBitmap(*pBitmapRotate);
2945         _pCloseButton->SetPressedBackgroundBitmap(*pBitmapRotate);
2946
2947         delete pBitmap;
2948         pBitmap = null;
2949
2950         delete pBitmapRotate;
2951         pBitmapRotate = null;
2952
2953         AppLogDebug("EXIT");
2954         return r;
2955
2956 CATCH:
2957         if (pBitmap != null)
2958         {
2959                 delete pBitmap;
2960                 pBitmap = null;
2961         }
2962
2963         return r;
2964 }
2965
2966 result
2967 CameraForm::UpdateUiActionPanelIcon(void)
2968 {
2969         AppLogDebug("ENTER");
2970         result r = E_SUCCESS;
2971         Bitmap* pBitmap = null;
2972         Bitmap* pBitmapRotate = null;
2973         ImageRotationType rotationType = IMAGE_ROTATION_0;
2974         Point ptShutterIcon;
2975         Point ptModeChangeButton;
2976         Rectangle rectThumbnailButton;
2977
2978         AppLogDebug("GetDisplayResolutionType = %d", _pCameraPresentationModel->GetDisplayResolutionType());
2979
2980         if (__dir == ORIENTATION_STATUS_PORTRAIT
2981                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
2982         {
2983                 rotationType = IMAGE_ROTATION_90;
2984                 ptShutterIcon = Point(X_ACTION_PANEL_SHUTTER_ICON_PORTRAIT_HD, Y_ACTION_PANEL_SHUTTER_ICON_PORTRAIT_HD);
2985                 ptModeChangeButton = Point(X_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_PORTRAIT, Y_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_PORTRAIT);
2986         }
2987         else if (__dir == ORIENTATION_STATUS_LANDSCAPE
2988                         || __dir == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
2989         {
2990                 rotationType = IMAGE_ROTATION_0;
2991                 ptShutterIcon = Point(X_ACTION_PANEL_SHUTTER_ICON_LANDSCAPE_HD, Y_ACTION_PANEL_SHUTTER_ICON_LANDSCAPE_HD);
2992                 ptModeChangeButton = Point(X_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_LANDSCAPE, Y_ACTION_PANEL_CAMERA_CAMCODER_BUTTON_LANDSCAPE);
2993         }
2994
2995         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_CAMERA_ON);
2996         TryCatch(pBitmap != null, r = E_SYSTEM, "CameraIconLabel::pBitmap is null");
2997
2998         __pCameraIconLabel->SetBackgroundBitmap(*pBitmap);
2999
3000         delete pBitmap;
3001         pBitmap = null;
3002
3003         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_BG);
3004         TryCatch(pBitmap != null, r = E_SYSTEM, "SwButton::pBitmap is null");
3005
3006         pBitmapRotate = RotationImageN(pBitmap, rotationType);
3007         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "SwButton::pBitmapRotate is null");
3008
3009         __pSwButton->SetNormalBackgroundBitmap(*pBitmapRotate);
3010         __pSwButton->SetPressedBackgroundBitmap(*pBitmapRotate);
3011         delete pBitmap;
3012         pBitmap = null;
3013
3014         delete pBitmapRotate;
3015         pBitmapRotate = null;
3016
3017         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_BUTTON_VER);
3018         TryCatch(pBitmap != null, r = E_SYSTEM, "SwButton::pBitmap is null");
3019
3020         __pSwButton->SetNormalBitmap(ptModeChangeButton, *pBitmap);
3021         delete pBitmap;
3022         pBitmap = null;
3023
3024         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_CAMCORDER_ON);
3025         TryCatch(pBitmap != null, r = E_SYSTEM, "CamcoderIconLabel::pBitmap is null");
3026
3027         __pCamcoderIconLabel->SetBackgroundBitmap(*pBitmap);
3028
3029         delete pBitmap;
3030         pBitmap = null;
3031
3032         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_BTN_BACK);
3033         TryCatch(pBitmap != null, r = E_SYSTEM, "Back::pBitmap is null");
3034
3035         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3036         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "Back::pBitmapRotate is null");
3037
3038         delete pBitmap;
3039         pBitmap = null;
3040
3041         delete pBitmapRotate;
3042         pBitmapRotate = null;
3043
3044         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_BTN_BACK_PRESS);
3045         TryCatch(pBitmap != null, r = E_SYSTEM, "Back::pBitmap is null");
3046
3047         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3048         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "Back::pBitmapRotate is null");
3049
3050         delete pBitmap;
3051         pBitmap = null;
3052
3053         delete pBitmapRotate;
3054         pBitmapRotate = null;
3055
3056         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_BTN_BACK);
3057         TryCatch(pBitmap != null, r = E_SYSTEM, "Back::pBitmap is null");
3058
3059         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3060         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "Back::pBitmapRotate is null");
3061
3062         delete pBitmap;
3063         pBitmap = null;
3064
3065         delete pBitmapRotate;
3066         pBitmapRotate = null;
3067
3068         if (__dir == ORIENTATION_STATUS_PORTRAIT
3069                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
3070         {
3071                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SHUTTER_NORMAL);
3072                 TryCatch(pBitmap != null, r = E_SYSTEM, "ShutterButton::pBitmap is null");
3073         }
3074         else
3075         {
3076                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SHUTTER_NORMAL_LAND);
3077                 TryCatch(pBitmap != null, r = E_SYSTEM, "ShutterButton::pBitmap is null");
3078         }
3079
3080         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3081         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "ShutterButton::pBitmapRotate is null");
3082
3083         __pShutterButton->SetNormalBackgroundBitmap(*pBitmapRotate);
3084
3085         delete pBitmap;
3086         pBitmap = null;
3087
3088         delete pBitmapRotate;
3089         pBitmapRotate = null;
3090
3091         if (__dir == ORIENTATION_STATUS_PORTRAIT
3092                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
3093         {
3094                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SHUTTER_PRESS);
3095                 TryCatch(pBitmap != null, r = E_SYSTEM, "ShutterButton::pBitmap is null");
3096         }
3097         else
3098         {
3099                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SHUTTER_PRESS_LAND);
3100                 TryCatch(pBitmap != null, r = E_SYSTEM, "ShutterButton::pBitmap is null");
3101         }
3102
3103         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3104         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "ShutterButton::pBitmapRotate is null");
3105
3106         __pShutterButton->SetPressedBackgroundBitmap(*pBitmapRotate);
3107         delete pBitmap;
3108         pBitmap = null;
3109
3110         delete pBitmapRotate;
3111         pBitmapRotate = null;
3112
3113         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_SHUTTER_ICON);
3114         TryCatch(pBitmap != null, r = E_SYSTEM, "ShutterButton::pBitmap is null");
3115
3116         __pShutterButton->SetNormalBitmap(ptShutterIcon, *pBitmap);
3117
3118         delete pBitmap;
3119         pBitmap = null;
3120
3121         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG);
3122         TryCatch(pBitmap != null, r = E_SYSTEM, "ThumbnailButton::pBitmap is null");
3123
3124         __pThumbnailButton->SetNormalBackgroundBitmap(*pBitmap);
3125
3126         delete pBitmap;
3127         pBitmap = null;
3128
3129         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG_PRESS);
3130         TryCatch(pBitmap != null, r = E_SYSTEM, "ThumbnailButton::pBitmap is null");
3131
3132         __pThumbnailButton->SetPressedBackgroundBitmap(*pBitmap);
3133
3134         delete pBitmap;
3135         pBitmap = null;
3136
3137         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_SETTING_POPUP_CAMERA);
3138         TryCatch(pBitmap != null, r = E_SYSTEM, "CameraSetting::pBitmap is null");
3139
3140         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3141         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "CameraSetting::pBitmapRotate is null");
3142
3143         __pCameraSetting->SetNormalBackgroundBitmap(*pBitmapRotate);
3144         __pCameraSetting->SetPressedBackgroundBitmap(*pBitmapRotate);
3145
3146         delete pBitmap;
3147         pBitmap = null;
3148
3149         delete pBitmapRotate;
3150         pBitmapRotate = null;
3151
3152         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_SETTING_POPUP_GENERAL);
3153         TryCatch(pBitmap != null, r = E_SYSTEM, "GeneralSetting::pBitmap is null");
3154
3155         pBitmapRotate = RotationImageN(pBitmap, IMAGE_ROTATION_0);
3156         TryCatch(pBitmapRotate != null, r = E_SYSTEM, "GeneralSetting::pBitmapRotate is null");
3157
3158         __pGeneralSetting->SetNormalBackgroundBitmap(*pBitmapRotate);
3159         __pGeneralSetting->SetPressedBackgroundBitmap(*pBitmapRotate);
3160
3161         delete pBitmap;
3162         pBitmap = null;
3163
3164         delete pBitmapRotate;
3165         pBitmapRotate = null;
3166
3167         AppLogDebug("EXIT");
3168         return r;
3169
3170 CATCH:
3171         if (pBitmap != null)
3172         {
3173                 delete pBitmap;
3174                 pBitmap = null;
3175         }
3176
3177         return r;
3178 }
3179
3180 result
3181 CameraForm::SetTimerIntervalValue(int timerIntervalValue)
3182 {
3183         AppLogDebug("ENTER");
3184         result r = E_SUCCESS;
3185
3186         AppLogDebug("timerIntervalValue = %d", timerIntervalValue);
3187
3188         switch (timerIntervalValue)
3189         {
3190         case SETTING_TIMER_CAPTURE_0_SEC:
3191                 {
3192                 }
3193                 break;
3194
3195         case SETTING_TIMER_CAPTURE_2_SEC:
3196                 {
3197                         _pIntervalValueTimer->Cancel();
3198
3199                         r = _pIntervalValueTimer->Start(CAMERA_TIMER_2_SEC);
3200                         TryCatch(r == E_SUCCESS, , "_pIntervalValueTimer start fail[%s]", GetErrorMessage(r));
3201                 }
3202                 break;
3203
3204         case SETTING_TIMER_CAPTURE_5_SEC:
3205                 {
3206                         _pIntervalValueTimer->Cancel();
3207
3208                         r = _pIntervalValueTimer->Start(CAMERA_TIMER_5_SEC);
3209                         TryCatch(r == E_SUCCESS, , "_pIntervalValueTimer start fail[%s]", GetErrorMessage(r));
3210                 }
3211                 break;
3212
3213         case SETTING_TIMER_CAPTURE_10_SEC:
3214                 {
3215                         _pIntervalValueTimer->Cancel();
3216
3217                         r = _pIntervalValueTimer->Start(CAMERA_TIMER_10_SEC);
3218                         TryCatch(r == E_SUCCESS, , "_pIntervalValueTimer start fail[%s]", GetErrorMessage(r));
3219                 }
3220                 break;
3221
3222         default:
3223                 {
3224                         AppLogDebug("timer Invaild element id");
3225                 }
3226                 break;
3227         }
3228
3229         AppLogDebug("EXIT");
3230         return E_SUCCESS;
3231
3232 CATCH:
3233         return r;
3234 }
3235
3236 void
3237 CameraForm::SetExifOrientation(int deviceOrientation)
3238 {
3239         AppLogDebug("ENTER");
3240         result r = E_SUCCESS;
3241
3242         r = _pCameraPresentationModel->SetExifOrientation(deviceOrientation);
3243         AppLogDebug("SetExifOrientation : deviceOrientation = %d, fail[%s]", deviceOrientation, GetErrorMessage(r));
3244         AppLogDebug("EXIT");
3245 }
3246
3247 void
3248 CameraForm::StartCaptured(void)
3249 {
3250         AppLogDebug("ENTER");
3251         result r = E_SUCCESS;
3252         int timerInterval = 0;
3253
3254         timerInterval = GetTimerIntervalValue();
3255
3256         switch (timerInterval)
3257         {
3258         case SETTING_TIMER_CAPTURE_0_SEC:
3259                 {
3260                         _isUsedTimerCaptured = false;
3261
3262                         __isTimerRunning = false;
3263
3264                         _pCameraPresentationModel->SetIntervalTimerRun(false);
3265
3266                         _pIntervalValueTimer->Cancel();
3267                         
3268                         _pCameraPresentationModel->Capture();
3269
3270                         StartInitChargingTimer();
3271                 }
3272                 break;
3273
3274         case SETTING_TIMER_CAPTURE_2_SEC:
3275                 // fall through
3276         case SETTING_TIMER_CAPTURE_5_SEC:
3277                 // fall through
3278         case SETTING_TIMER_CAPTURE_10_SEC:
3279                 {
3280                         __isTimerRunning = true;
3281
3282                         if (__pBatteryState)
3283                         {
3284                                 __pBatteryState->SetShowState(false);
3285                                 __pBatteryState->Draw();
3286                                 __pBatteryState->Show();
3287                         }
3288
3289                         _pCameraPresentationModel->SetIntervalTimerRun(true);
3290
3291                         HideUiPanel(true);
3292
3293                         if (_pCameraInfoPanel != null)
3294                         {
3295                                 _pCameraInfoPanel->SetDrawIndicator(false);
3296                                 _pCameraInfoPanel->Invalidate(true);
3297                         }
3298
3299                         if (_isUsedTimerCaptured == false)
3300                         {
3301                                 _pCaptureStartTimer->Cancel();
3302
3303                                 _pCameraInfoPanel->SetDrawMarkerFocus(false);
3304
3305                                 _pCameraInfoPanel->Invalidate(true);
3306
3307                                 r = _pCaptureStartTimer->Start(CAMERA_TIMER_1_SEC);
3308                                 TryReturnVoid(r == E_SUCCESS, "_pCaptureStartTimer start fail[%s]", GetErrorMessage(r));
3309                         }
3310                 }
3311                 break;
3312
3313         default:
3314                 break;
3315         }
3316         AppLogDebug("EXIT");
3317 }
3318
3319 void
3320 CameraForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
3321 {
3322         AppLogDebug("ENTER");
3323         result r = E_SUCCESS;
3324         int selfPortraitEnable = 0;
3325         int guideLineEnable = 0;
3326         switch (actionId)
3327         {
3328         case IDA_BUTTON_CAMERA_FLASH:
3329                 {
3330                         int selfPortraitEnable = 0;
3331                         result r = E_SUCCESS;
3332                         bool value = false;
3333                         bool isCharging = false;
3334                         BatteryLevel batteryLevel;
3335
3336                         batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
3337                         isCharging = _pCameraPresentationModel->IsCharging();
3338
3339                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3340                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3341
3342                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
3343                         {
3344                                 AppLogDebug("FLASEH OFF!!!");
3345                         }
3346                         else
3347                         {
3348                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
3349
3350                                 if (value == true && r == E_SUCCESS)
3351                                 {
3352                                         if (batteryLevel == BATTERY_LOW && isCharging == false)
3353                                         {
3354                                                 int result = 0;
3355                                                 MessageBox msgBox;
3356                                                 String tmpString;
3357                                                 AppResource* pAppResource = null;
3358
3359                                                 pAppResource = Application::GetInstance()->GetAppResource();
3360                                                 TryReturnVoid(pAppResource != null, "Failed to allocate memory for pAppResource");
3361
3362                                                 pAppResource->GetString(L"IDS_COM_BODY_LOW_BATTERY", tmpString);
3363
3364                                                 r = msgBox.Construct(L"", tmpString, MSGBOX_STYLE_NONE, MESSAGEBOX_DISPLAY_TIME_2_SEC);
3365                                                 TryReturnVoid(r == E_SUCCESS, "msgBox::Construct() failed by [%s]", GetErrorMessage(r));
3366                                                 msgBox.ShowAndWait(result);
3367                                         }
3368                                         else
3369                                         {
3370                                                 SetFlashPopop();
3371                                         }
3372                                 }
3373                                 else
3374                                 {
3375                                         AppLogDebug("FLASEH OFF!!!");
3376                                 }
3377                         }
3378                 }
3379                 break;
3380
3381         case IDA_BUTTON_CAMERA_SELF:
3382                 {
3383                         int selfPortraitEnable = 0;
3384                         result r = E_SUCCESS;
3385                         bool value = false;
3386                         int cameraCount = 0;
3387
3388                         if (_pCameraPresentationModel->GetCameraState() != CAMERA_STATE_PREVIEW)
3389                         {
3390                                 AppLogDebug("Camera Preview is not");
3391                                 return;
3392                         }
3393
3394                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_COUNT, cameraCount);
3395                         AppLogDebug("GetMediaCapability [%s]", GetErrorMessage(r));
3396
3397                         if (cameraCount < SUPPORTED_CAMERA_NUM)
3398                         {
3399                                 AppLogDebug("The physical direction of the camera is not exit");
3400                                 return;
3401                         }
3402
3403                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3404                         TryReturnVoid(r == E_SUCCESS, "Faled to get value to registry[%s]", GetErrorMessage(r));
3405                         MakeSettingPopupTab(false);
3406
3407
3408
3409                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
3410                         {
3411                                 AppLogDebug("PRIMARY -> SECONDARY");
3412
3413                                 __isToggleCameraDirection = true;
3414
3415                                 r = _pCameraPresentationModel->SetValue(SELF_PORTRAIT_ENABLE, CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY);
3416                                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3417
3418                                 r = ToggleCameraDirection(CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY);
3419                                 TryReturnVoid(r == E_SUCCESS, "ToggleCameraDirection() fail[%s]", GetErrorMessage(r));
3420
3421                                 r = _pCameraPresentationModel->SetValue(FLASH_MODE_SECONDARY, FLASH_MODE_OFF);
3422                                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3423
3424                         }
3425                         else if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
3426                         {
3427                                 AppLogDebug("SECONDARY -> PRIMARY");
3428                                 int primaryFlashValue = FLASH_MODE_OFF;
3429                                 __isToggleCameraDirection = true;
3430
3431                                 r = _pCameraPresentationModel->SetValue(SELF_PORTRAIT_ENABLE, CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY);
3432                                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3433
3434                                 r = ToggleCameraDirection(CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY);
3435                                 TryReturnVoid(r == E_SUCCESS, "ToggleCameraDirection() fail[%s]", GetErrorMessage(r));
3436
3437                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
3438                                 _pCameraPresentationModel->GetValue(FLASH_MODE_PRIMARY, primaryFlashValue);
3439
3440                                 if (value == true && r == E_SUCCESS)
3441                                 {
3442                                         r = _pCameraPresentationModel->SetValue(FLASH_MODE_PRIMARY, primaryFlashValue);
3443                                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3444                                 }
3445                         }
3446                         HidePopup();
3447                         UpdateUiPanelIcon();
3448                         MakePreviewResolutionList(true);
3449                         MakeCaptrueResolutionList(true);
3450                         MakeIsoList(true);
3451
3452                         TryReturnVoid(_pFlashButton != null, "_pFlashButton is null");
3453                         _pFlashButton->Invalidate(true);
3454
3455                         TryReturnVoid(_pSelfShotButton != null, "_pSelfShotButton is null");
3456                         _pSelfShotButton->Invalidate(true);
3457
3458                         __isToggleCameraDirection = false;
3459                 }
3460                 break;
3461
3462         case IDA_BUTTON_CAMERA_SETTING:
3463                 {
3464                         result r = E_SUCCESS;
3465
3466                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3467                         _pAppTimer->Cancel();
3468
3469                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3470                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3471
3472                         UpdateUiPanelIcon();
3473                 
3474                         ShowUiQuickMenu();
3475                 }
3476                 break;
3477
3478         case IDA_BUTTON_CLOSE_SETTING:
3479                 {
3480                         result r = E_SUCCESS;
3481
3482                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3483                         _pAppTimer->Cancel();
3484
3485                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3486                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3487
3488                         HideUiQuickMenu();
3489                 }
3490                 break;
3491
3492         case IDA_BUTTON_CAMERA_QUICK_SETTING:
3493                 {
3494                         result r = E_SUCCESS;
3495
3496                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3497                         _pAppTimer->Cancel();
3498
3499                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3500                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3501
3502                         MakeCameraTabSettingPopup();
3503                 }
3504                 break;
3505
3506         case IDA_BUTTON_SETTING_CAMERA:
3507                 {
3508                         result r = E_SUCCESS;
3509
3510                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3511                         _pAppTimer->Cancel();
3512
3513                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3514                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3515
3516                         if (_pListViewGeneralTabMainMenu)
3517                         {
3518                                 _pListViewGeneralTabMainMenu->SetShowState(false);
3519                         }
3520
3521                         if (_pListViewGeneralTabSubMenu)
3522                         {
3523                                 _pListViewGeneralTabSubMenu->SetShowState(false);
3524                         }
3525
3526                         MakeCameraTabSettingPopup();
3527                 }
3528                 break;
3529
3530         case IDA_BUTTON_SETTING_GENERAL:
3531                 {
3532                         result r = E_SUCCESS;
3533
3534                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3535                         _pAppTimer->Cancel();
3536
3537                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3538                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3539
3540                         AppLogDebug("IDA_BUTTON_SETTING_GENERAL");
3541
3542                         if (_pListViewCameraTabMainMenu)
3543                         {
3544                                 _pListViewCameraTabMainMenu->SetShowState(false);
3545                         }
3546
3547                         if (_pListViewCameraTabSubMenu)
3548                         {
3549                                 _pListViewCameraTabSubMenu->SetShowState(false);
3550                         }
3551
3552                         MakeGeneralTabSettingPopup();
3553                 }
3554                 break;
3555
3556         case IDA_BUTTON_CAMERA_EV:
3557                 {
3558                         result r = E_SUCCESS;
3559                         bool exposureValue = false;
3560                         bool brighnesstValue = false;
3561                         int selfPortraitEnable = 0;
3562                         int adjustValue = 0;
3563
3564                         if (_pCameraInfoPanel->GetDrawExposure() == true)
3565                         {
3566                                 AppLogDebug("Draw is Exposure status");
3567                                 return;
3568                         }
3569
3570                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3571                         _pAppTimer->Cancel();
3572
3573                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3574                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3575
3576                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3577                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3578
3579                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3580                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3581
3582                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
3583                         {
3584                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
3585                         }
3586                         else
3587                         {
3588                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
3589                         }
3590
3591                         if (exposureValue == true && r == E_SUCCESS)
3592                         {
3593                                 AppLogDebug("CAMERA_SUB_MENU_CONTENT_EXPOSURE_MODE");
3594
3595                                 r = _pCameraPresentationModel->GetValue(EXPOSURE_VALUE, adjustValue);
3596                                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3597
3598                                 AppLogDebug("adjustValue = %d", adjustValue);
3599
3600                                 _pCameraPresentationModel->SetExposure(adjustValue);
3601
3602                                 MakeSettingPopupTab(false);
3603
3604                                 HidePopup();
3605
3606                                 r = CreateExposureSlider();
3607                                 TryReturnVoid(r == E_SUCCESS, "CreateExposureSlider() fail[%s]", GetErrorMessage(r));
3608
3609                                 r = DrawExposureSlider();
3610                                 TryReturnVoid(r == E_SUCCESS, "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
3611                         }
3612                         else
3613                         {
3614                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
3615                                 {
3616                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
3617                                 }
3618                                 else
3619                                 {
3620                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
3621                                 }
3622
3623                                 if (brighnesstValue == true && r == E_SUCCESS)
3624                                 {
3625                                         AppLogDebug("CAMERA_SUB_MENU_CONTENT_EXPOSURE_MODE");
3626
3627                                         r = _pCameraPresentationModel->GetValue(BRIGHTNESS_VALUE, adjustValue);
3628                                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3629
3630                                         AppLogDebug("adjustValue = %d", adjustValue);
3631
3632                                         _pCameraPresentationModel->SetBrightness(adjustValue);
3633
3634                                         MakeSettingPopupTab(false);
3635
3636                                         HidePopup();
3637
3638                                         r = CreateExposureSlider();
3639                                         TryReturnVoid(r == E_SUCCESS, "CreateExposureSlider() fail[%s]", GetErrorMessage(r));
3640
3641                                         r = DrawExposureSlider();
3642                                         TryReturnVoid(r == E_SUCCESS, "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
3643                                 }
3644                                 else
3645                                 {
3646                                         AppLogDebug("Exposure do not support");
3647                                 }
3648                         }
3649                 }
3650                 break;
3651
3652         case IDA_BUTTON_CAMERA_WB:
3653                 {
3654                         result r = E_SUCCESS;
3655                         int selfPortraitEnable = 0;
3656
3657                         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3658                         _pAppTimer->Cancel();
3659
3660                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3661                         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
3662
3663                         if (_pCameraInfoPanel->GetDrawExposure() == true)
3664                         {
3665                                 _closeTimerValue = 0;
3666
3667                                 if (_pExposureCloseTimer)
3668                                 {
3669                                         _pExposureCloseTimer->Cancel();
3670                                 }
3671
3672                                 _pCameraInfoPanel->SetDrawExposure(false);
3673                                 Invalidate(true);
3674                         }
3675
3676                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3677                         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
3678                         
3679                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
3680                         {
3681                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
3682                         }
3683                         else
3684                         {
3685                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
3686                         }
3687
3688                         if (r == E_SUCCESS)
3689                         {
3690                                 SetWhiteBalancePopop();
3691                         }
3692                         else
3693                         {
3694                                 AppLogDebug("WB is not support");
3695                         }
3696                 }
3697                 break;
3698
3699         case IDA_BUTTON_CAMERA_BACK:
3700                 {
3701                         AppLogDebug("IDA_BUTTON_CAMCORDER_BACK");
3702                         result r = E_SUCCESS;   
3703
3704                         r = BackButtonPerformed();
3705                         AppLogDebug("BackButtonPerformed fail [%s]", GetErrorMessage(r));
3706                 }
3707                 break;
3708
3709
3710         case IDA_BTN_YES:
3711         {
3712                 AppLogDebug("ResetPopup : MSGBOX_RESULT_YES");
3713
3714                 if (_pResetPopUp != null && _pResetPopUp->IsVisible())
3715                 {
3716                         _pResetPopUp->SetShowState(false);
3717                 }
3718
3719                 r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, guideLineEnable);
3720                 TryReturnVoid(r == E_SUCCESS, "GetValue() fail(%s)", GetErrorMessage(r));
3721
3722                 if (guideLineEnable == CAMERA_GUIDELINE_ENABLE)
3723                 {
3724                         r = DrawMarker(false);
3725                         TryReturnVoid(r == E_SUCCESS, "DrawMarker() fail(%s)", GetErrorMessage(r));
3726
3727                         SetGuideLine(SUBMENU_MODE_OFF);
3728                 }
3729
3730                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
3731                 TryReturnVoid(r == E_SUCCESS, "GetValue() fail(%s)", GetErrorMessage(r));
3732
3733                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
3734                 {
3735                         RestoreDefaultSetting();
3736
3737                         r = RestorePrimaryResolution();
3738                         TryReturnVoid(r == E_SUCCESS, "RestoreResolutionDefault() fail(%s)", GetErrorMessage(r));
3739                 }
3740                 else
3741                 {
3742                         BufferInfo bufferinfo;
3743
3744                         AppLogDebug("SUBMENU_RESET_MODE : CAMERA_FORM_SECONDARY_MODE");
3745
3746                         r = _pCameraPresentationModel->SetValue(SELF_PORTRAIT_ENABLE, CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY);
3747                         TryReturnVoid(r == E_SUCCESS, "SetValue() fail(%s)", GetErrorMessage(r));
3748
3749                         r = ToggleCameraDirection(CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY);
3750                         TryReturnVoid(r == E_SUCCESS, "ToggleCameraDirection() fail[%s]", GetErrorMessage(r));
3751
3752                         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
3753                         TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo() fail(%s)", GetErrorMessage(r));
3754
3755                         _pCameraPresentationModel->StartPreview(&bufferinfo);
3756
3757                         _pCameraPresentationModel->SetContinuousAutoFocus();
3758
3759                         MakePreviewResolutionList(true);
3760
3761                         MakeCaptrueResolutionList(true);
3762
3763                         MakeIsoList(true);
3764
3765                         RestoreSecondaryResolution();
3766                         TryReturnVoid(r == E_SUCCESS, "RestoreResolutionDefault() fail(%s)", GetErrorMessage(r));
3767
3768                         RestoreDefaultSetting();
3769                 }
3770
3771                 r = _pCameraPresentationModel->SetValue(CURRENT_MODE, CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
3772                 TryReturnVoid(r == E_SUCCESS, "Reg setValue fail[%s]", GetErrorMessage(r));
3773
3774                 MakeSettingPopupTab(false);
3775
3776                 HideUiQuickMenu();
3777
3778                 r = UpdateUiPanelIcon();
3779                 //TryReturnVoid(r == E_SUCCESS, "UpdateUiPanelIcon() fail(%s)", GetErrorMessage(r));
3780
3781                 r = SetScreenOverlayHelpTimer();
3782                 TryReturnVoid(r == E_SUCCESS, "SetScreenOverlayHelpTimer() fail(%s)", GetErrorMessage(r));
3783
3784                 r = DrawScreenOverlayHelp();
3785                 TryReturnVoid(r == E_SUCCESS, "DrawScreenOverlayHelp() fail(%s)", GetErrorMessage(r));
3786
3787                 TryReturnVoid(_pFlashButton != null, "_pFlashButton is null");
3788                 _pFlashButton->Invalidate(true);
3789                 HidePopup();
3790         }
3791         break;
3792
3793         case IDA_BTN_NO:
3794         {
3795                 if (_pResetPopUp != null && _pResetPopUp->IsVisible())
3796                 {
3797                         _pResetPopUp->SetShowState(false);
3798                 }
3799                 MakeSettingPopupTab(false);
3800                 AppLogDebug("ResetPopup : MSGBOX_RESULT_NO");
3801                 HidePopup();
3802         }
3803         break;
3804
3805         case IDA_BUTTON_CAMERA_SHUTTER:
3806         {               
3807                 MakeSettingPopupTab(false);
3808                 if (_pCameraPresentationModel->GetCameraState() == CAMERA_STATE_PREVIEW)
3809                 {
3810                         DoCapture();
3811                 }
3812         }
3813         break;
3814         default:
3815                 break;
3816         }
3817         AppLogDebug("EXIT");
3818 }
3819
3820 void
3821 CameraForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
3822 {
3823         AppLogDebug("ENTER");
3824         if (_appControlActionCompleted)
3825         {
3826                 AppLogDebug("EXIT - App Terminate");
3827                 return;
3828         }
3829         OnCameraActionPerformed(static_cast<CameraActionEvent>(requestId));
3830         AppLogDebug("EXIT");
3831 }
3832
3833 void
3834 CameraForm::OnFileEventOccured(const unsigned long events, const Tizen::Base::String& path, const unsigned int eventId)
3835 {
3836         AppLogDebug("ENTER");
3837         bool isExistThumbnail = false;
3838         Bitmap* pBitmap = null;
3839         Point ptThumbnailImg = Point(X_THUMBNAIL_BUTTON_IMG, Y_THUMBNAIL_BUTTON_IMG);
3840
3841         isExistThumbnail = _pCameraPresentationModel->IsExistThumbnail(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
3842
3843         if (isExistThumbnail == false)
3844         {
3845                 AppLogDebug("Thumbnail is not found");
3846
3847                 TryReturnVoid(_pThumbnailPanel != null, "_pThumbnailPanel is null");
3848
3849                 _pThumbnailPanel->SetShowState(false);
3850                 _pThumbnailPanel->Draw();
3851                 _pThumbnailPanel->Show();
3852
3853                 __pThumbnailButton->SetShowState(true);
3854
3855                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG);
3856                 TryReturnVoid(pBitmap != null, "pBitmap is null");
3857
3858                 __pThumbnailButton->SetNormalBitmap(ptThumbnailImg, *pBitmap);
3859
3860                 delete pBitmap;
3861                 pBitmap = null;
3862
3863                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_MODE_THUMBNAIL_BG);
3864                 TryReturnVoid(pBitmap != null, "pBitmap is null");
3865
3866                 __pThumbnailButton->SetPressedBitmap(ptThumbnailImg, *pBitmap);
3867
3868                 delete pBitmap;
3869                 pBitmap = null;
3870
3871                 __pThumbnailButton->Draw();
3872                 __pThumbnailButton->Show();
3873
3874                 Draw();
3875                 Show();
3876         }
3877         else
3878         {
3879                 AppLogDebug("pThumbnailBitmap is not null");
3880         }
3881         AppLogDebug("EXIT");
3882 }
3883
3884 result
3885 CameraForm::Initialize(void)
3886 {
3887         AppLogDebug("ENTER");
3888         result r = E_SUCCESS;
3889
3890         Construct(L"IDL_CAMERA_FORM");
3891
3892         _pCameraPresentationModel = CameraPresentationModel::GetInstance();
3893         TryCatch(_pCameraPresentationModel != null, r = E_SYSTEM, "_pCameraPresentationModel is null");
3894
3895         AppLogDebug("EXIT");
3896         return E_SUCCESS;
3897
3898 CATCH:
3899         return r;
3900 }
3901
3902 void
3903 CameraForm::InitAppTimer(void)
3904 {
3905         AppLogDebug("ENTER");
3906         _pAppTimer = new (std::nothrow) Timer();
3907         _pAppTimer->Construct(*this);
3908         AppLogDebug("EXIT");
3909 }
3910
3911 void
3912 CameraForm::InitChargingTimer(void)
3913 {
3914         AppLogDebug("ENTER");
3915         _pChargingTimer = new (std::nothrow) Timer();
3916         _pChargingTimer->Construct(*this);
3917         AppLogDebug("EXIT");
3918 }
3919
3920 void
3921 CameraForm::InitChargingCompletedTimer(void)
3922 {
3923         AppLogDebug("ENTER");
3924         _pChargingCompletedTimer = new (std::nothrow) Timer();
3925         _pChargingCompletedTimer->Construct(*this);
3926         AppLogDebug("EXIT");
3927 }
3928
3929 void
3930 CameraForm::InitPreviewFailPopupTimer(void)
3931 {
3932         AppLogDebug("ENTER");
3933         _pPreviewFailPopupTimer = new (std::nothrow) Timer();
3934         _pPreviewFailPopupTimer->Construct(*this);
3935         AppLogDebug("EXIT");
3936 }
3937
3938 void
3939 CameraForm::InitIntervalValueTimer(void)
3940 {
3941         AppLogDebug("ENTER");
3942         _pIntervalValueTimer = new (std::nothrow) Timer();
3943         _pIntervalValueTimer->Construct(*this);
3944         AppLogDebug("EXIT");
3945 }
3946
3947 void
3948 CameraForm::InitCaptureStartTimer(void)
3949 {
3950         AppLogDebug("ENTER");
3951         _pCaptureStartTimer = new (std::nothrow) Timer();
3952         _pCaptureStartTimer->Construct(*this);
3953         AppLogDebug("EXIT");
3954 }
3955
3956 void
3957 CameraForm::InitTouchAutoFocusStartTimer(void)
3958 {
3959         AppLogDebug("ENTER");
3960         _pTouchAutoFocusTimer = new (std::nothrow) Timer();
3961         _pTouchAutoFocusTimer->Construct(*this);
3962         AppLogDebug("EXIT");
3963 }
3964
3965 void
3966 CameraForm::StartInitAppTimer(void)
3967 {
3968         AppLogDebug("ENTER");
3969         result r = E_SUCCESS;
3970
3971         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
3972
3973         _pAppTimer->Cancel();
3974
3975         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
3976         TryReturnVoid(r == E_SUCCESS, "Timer::Start() fail[%s]", GetErrorMessage(r));
3977         AppLogDebug("EXIT");
3978 }
3979
3980 void
3981 CameraForm::StartPreviewFailPopupTimer(void)
3982 {
3983         AppLogDebug("ENTER");
3984         result r = E_SUCCESS;
3985
3986         TryReturnVoid(_pPreviewFailPopupTimer != null, "__pPreviewFailPopupTimer is null");
3987
3988         _pPreviewFailPopupTimer->Cancel();
3989
3990         r = _pPreviewFailPopupTimer->Start(PREVIEW_FAIL_TIMER);
3991         TryReturnVoid(r == E_SUCCESS, "__pPreviewFailPopupTimer::Start() fail[%s]", GetErrorMessage(r));
3992         AppLogDebug("EXIT");
3993 }
3994
3995 void
3996 CameraForm::StartInitChargingCompletedTimer(void)
3997 {
3998         AppLogDebug("ENTER");
3999         result r = E_SUCCESS;
4000         bool isCharging = false;
4001
4002         TryReturnVoid(_pChargingCompletedTimer != null, "__pChargingCompletedTimer is null");
4003
4004         isCharging = _pCameraPresentationModel->IsCharging();
4005
4006         _batteryStatus = GetCurrentBatteryState();
4007         AppLogDebug("_batteryStatus = %d" , _batteryStatus);
4008
4009         if (isCharging && _batteryStatus == BATTERY_STATE_20)
4010         {
4011                 if (_pChargingCompletedTimer)
4012                 {
4013                         _pChargingCompletedTimer->Cancel();
4014                 }
4015
4016                 _chargingCount = 0;
4017
4018                 _blinkCount = 0;
4019
4020                 r = DrawBatteryLevelFull();
4021                 TryReturnVoid(r == E_SUCCESS, "_pChargingTimer::Start() fail[%s]", GetErrorMessage(r));
4022
4023                 AppLogDebug("EXIT");
4024                 return;
4025         }
4026         _chargingCount = INDEX_UNIT_ZERO;
4027
4028         if (_batteryStatus == BATTERY_STATE_20)
4029         {
4030                 if (_pChargingCompletedTimer)
4031                 {
4032                         _pChargingCompletedTimer->Cancel();
4033
4034                         r = _pChargingCompletedTimer->StartAsRepeatable(CAMERA_CHARGING_TIMER);
4035                         TryReturnVoid(r == E_SUCCESS, "_pChargingTimer::Start() fail[%s]", GetErrorMessage(r));
4036                 }
4037         }
4038         else
4039         {
4040                 if (_pChargingCompletedTimer)
4041                 {
4042                         _pChargingCompletedTimer->Cancel();
4043                 }
4044
4045                 _chargingCount = 0;
4046                 _blinkCount = 0;
4047
4048                 CheckBatteryStatus();
4049         }
4050         AppLogDebug("EXIT");
4051 }
4052
4053 void
4054 CameraForm::StartInitChargingTimer(void)
4055 {
4056         AppLogDebug("ENTER");
4057         result r = E_SUCCESS;
4058         bool isCharging = false;
4059
4060         TryReturnVoid(_pChargingTimer != null, "_pChargingTimer is null");
4061
4062         isCharging = _pCameraPresentationModel->IsCharging();
4063
4064         _chargingCount = INDEX_UNIT_ZERO;
4065
4066         if (isCharging)
4067         {
4068                 if (_pChargingTimer)
4069                 {
4070                         _pChargingTimer->Cancel();
4071
4072                         r = _pChargingTimer->StartAsRepeatable(CAMERA_CHARGING_TIMER);
4073                         TryReturnVoid(r == E_SUCCESS, "_pChargingTimer::Start() fail[%s]", GetErrorMessage(r));
4074                 }
4075         }
4076         else
4077         {
4078                 if (_pChargingTimer)
4079                 {
4080                         _pChargingTimer->Cancel();
4081                 }
4082         }
4083         AppLogDebug("EXIT");
4084 }
4085
4086 result
4087 CameraForm::ToggleCameraDirection(int direction)
4088 {
4089         AppLogDebug("ENTER");
4090         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
4091                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
4092         result r = E_SUCCESS;
4093         Dimension dim;
4094         Point currentPosition;
4095         BufferInfo bufferinfo;
4096         bool isInitCameraStaus = false;
4097
4098         if (_pAppTimer != null)
4099         {
4100                 _pAppTimer->Cancel();
4101
4102                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
4103                 TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
4104         }
4105
4106         if (direction == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
4107         {
4108                 AppLogDebug("FRONT");
4109                 r = _pCameraPresentationModel->ToggleCameraDirection(CameraPresentationModel::CAMERA_MODE_SNAPSHOT, CameraPresentationModel::CAMERA_DIRECTION_FRONT);
4110         }
4111         else if (direction == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
4112         {
4113                 AppLogDebug("BACK");
4114                 r = _pCameraPresentationModel->ToggleCameraDirection(CameraPresentationModel::CAMERA_MODE_SNAPSHOT, CameraPresentationModel::CAMERA_DIRECTION_BACK);
4115         }
4116         TryCatch(r == E_SUCCESS, , "__pCamcorderPresentationModel->ToggleCameraDirection() fail[%s]", GetErrorMessage(r));
4117
4118         dim = _pCameraPresentationModel->GetPreviewResolution();
4119         AppLogDebug("CameraForm::GetPreviewResolution(W:%d, H:%d)", dim.width, dim.height);
4120
4121         AppLogDebug("__screenMode [%d]", __screenMode);
4122
4123         if (direction == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
4124         {
4125                 r = SetScreenMode(SCREEN_MODE_NORMAL, true);
4126         }
4127         else
4128         {
4129                 r = SetScreenMode(__screenMode, true);
4130         }
4131         TryCatch(r == E_SUCCESS, , "SetScreenMode fail[%s]", GetErrorMessage(r));
4132
4133         if (__dir == ORIENTATION_STATUS_PORTRAIT
4134                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
4135         {
4136                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
4137                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
4138         }
4139         else
4140         {
4141                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
4142                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
4143         }
4144
4145         InDrawFocus();
4146
4147         isInitCameraStaus = _pCameraPresentationModel->GetInitCameraStatus();
4148         AppLogDebug("isInitCameraStaus [%d]", isInitCameraStaus);
4149
4150         if (isInitCameraStaus)
4151         {
4152                 SetCameraSettingsDevice();
4153         }
4154
4155         AppLogDebug("EXIT");
4156         return E_SUCCESS;
4157
4158 CATCH:
4159         return r;
4160 }
4161
4162 void
4163 CameraForm::MakePreviewResolutionList(bool remakeList = false)
4164 {
4165         AppLogDebug("ENTER");
4166         Dimension dimResolution;
4167         IList* pTempList = null;
4168         String* pItemString = null;
4169         String tempString;
4170         result r = E_SUCCESS;
4171         int idx = 0;
4172         int tot = 0;
4173         Dimension dimension;
4174         Dimension tempDimention(PREVIEW_RESOLOTION_WIDTH, PREVIEW_RESOLOTION_HEIGHT);
4175         int previewResolutionIdx = 0;
4176
4177         if (remakeList)
4178         {
4179                 if (__pPreviewResolutionList)
4180                 {
4181                         __pPreviewResolutionList->RemoveAll(true);
4182                 }
4183
4184                 delete __pPreviewResolutionList;
4185                 __pPreviewResolutionList = null;
4186         }
4187
4188         if (__pPreviewResolutionList == null)
4189         {
4190                 __pPreviewResolutionList = new (std::nothrow) ArrayList();
4191                 r = __pPreviewResolutionList->Construct();
4192                 TryCatch(r == E_SUCCESS, , "__pPreviewResolutionList construct fail[%s]", GetErrorMessage(r));
4193
4194                 pTempList = _pCameraPresentationModel->GetPreviewResolutionList();
4195                 TryCatch(pTempList != null, , "GetPreviewResolutionList() return null");
4196                 tot = pTempList->GetCount();
4197                 if (tot > 0)
4198                 {
4199                         for (idx = tot - INDEX_UNIT_ONE; idx >= 0; idx--)
4200                         {
4201                                 dimResolution = *(static_cast<Dimension*>(pTempList->GetAt(idx)));
4202
4203                                 tempString.Format(STRING_BUFFER_SIZE, L"%dX%d", dimResolution.width, dimResolution.height);
4204
4205                                 pItemString = new (std::nothrow) String(tempString);
4206                                 TryCatch(pItemString != null, , "pItemString is null");
4207
4208                                 __pPreviewResolutionList->Add(*pItemString);
4209
4210                                 AppLogDebug("GetPreviewResolutionList w:%d,h:%d", dimResolution.width, dimResolution.height);
4211
4212                                 if (dimResolution == tempDimention)
4213                                 {
4214                                         previewResolutionIdx = idx;
4215                                 }
4216                         }
4217                 }
4218                 else
4219                 {
4220                         AppLogDebug("Not Support CaptureResolution");
4221                 }
4222
4223                 dimResolution = *(static_cast<Dimension*>(pTempList->GetAt(previewResolutionIdx)));
4224         }
4225
4226         __previewResolutionWidth = dimResolution.width;
4227         __previewResolutionHeight = dimResolution.height;
4228
4229         AppLogDebug("previewResolution w:%d,h:%d", dimResolution.width, dimResolution.height);
4230
4231         AppLogDebug("EXIT");
4232         return;
4233
4234 CATCH:
4235         if (__pPreviewResolutionList)
4236         {
4237                 __pPreviewResolutionList->RemoveAll(true);
4238
4239                 delete __pPreviewResolutionList;
4240                 __pPreviewResolutionList = null;
4241         }
4242 }
4243
4244 void
4245 CameraForm::MakeCaptrueResolutionList(bool remakeList = false)
4246 {
4247         AppLogDebug("ENTER");
4248         Dimension dimPreviewResolution;
4249         Dimension dimResolution;
4250         IList* pTempList = null;
4251         String* pItemString = null;
4252         String tempString;
4253         result r = E_SUCCESS;
4254         int idx = 0;
4255         int tot = 0;
4256         int resolutionRatio = 0;
4257
4258         if (remakeList)
4259         {
4260                 if (__pCaptureResolutionList)
4261                 {
4262                         __pCaptureResolutionList->RemoveAll(true);
4263                 }
4264
4265                 delete __pCaptureResolutionList;
4266                 __pCaptureResolutionList = null;
4267         }
4268
4269         if (__pCaptureResolutionList == null)
4270         {
4271                 __pCaptureResolutionList = new (std::nothrow) ArrayList();
4272                 r = __pCaptureResolutionList->Construct();
4273                 TryCatch(r == E_SUCCESS, , "__pCaptureResolutionList construct fail[%s]", GetErrorMessage(r));
4274
4275                 pTempList = _pCameraPresentationModel->GetCaptureResolutionList();
4276                 TryCatch(pTempList != null, , "GetCaptureResolutionList() return null");
4277                 tot = pTempList->GetCount();
4278                 if (tot > 0)
4279                 {
4280                         for (idx = tot - INDEX_UNIT_ONE; idx >= 0; idx--)
4281                         {
4282                                 dimResolution = *(static_cast<Dimension*>(pTempList->GetAt(idx)));
4283
4284                                 if (dimResolution.width >= __previewResolutionWidth && dimResolution.height >= __previewResolutionHeight)
4285                                 {
4286                                         resolutionRatio = (dimResolution.width * MULTIPLY_BY_TEN) / (dimResolution.height);
4287
4288                                         if (resolutionRatio > NORMAL_MODE_RATIO)
4289                                         {
4290                                                 tempString.Format(STRING_BUFFER_SIZE, L"%dX%d(16:9)", dimResolution.width, dimResolution.height);
4291                                         }
4292                                         else
4293                                         {
4294                                                 tempString.Format(STRING_BUFFER_SIZE, L"%dX%d(4:3)", dimResolution.width, dimResolution.height);
4295                                         }
4296
4297                                         pItemString = new (std::nothrow) String(tempString);
4298                                         TryCatch(pItemString != null, , "pItemString is null");
4299
4300                                         __pCaptureResolutionList->Add(*pItemString);
4301
4302                                         AppLogDebug("GetCaptureResolutionList w:%d,h:%d", dimResolution.width, dimResolution.height);
4303                                 }
4304                         }
4305                 }
4306                 else
4307                 {
4308                         AppLogDebug("Not Support CaptureResolution");
4309                 }
4310         }
4311
4312         AppLogDebug("EXIT");
4313         return;
4314
4315 CATCH:
4316         if (__pCaptureResolutionList)
4317         {
4318                 __pCaptureResolutionList->RemoveAll(true);
4319
4320                 delete __pCaptureResolutionList;
4321                 __pCaptureResolutionList = null;
4322         }
4323 }
4324
4325 void
4326 CameraForm::MakeIsoList(bool remakeList = false)
4327 {
4328         AppLogDebug("ENTER");
4329         IList* pTempList = null;
4330         String* pItemString = null;
4331         String tempString;
4332         result r = E_SUCCESS;
4333         int idx = 0;
4334         int tot = 0;
4335
4336         const mchar* isoMap[] =
4337         {
4338                 L"DEFAULT",
4339                 L"MIN",
4340                 L"AUTO",
4341                 L"50",
4342                 L"100",
4343                 L"200",
4344                 L"400",
4345                 L"800",
4346                 L"1600",
4347                 L"MAX"
4348         };
4349
4350         if (remakeList)
4351         {
4352                 if (__pIsoList)
4353                 {
4354                         __pIsoList->RemoveAll(true);
4355                 }
4356
4357                 delete __pIsoList;
4358                 __pIsoList = null;
4359         }
4360
4361         if (__pIsoList == null)
4362         {
4363                 __pIsoList = new (std::nothrow) ArrayList();
4364                 r = __pIsoList->Construct();
4365                 TryCatch(r == E_SUCCESS, , "__pIsoList construct fail[%s]", GetErrorMessage(r));
4366
4367                 pTempList = _pCameraPresentationModel->GetIsoList();
4368                 TryCatch(pTempList != null, , "GetIsoList() return null");
4369                 tot = pTempList->GetCount();
4370                 if (tot > 0)
4371                 {
4372                         for (idx = 0; idx < tot; idx++)
4373                         {
4374                                 Tizen::Base::Integer* isoObj = (Tizen::Base::Integer*) pTempList->GetAt(idx);
4375
4376                                 int isoType = isoObj ? isoObj->ToInt() : -INDEX_UNIT_ONE;
4377
4378                                 if (isoType > 0 && isoType < MAX_ISO_COUNT)
4379                                 {
4380                                         pItemString = new (std::nothrow) String(isoMap[isoType]);
4381                                         TryCatch(pItemString != null, , "pItemString is null");
4382
4383                                         AppLogDebug("ISO return is = %d VALUE = %ls", isoType, pItemString->GetPointer());
4384                                         __pIsoList->Add(*pItemString);
4385                                 }
4386                                 else
4387                                 {
4388                                         AppLogDebug("isoType out of range");
4389                                 }
4390                         }
4391                 }
4392         }
4393
4394         AppLogDebug("EXIT");
4395         return;
4396
4397 CATCH:
4398         if (__pIsoList)
4399         {
4400                 __pIsoList->RemoveAll(true);
4401         }
4402
4403         delete pItemString;
4404         pItemString = null;
4405
4406         delete __pIsoList;
4407         __pIsoList = null;
4408 }
4409
4410 void
4411 CameraForm::MakeSettingPopupTab(bool isShow)
4412 {
4413         AppLogDebug("ENTER");
4414         if (isShow)
4415         {
4416                 if (__pCameraSetting)
4417                 {
4418                         __pCameraSetting->SetShowState(true);
4419                         __pCameraSetting->Invalidate(true);
4420                 }
4421
4422                 if (__pCameraSettingLable)
4423                 {
4424                         __pCameraSettingLable->SetShowState(true);
4425                         __pCameraSettingLable->Invalidate(true);
4426                 }
4427
4428                 if (__pGeneralSetting)
4429                 {
4430                         __pGeneralSetting->SetShowState(true);
4431                         __pGeneralSetting->Invalidate(true);
4432                 }
4433
4434                 if (__pGeneralSettingLable)
4435                 {
4436                         __pGeneralSettingLable->SetShowState(true);
4437                         __pGeneralSettingLable->Invalidate(true);
4438                 }
4439         }
4440         else
4441         {
4442                 if (__pCameraSetting)
4443                 {
4444                         __pCameraSetting->SetShowState(false);
4445                         __pCameraSetting->Invalidate(true);
4446                 }
4447
4448                 if (__pCameraSettingLable)
4449                 {
4450                         __pCameraSettingLable->SetShowState(false);
4451                         __pCameraSettingLable->Invalidate(true);
4452                 }
4453
4454                 if (__pGeneralSetting)
4455                 {
4456                         __pGeneralSetting->SetShowState(false);
4457                         __pGeneralSetting->Invalidate(true);
4458                 }
4459
4460                 if (__pGeneralSettingLable)
4461                 {
4462                         __pGeneralSettingLable->SetShowState(false);
4463                         __pGeneralSettingLable->Invalidate(true);
4464                 }
4465         }
4466         AppLogDebug("EXIT");
4467 }
4468
4469 void
4470 CameraForm::MakeCameraTabSettingPopup(void)
4471 {
4472         AppLogDebug("ENTER");
4473         Rectangle rectList = Rectangle(X_SETTING_MENU_LIST_LANDSCAPE, Y_SETTING_MENU_LIST_LANDSCAPE,
4474                                                                 W_SETTING_MENU_LIST_LANDSCAPE, H_SETTING_MENU_LIST_LANDSCAPE);
4475         HidePopup();
4476
4477         MakePreviewResolutionList(true);
4478
4479         MakeCaptrueResolutionList(false);
4480
4481         MakeIsoList(false);
4482
4483         Invalidate(true);
4484
4485         _pCameraInfoPanel->SetDrawExposure(false);
4486
4487         if (__dir == ORIENTATION_STATUS_PORTRAIT
4488                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
4489         {
4490                 rectList = Rectangle(X_SETTING_MENU_LIST_PORTRAIT, Y_SETTING_MENU_LIST_PORTRAIT,
4491                                                         W_SETTING_MENU_LIST_PORTRAIT, H_SETTING_MENU_LIST_PORTRAIT - H_SETTING_MENU_LIST_MARGIN);
4492         }
4493         else
4494         {
4495                 rectList = Rectangle(X_SETTING_MENU_LIST_LANDSCAPE, Y_SETTING_MENU_LIST_LANDSCAPE + Y_SETTING_MENU_LIST_LANDSCAPE_MARGIN,
4496                                                         W_SETTING_MENU_LIST_LANDSCAPE, H_SETTING_MENU_LIST_LANDSCAPE- H_SETTING_MENU_LIST_MARGIN);
4497         }
4498
4499         MakeCameraTabMenuString();
4500         SetCameraTabSettingMainMenuCount(MAX_SETTING_MENU_COUNT);
4501         MakeSettingPopupTab(true);
4502
4503         _pCameraInfoPanel->SetDrawSettingMenuBackground(true);
4504         _pCameraInfoPanel->Invalidate(true);
4505         if (_pListViewCameraTabMainMenu == null)
4506         {
4507                 _pListViewCameraTabMainMenu = new (std::nothrow) ListView();
4508                 _pListViewCameraTabMainMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
4509
4510                 _pListViewCameraTabMainMenu->SetItemProvider(*this);
4511                 _pListViewCameraTabMainMenu->AddListViewItemEventListener(*this);
4512                 _pListViewCameraTabMainMenu->SetName(IDS_MENU_SETTING_MAIN_MENU_NAME);
4513         }
4514         else
4515         {
4516                 _pListViewCameraTabMainMenu->SetShowState(true);
4517                 _pListViewCameraTabMainMenu->SetBounds(rectList);
4518         }
4519         _pCameraInfoPanel->AddControl(_pListViewCameraTabMainMenu);
4520
4521         _pListViewCameraTabMainMenu->UpdateList();
4522         AppLogDebug("EXIT");
4523 }
4524
4525 void
4526 CameraForm::MakeGeneralTabSettingPopup(void)
4527 {
4528         AppLogDebug("ENTER");
4529         Rectangle rectList = Rectangle(X_SETTING_MENU_LIST_LANDSCAPE, Y_SETTING_MENU_LIST_LANDSCAPE,
4530                                                                 W_SETTING_MENU_LIST_LANDSCAPE, H_SETTING_MENU_LIST_LANDSCAPE);
4531         HidePopup();
4532
4533         _pCameraInfoPanel->SetDrawExposure(false);
4534
4535         if (__dir == ORIENTATION_STATUS_PORTRAIT
4536                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
4537         {
4538                 rectList = Rectangle(X_SETTING_MENU_LIST_PORTRAIT, Y_SETTING_MENU_LIST_PORTRAIT,
4539                                                         W_SETTING_MENU_LIST_PORTRAIT, H_SETTING_MENU_LIST_PORTRAIT);
4540         }
4541         else
4542         {
4543                 rectList = Rectangle(X_SETTING_MENU_LIST_LANDSCAPE, Y_SETTING_MENU_LIST_LANDSCAPE + Y_SETTING_MENU_LIST_LANDSCAPE_MARGIN,
4544                                                         W_SETTING_MENU_LIST_LANDSCAPE, H_SETTING_MENU_LIST_LANDSCAPE);
4545         }
4546
4547         MakeGeneralTabMenuString();
4548         SetGeneralTabSettingMainMenuCount(MAX_GENERAL_TAB_SETTING_MENU_COUNT);
4549         MakeSettingPopupTab(true);
4550
4551         _pCameraInfoPanel->SetGeneralDrawSettingMenuBackground(true);
4552         _pCameraInfoPanel->Invalidate(true);
4553
4554         if (_pListViewGeneralTabMainMenu == null)
4555         {
4556                 _pListViewGeneralTabMainMenu = new (std::nothrow) ListView();
4557                 _pListViewGeneralTabMainMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
4558
4559                 _pListViewGeneralTabMainMenu->SetItemProvider(*this);
4560                 _pListViewGeneralTabMainMenu->AddListViewItemEventListener(*this);
4561                 _pListViewGeneralTabMainMenu->SetName(IDS_MENU_SETTING_GEN_MAIN_MENU_NAME);
4562         }
4563         else
4564         {
4565                 _pListViewGeneralTabMainMenu->SetShowState(true);
4566                 _pListViewGeneralTabMainMenu->SetBounds(rectList);
4567         }
4568
4569         _pCameraInfoPanel->AddControl(_pListViewGeneralTabMainMenu);
4570         _pListViewGeneralTabMainMenu->UpdateList();
4571         AppLogDebug("EXIT");
4572 }
4573
4574 void
4575 CameraForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
4576 {
4577         AppLogDebug("ENTER");
4578         AppLogDebug("EXIT");
4579 }
4580
4581 void
4582 CameraForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
4583 {
4584         AppLogDebug("ENTER");
4585         result r = E_SUCCESS;
4586
4587         if (_pListViewCameraTabMainMenu != null && listView.Equals(*_pListViewCameraTabMainMenu))
4588         {
4589                 if (_pListViewCameraTabMainMenu && _pListViewCameraTabMainMenu->GetShowState() == true)
4590                 {
4591                         _currentSettingsMenuIndex = index;
4592                         r = ProcessCameraTabMainListPopup(index);
4593                         TryReturnVoid(r == E_SUCCESS, "ProcessCameraTabMainListPopup() fail[%s]", GetErrorMessage(r));
4594                 }
4595         }
4596         else if (_pListViewCameraTabSubMenu != null && listView.Equals(*_pListViewCameraTabSubMenu))
4597         {
4598                 r = ProcessCameraTabSubListPopup(index);
4599                 TryReturnVoid(r == E_SUCCESS, "ProcessCameraTabSubListPopup() fail[%s]", GetErrorMessage(r));
4600         }
4601         else if (_pListViewGeneralTabMainMenu != null && listView.Equals(*_pListViewGeneralTabMainMenu))
4602         {
4603                 if (_pListViewGeneralTabMainMenu && _pListViewGeneralTabMainMenu->GetShowState() == true)
4604                 {
4605                         _currentSettingsMenuIndex = index;
4606                         r = ProcessGeneraTabMainListPopup(index);
4607                         TryReturnVoid(r == E_SUCCESS, "ProcessGeneraTabMainListPopup() fail[%s]", GetErrorMessage(r));
4608                 }
4609         }
4610         else if (_pListViewGeneralTabSubMenu != null && listView.Equals(*_pListViewGeneralTabSubMenu))
4611         {
4612                 r = ProcessGeneraTabSubListPopup(index);
4613                 TryReturnVoid(r == E_SUCCESS, "ProcessGeneraTabSubListPopup() fail[%s]", GetErrorMessage(r));
4614         }                       
4615         else if (_pListFlashMainMenu != null && listView.Equals(*_pListFlashMainMenu))
4616         {
4617                 if (_pListFlashMainMenu && _pListFlashMainMenu->GetShowState() == true)
4618                 {
4619                         r = ProcessFlashListPopup(index);
4620                         UpdateUiPanelIcon();
4621                         TryReturnVoid(r == E_SUCCESS, "ProcessMainListPopup() fail[%s]", GetErrorMessage(r));
4622                 }
4623         }
4624         else if (_pListWbMainMenu != null && listView.Equals(*_pListWbMainMenu))
4625         {
4626                 if (_pListWbMainMenu && _pListWbMainMenu->GetShowState() == true)
4627                 {
4628                         r = SubListPopupWhiteBalanceMode(index);
4629                         TryReturnVoid(r == E_SUCCESS, "SubListPopupWhiteBalanceMode() fail[%s]", GetErrorMessage(r));
4630                         HidePopup();
4631                 }
4632         }
4633         else
4634         {
4635                 AppLogDebug("OnListViewItemStateChanged is not make");
4636         }
4637         AppLogDebug("EXIT");
4638 }
4639
4640 void
4641 CameraForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
4642 {
4643         AppLogDebug("ENTER");
4644         AppLogDebug("EXIT");
4645 }
4646
4647 ListItemBase*
4648 CameraForm::CreateItem(int index, int itemWidth)
4649 {
4650         AppLogDebug("ENTER");
4651         CustomItem* pItem = null;
4652         bool createSubMenu = false;
4653         bool createGenSubMenu = false;
4654         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON, Y_SETTING_SUBMENU_RADIO_ICON,
4655                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
4656         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON, Y_SETTING_SUBMENU_ICON,
4657                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
4658         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
4659                                                                                 W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
4660         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM, Y_SETTING_SUBMENU_3TEXT_ITEM,
4661                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
4662         String tmpString;
4663
4664         if (_pListViewCameraTabSubMenu)
4665         {
4666                 if (_pListViewCameraTabSubMenu->GetShowState() == true)
4667                 {
4668                         createSubMenu = true;
4669                         pItem = CreateCameraTabSubMenuItem(index, itemWidth);
4670
4671                         if (pItem == null)
4672                         {
4673                                 AppLogDebug("CreateCameraTabSubMenuItem of pItem is null - _pListViewCameraTabSubMenu");
4674                                 return null;
4675                         }
4676                         else
4677                         {
4678                                 AppLogDebug("EXIT");
4679                                 return pItem;
4680                         }
4681                 }
4682         }
4683
4684         if (_pListViewCameraTabMainMenu && _pListViewCameraTabMainMenu->GetShowState() == true)
4685         {
4686                 if (createSubMenu == false)
4687                 {
4688                         pItem = CreateCameraTabMainMenuItem(index, itemWidth);
4689
4690                         if (pItem == null)
4691                         {
4692                                 AppLogDebug("CreateCameraTabMainMenuItem of pItem is null - _pListViewCameraTabMainMenu");
4693                                 return null;
4694                         }
4695                         else
4696                         {
4697                                 AppLogDebug("EXIT");
4698                                 return pItem;
4699                         }
4700                 }
4701         }
4702
4703         if (_pListViewGeneralTabSubMenu)
4704         {
4705                 if (_pListViewGeneralTabSubMenu->GetShowState() == true)
4706                 {
4707                         createGenSubMenu = true;
4708                         pItem = CreateGeneralTabSubMenuItem(index, itemWidth);
4709
4710                         if (pItem == null)
4711                         {
4712                                 AppLogDebug("CreateCameraTabMainMenuItem of pItem is null - _pListViewGeneralTabSubMenu");
4713                                 return null;
4714                         }
4715                         else
4716                         {
4717                                 AppLogDebug("EXIT");
4718                                 return pItem;
4719                         }
4720                 }
4721         }
4722
4723         if (_pListViewGeneralTabMainMenu && _pListViewGeneralTabMainMenu->GetShowState() == true)
4724         {
4725                 if (createGenSubMenu == false)
4726                 {
4727                         AppLogDebug("CreateGeneralTabMainMenuItem");
4728                         pItem = CreateGeneralTabMainMenuItem(index, itemWidth);
4729
4730                         if (pItem == null)
4731                         {
4732                                 AppLogDebug("CreateCameraTabMainMenuItem of pItem is null - _pListViewGeneralTabMainMenu");
4733                                 return null;
4734                         }
4735                         else
4736                         {
4737                                 AppLogDebug("EXIT");
4738                                 return pItem;
4739                         }
4740                 }
4741         }
4742
4743         if (_pListFlashMainMenu && _pListFlashMainMenu->GetShowState() == true)
4744         {
4745                 pItem = CreateFlashMainMenuItem(index, itemWidth);
4746
4747                 if (pItem == null)
4748                 {
4749                         AppLogDebug("CreateCameraTabMainMenuItem of pItem is null - _pListFlashMainMenu");
4750                         return null;
4751                 }
4752                 else
4753                 {
4754                         AppLogDebug("EXIT");
4755                         return pItem;
4756                 }
4757         }
4758
4759         if (_pListWbMainMenu && _pListWbMainMenu->GetShowState() == true)
4760         {
4761                 pItem = CreateWhiteBalanceItem(index, itemWidth);
4762
4763                 if (pItem == null)
4764                 {
4765                         AppLogDebug("CreateCameraTabMainMenuItem of pItem is null - _pListWbMainMenu");
4766                         return null;
4767                 }
4768                 else
4769                 {
4770                         AppLogDebug("EXIT");
4771                         return pItem;
4772                 }
4773         }
4774
4775         AppLogDebug("EXIT");
4776         return null;
4777 }
4778
4779 bool
4780 CameraForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
4781 {
4782         AppLogDebug("ENTER");
4783         delete pItem;
4784         pItem = null;
4785
4786         AppLogDebug("EXIT");
4787         return true;
4788 }
4789
4790 int
4791 CameraForm::GetItemCount(void)
4792 {
4793         AppLogDebug("ENTER");
4794         if (_pListViewCameraTabSubMenu)
4795         {
4796                 if (_pListViewCameraTabSubMenu->GetShowState() == true)
4797                 {
4798                         AppLogDebug("EXIT");
4799                         return GetCameraTabSettingSubMenuCount();
4800                 }
4801         }
4802
4803         if (_pListViewCameraTabMainMenu)
4804         {
4805                 if (_pListViewCameraTabMainMenu->GetShowState() == true)
4806                 {
4807                         AppLogDebug("EXIT");
4808                         return GetCameraTabSettingMainMenuCount();
4809                 }
4810         }
4811
4812         if (_pListViewGeneralTabSubMenu)
4813         {
4814                 if (_pListViewGeneralTabSubMenu->GetShowState() == true)
4815                 {
4816                         AppLogDebug("EXIT");
4817                         return GetGeneralTabSettingSubMenuCount();
4818                 }
4819         }
4820
4821         if (_pListViewGeneralTabMainMenu)
4822         {
4823                 if (_pListViewGeneralTabMainMenu->GetShowState() == true)
4824                 {
4825                         AppLogDebug("EXIT");
4826                         return GetGeneralTabSettingMainMenuCount();
4827                 }
4828         }
4829
4830         if (_pListFlashMainMenu)
4831         {
4832                 AppLogDebug("EXIT");
4833                 return GetCameraTabSettingMainMenuCount();
4834         }
4835
4836         if (_pListWbMainMenu)
4837         {
4838                 AppLogDebug("EXIT");
4839                 return GetCameraTabSettingMainMenuCount();
4840         }
4841
4842         AppLogDebug("EXIT");
4843         return 0;
4844 }
4845
4846 inline int
4847 CameraForm::GetGeneralTabSettingMainMenuCount(void) const
4848 {
4849         AppLogDebug("ENTER");
4850         AppLogDebug("EXIT");
4851         return __generalTabMainMenuCount;
4852 }
4853
4854 inline void
4855 CameraForm::SetGeneralTabSettingMainMenuCount(int count)
4856 {
4857         AppLogDebug("ENTER");
4858         __generalTabMainMenuCount = count;
4859         AppLogDebug("EXIT");
4860 }
4861
4862 inline int
4863 CameraForm::GetGeneralTabSettingSubMenuCount(void) const
4864 {
4865         AppLogDebug("ENTER");
4866         AppLogDebug("EXIT");
4867         return __generalTabSubMenuCount;
4868 }
4869
4870 inline void
4871 CameraForm::SetGeneralTabSettingSubMenuCount(int count)
4872 {
4873         AppLogDebug("ENTER");
4874         __generalTabSubMenuCount = count;
4875         AppLogDebug("EXIT");
4876 }
4877
4878 inline GeneralTabSubMenuContent
4879 CameraForm::GetGeneralTabSettingSubMenuMode(void) const
4880 {
4881         AppLogDebug("ENTER");
4882         AppLogDebug("EXIT");
4883         return __generalTabSettingMode;
4884 }
4885
4886 inline void
4887 CameraForm::SetSettingGenSubMenuMode(const GeneralTabSubMenuContent mode)
4888 {
4889         AppLogDebug("ENTER");
4890         AppLogDebug("EXIT");
4891         __generalTabSettingMode = mode;
4892 }
4893
4894 inline void
4895 CameraForm::SetGeneralTabSubMenuListviewState(const int menuCount, const GeneralTabSubMenuContent mode)
4896 {
4897         AppLogDebug("ENTER");
4898         SetGeneralTabSettingSubMenuCount(menuCount);
4899         SetSettingGenSubMenuMode(mode);
4900         AppLogDebug("EXIT");
4901 }
4902
4903 inline int
4904 CameraForm::GetCameraTabSettingMainMenuCount(void) const
4905 {
4906         AppLogDebug("ENTER");
4907         AppLogDebug("EXIT");
4908         return __cameraTabMainMenuCount;
4909 }
4910
4911 inline void
4912 CameraForm::SetCameraTabSettingMainMenuCount(int count)
4913 {
4914         AppLogDebug("ENTER");
4915         __cameraTabMainMenuCount = count;
4916         AppLogDebug("EXIT");
4917 }
4918
4919 inline int
4920 CameraForm::GetCameraTabSettingSubMenuCount(void) const
4921 {
4922         AppLogDebug("ENTER");
4923         AppLogDebug("EXIT");
4924         return __cameraTabSubMenuCount;
4925 }
4926
4927 inline void
4928 CameraForm::SetCameraTabSettingSubMenuCount(int count)
4929 {
4930         AppLogDebug("ENTER");
4931         __cameraTabSubMenuCount = count;
4932         AppLogDebug("EXIT");
4933 }
4934
4935 inline CameraTabSubMenuContent
4936 CameraForm::GetCameraTabSettingSubMenuMode(void) const
4937 {
4938         AppLogDebug("ENTER");
4939         AppLogDebug("EXIT");
4940         return __cameraTabSettingMode;
4941 }
4942
4943 inline void
4944 CameraForm::SetCameraTabSettingSubMenuMode(const CameraTabSubMenuContent mode)
4945 {
4946         AppLogDebug("ENTER");
4947         AppLogDebug("EXIT");
4948         __cameraTabSettingMode = mode;
4949 }
4950
4951 inline void
4952 CameraForm::SetCameraTabSubMenuListviewState(const int menuCount, const CameraTabSubMenuContent mode)
4953 {
4954         AppLogDebug("ENTER");
4955         SetCameraTabSettingSubMenuCount(menuCount);
4956         SetCameraTabSettingSubMenuMode(mode);
4957         AppLogDebug("EXIT");
4958 }
4959
4960 result
4961 CameraForm::SetMenuTitle(Canvas* pCanvas, const String& str, const int fntSize)
4962 {
4963         AppLogDebug("ENTER");
4964         Font* pFnt = null;
4965         Rectangle listRect;
4966         Dimension dim;
4967         Point point;
4968         result r = E_SUCCESS;
4969         String listName = L"";
4970
4971         TryCatch(pCanvas != null, r = E_SYSTEM, "pCanvas is null");
4972
4973         if (_pListViewCameraTabSubMenu)
4974         {
4975                 listRect = _pListViewCameraTabSubMenu->GetBounds();
4976         }
4977         else if (_pListViewCameraTabMainMenu)
4978         {
4979                 listRect = _pListViewCameraTabMainMenu->GetBounds();
4980                 listName = _pListViewCameraTabMainMenu->GetName();
4981         }
4982         else if (_pListFlashMainMenu)
4983         {
4984                 listRect = _pListFlashMainMenu->GetBounds();
4985                 listName = _pListFlashMainMenu->GetName();
4986         }
4987         else if (_pListWbMainMenu)
4988         {
4989                 listRect = _pListWbMainMenu->GetBounds();
4990                 listName = _pListWbMainMenu->GetName();
4991         }
4992         else if (_pListViewGeneralTabSubMenu)
4993         {
4994                 listRect = _pListViewGeneralTabSubMenu->GetBounds();
4995         }
4996         else if (_pListViewGeneralTabMainMenu)
4997         {
4998                 listRect = _pListViewGeneralTabMainMenu->GetBounds();
4999                 listName = _pListViewGeneralTabMainMenu->GetName();
5000         }
5001
5002         pFnt = new (std::nothrow) Font();
5003         pFnt->Construct(FONT_STYLE_PLAIN, fntSize);
5004
5005         r = pFnt->GetTextExtent(str, str.GetLength(), dim);
5006         TryCatch(pFnt != null, , "pFnt GetTextExtent() fail[%s]", GetErrorMessage(r));
5007
5008         r = pCanvas->SetFont(*pFnt);
5009         TryCatch(pFnt != null, , "pCanvas SetFont() fail[%s]", GetErrorMessage(r));
5010
5011         pCanvas->SetForegroundColor(COLOR_SETTING_MENU_TITLE);
5012
5013         point.x = (listRect.width / DIVIDE_BY_TWO) - (dim.width / DIVIDE_BY_TWO);
5014         point.y = (H_SETTING_MENU_PANEL_TITLE / DIVIDE_BY_TWO) - (dim.height / DIVIDE_BY_TWO);
5015
5016         if (listName.Equals(String(IDS_MENU_SETTING_MAIN_MENU_NAME)))
5017         {
5018                 if (__dir == ORIENTATION_STATUS_PORTRAIT
5019                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5020                 {
5021                         point.y += H_SETTING_MENU_TITLE_TOP_MARGIN_PORTRAIT;
5022                 }
5023                 else if (__dir == ORIENTATION_STATUS_LANDSCAPE
5024                                 || __dir == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
5025                 {
5026                         point.y += H_SETTING_MENU_TITLE_TOP_MARGIN_LANDSCAPE;
5027                 }
5028         }
5029         else if (listName.Equals(String(IDS_MENU_FLASH_MENU_NAME)))
5030         {
5031                 point.y += H_FLASH_MODE_TITLE_TOP_MARGIN;
5032
5033                 if (__dir == ORIENTATION_STATUS_PORTRAIT
5034                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5035                 {
5036                         point.x += X_FLASH_MODE_LIST_START_POS_PORTRAIT;
5037                 }
5038         }
5039
5040         r = pCanvas->DrawText(point, str);
5041         TryCatch( r == E_SUCCESS, , "pCanvas DrawText() fail[%s]", GetErrorMessage(r));
5042
5043         delete pFnt;
5044         pFnt = null;
5045
5046         AppLogDebug("EXIT");
5047         return E_SUCCESS;
5048
5049 CATCH:
5050         delete pFnt;
5051         pFnt = null;
5052
5053         return r;
5054 }
5055
5056 int
5057 CameraForm::GetTimerIntervalValue(void) const
5058 {
5059         AppLogDebug("ENTER");
5060         result r = E_SUCCESS;
5061         int timerInterval = 0;
5062
5063         r = _pCameraPresentationModel->GetValue(TIMER_INTERVAL, timerInterval);
5064         TryCatch(r == E_SUCCESS, , "Faled to get value to registry");
5065
5066         AppLogDebug("EXIT");
5067         return timerInterval;
5068
5069 CATCH:
5070         return 0;
5071 }
5072
5073 void
5074 CameraForm::SetGuideLine(int guideLineEnable)
5075 {
5076         AppLogDebug("ENTER");
5077         result r = E_SUCCESS;
5078
5079         r = _pCameraPresentationModel->SetValue(GUIDELINE_ENABLE, guideLineEnable);
5080         TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
5081         AppLogDebug("EXIT");
5082 }
5083
5084 result
5085 CameraForm::RestoreDefaultSetting(void)
5086 {
5087         AppLogDebug("ENTER");
5088         result r = E_SUCCESS;
5089         int selfPortraitEnable = 0;
5090         bool exposureValue = false;
5091         bool brighnesstValue = false;
5092         int adjustValue = 0;
5093
5094         r = _pCameraPresentationModel->ResetCameraSettingsRegistry();
5095         TryCatch(r == E_SUCCESS, ,"ResetCameraSettingsRegistry() fail[%s]", GetErrorMessage(r));
5096
5097         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
5098         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
5099
5100         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5101         {
5102                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
5103         }
5104         else
5105         {
5106                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
5107         }
5108
5109         if (exposureValue == true && r == E_SUCCESS)
5110         {
5111                 r = _pCameraPresentationModel->GetValue(EXPOSURE_VALUE, adjustValue);
5112                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
5113
5114                 AppLogDebug("adjustValue = %d", adjustValue);
5115
5116                 _pCameraPresentationModel->SetExposure(adjustValue);
5117         }
5118         else
5119         {
5120                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5121                 {
5122                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
5123                 }
5124                 else
5125                 {
5126                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
5127                 }
5128
5129                 if (brighnesstValue == true && r == E_SUCCESS)
5130                 {
5131                         r = _pCameraPresentationModel->GetValue(BRIGHTNESS_VALUE, adjustValue);
5132                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
5133
5134                         AppLogDebug("adjustValue = %d", adjustValue);
5135
5136                         _pCameraPresentationModel->SetBrightness(adjustValue);
5137                 }
5138         }
5139
5140         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5141         {
5142                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
5143         }
5144         else
5145         {
5146                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
5147         }
5148
5149         if (r == E_SUCCESS)
5150         {
5151                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5152                 {
5153                         r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_PRIMARY, adjustValue);
5154                 }
5155                 else
5156                 {
5157                         r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_SECONDARY, adjustValue);
5158                 }
5159                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
5160
5161                 AppLogDebug("adjustValue = %d", adjustValue);
5162
5163                 _pCameraPresentationModel->SetWhiteBalance((CameraWhiteBalance)adjustValue);
5164         }
5165
5166         AppLogDebug("EXIT");
5167         return r;
5168
5169 CATCH:
5170         AppLogDebug("EXIT - CATCH");
5171         return r;
5172 }
5173
5174 result
5175 CameraForm::RestorePrimaryResolution(void)
5176 {
5177         AppLogDebug("ENTER");
5178         result r = E_SUCCESS;
5179         IList* pList = null;
5180         IList* pCaptureResolutionList = null;
5181         int resolutionCnt = 0;
5182         bool wideMode = false;
5183         int resolutionIndex = 0;
5184         int resolutionRatio = 0;
5185         Dimension resolutionDim;
5186         Dimension captureResolutionDim;
5187         BufferInfo bufferinfo;
5188
5189         TryCatch(_pAppTimer != null, , "_pAppTimer is null");
5190         _pAppTimer->Cancel();
5191
5192         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
5193         TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
5194
5195         pCaptureResolutionList = _pCameraPresentationModel->GetCaptureResolutionList();
5196
5197         resolutionIndex = pCaptureResolutionList->GetCount() - INDEX_UNIT_ONE;
5198
5199         resolutionDim = *(static_cast<Dimension*>(pCaptureResolutionList->GetAt(resolutionIndex)));
5200
5201         resolutionRatio = (resolutionDim.width * MULTIPLY_BY_TEN) / (resolutionDim.height);
5202
5203         if (resolutionRatio > NORMAL_MODE_RATIO)
5204         {
5205                 wideMode = true;
5206
5207                 SetOverlayPanelWideMode(true);
5208
5209                 SetOverlayRendererRotation();
5210         }
5211         else
5212         {
5213                 wideMode = false;
5214
5215                 SetOverlayPanelNormalMode(true);
5216
5217                 SetOverlayRendererRotation();
5218         }
5219
5220         _pCameraPresentationModel->KeepScreenOnState(true, false);
5221
5222         _pCameraPresentationModel->StopCamera();
5223
5224         r = _pCameraPresentationModel->SetMode(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
5225         TryCatch(r == E_SUCCESS, , "SetMode fail[%s]", GetErrorMessage(r));
5226
5227         pList = _pCameraPresentationModel->GetCaptureResolutionList();
5228
5229         resolutionCnt = pList->GetCount();
5230
5231         captureResolutionDim = *(static_cast<Dimension*>(pList->GetAt(resolutionCnt - INDEX_UNIT_ONE)));
5232
5233         AppLogDebug("dimCaptureResolution(W:%d, H:%d)", captureResolutionDim.width, captureResolutionDim.height);
5234
5235         __captureResolutionWidth = captureResolutionDim.width;
5236
5237         __captureResolutionHeight = captureResolutionDim.height;
5238
5239         _pCameraPresentationModel->SetCaptureResolution(captureResolutionDim);
5240
5241         __primaryCurrentResolutionIndex = INDEX_UNIT_ZERO;
5242
5243         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
5244         TryCatch(r == E_SUCCESS, , "GetBackgroundBufferInfo start fail[%s]", GetErrorMessage(r));
5245
5246         _pCameraPresentationModel->StartPreview(&bufferinfo);
5247  
5248         _pCameraPresentationModel->SetContinuousAutoFocus();
5249
5250         if (wideMode == true)
5251         {
5252                 __pOverlayPanel->AddTouchEventListener(*this);
5253
5254                 HidePanel(true, true);
5255
5256                 __screenMode = SCREEN_MODE_FULL;
5257         }
5258         else
5259         {
5260                 __pOverlayPanel->RemoveTouchEventListener(*this);
5261
5262                 HidePanel(false, true);
5263
5264                 __screenMode = SCREEN_MODE_NORMAL;
5265         }
5266
5267         AppLogDebug("EXIT");
5268         return r;
5269
5270 CATCH:
5271         __screenMode = SCREEN_MODE_NORMAL;
5272
5273         return r;
5274 }
5275
5276 result
5277 CameraForm::RestoreSecondaryResolution(void)
5278 {
5279         AppLogDebug("ENTER");
5280         result r = E_SUCCESS;
5281         IList* pList = null;
5282         IList* pCaptureResolutionList = null;
5283         int resolutionCnt = 0;
5284         bool wideMode = false;
5285         int resolutionIndex = 0;
5286         int resolutionRatio = 0;
5287         Dimension resolutionDim;
5288         Dimension captureResolutionDim;
5289
5290         TryCatch(_pAppTimer != null, , "_pAppTimer is null");
5291         _pAppTimer->Cancel();
5292
5293         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
5294         TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
5295
5296         pCaptureResolutionList = _pCameraPresentationModel->GetCaptureResolutionList();
5297
5298         resolutionIndex = pCaptureResolutionList->GetCount() - INDEX_UNIT_ONE;
5299
5300         resolutionDim = *(static_cast<Dimension*>(pCaptureResolutionList->GetAt(resolutionIndex)));
5301
5302         resolutionRatio = (resolutionDim.width * MULTIPLY_BY_TEN) / (resolutionDim.height);
5303
5304         if (resolutionRatio > NORMAL_MODE_RATIO)
5305         {
5306                 wideMode = true;
5307         }
5308         else
5309         {
5310                 wideMode = false;
5311         }
5312
5313         pList = _pCameraPresentationModel->GetCaptureResolutionList();
5314
5315         resolutionCnt = pList->GetCount();
5316
5317         captureResolutionDim = *(static_cast<Dimension*>(pList->GetAt(resolutionCnt - INDEX_UNIT_ONE)));
5318
5319         AppLogDebug("dimCaptureResolution(W:%d, H:%d)", captureResolutionDim.width, captureResolutionDim.height);
5320
5321         __captureResolutionWidth = captureResolutionDim.width;
5322
5323         __captureResolutionHeight = captureResolutionDim.height;
5324
5325         _pCameraPresentationModel->SetCaptureResolution(captureResolutionDim);
5326
5327         __primaryCurrentResolutionIndex = INDEX_UNIT_ZERO;
5328
5329         __secondaryCurrentResolutionIndex = INDEX_UNIT_ZERO;
5330
5331         if (wideMode == true)
5332         {
5333                 __pOverlayPanel->AddTouchEventListener(*this);
5334
5335                 HidePanel(true, true);
5336
5337                 __screenMode = SCREEN_MODE_FULL;
5338         }
5339         else
5340         {
5341                 __pOverlayPanel->RemoveTouchEventListener(*this);
5342
5343                 HidePanel(false, true);
5344
5345                 __screenMode = SCREEN_MODE_NORMAL;
5346         }
5347
5348         AppLogDebug("EXIT");
5349         return r;
5350
5351 CATCH:
5352         return r;
5353 }
5354
5355 result
5356 CameraForm::DrawMarker(bool useGuidline)
5357 {
5358         AppLogDebug("ENTER");
5359         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5360                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5361         result r = E_SUCCESS;
5362
5363         if (__dir == ORIENTATION_STATUS_PORTRAIT
5364                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5365         {
5366                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
5367                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
5368         }
5369         else
5370         {
5371                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5372                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5373         }
5374
5375         if (useGuidline)
5376         {
5377                 _pCameraInfoPanel->SetDrawMarkerGuideline(true);
5378         }
5379         else
5380         {
5381                 _pCameraInfoPanel->SetDrawMarkerGuideline(false);
5382         }
5383         _pCameraInfoPanel->Invalidate(true);
5384
5385         AppLogDebug("EXIT");
5386         return r;
5387 }
5388
5389 result
5390 CameraForm::DrawFocus(int focusMode)
5391 {
5392         AppLogDebug("ENTER");
5393         int selfPortraitEnable = 0;
5394         bool focusSupport = false;
5395         result r = E_SUCCESS;
5396         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5397                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5398
5399         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
5400         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
5401
5402         if (__dir == ORIENTATION_STATUS_PORTRAIT
5403                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5404         {
5405                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
5406                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
5407         }
5408         else
5409         {
5410                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5411                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5412         }
5413
5414         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5415         {
5416                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FOCUS, focusSupport);
5417         }
5418         else
5419         {
5420                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_FOCUS, focusSupport);
5421         }
5422
5423         if (focusSupport == true && r == E_SUCCESS)
5424         {
5425                 _pCameraInfoPanel->SetDrawMarkerFocus(true);
5426
5427                 _pCameraInfoPanel->SetDrawMarkerFocusType(focusMode);
5428                 _pCameraInfoPanel->Invalidate(true);
5429         }
5430         else
5431         {
5432                 _pCameraInfoPanel->SetDrawMarkerFocus(false);
5433                 _pCameraInfoPanel->Invalidate(true);
5434         }
5435
5436         AppLogDebug("EXIT");
5437         return r;
5438
5439 CATCH:
5440         return r;
5441 }
5442
5443 result
5444 CameraForm::DrawTimerPopup(void)
5445 {
5446         AppLogDebug("ENTER");
5447         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5448                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5449         result r = E_SUCCESS;
5450
5451         if (__dir == ORIENTATION_STATUS_PORTRAIT
5452                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5453         {
5454                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
5455                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
5456         }
5457         else
5458         {
5459                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
5460                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
5461         }
5462
5463         _pCameraInfoPanel->SetDrawPopupTimer(true);
5464         _pCameraInfoPanel->Invalidate(true);
5465
5466         StartPopupTimer();
5467
5468         AppLogDebug("EXIT");
5469         return r;
5470 }
5471
5472 void
5473 CameraForm::SetFlashPopop(void)
5474 {
5475         AppLogDebug("ENTER");
5476         Rectangle rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_LANDSCAPE, Y_FLASH_MODE_SETTING_LIST_LANDSCAPE,
5477                                                                 W_FLASH_MODE_SETTING_LIST_LANDSCAPE, H_FLASH_MODE_SETTING_LIST_LANDSCAPE);
5478         MakeSettingPopupTab(false);
5479         HidePopup();
5480
5481         if (__dir == ORIENTATION_STATUS_PORTRAIT
5482                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5483         {
5484                 rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_PORTRAIT, Y_FLASH_MODE_SETTING_LIST_PORTRAIT + Y_FLASH_MODE_SETTING_LIST_PORTRAIT_MARGIN,
5485                                                         W_FLASH_MODE_SETTING_LIST_PORTRAIT, H_FLASH_MODE_SETTING_LIST_PORTRAIT);
5486         }
5487         else
5488         {
5489                 rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_LANDSCAPE, Y_FLASH_MODE_SETTING_LIST_LANDSCAPE + Y_FLASH_MODE_SETTING_LIST_LANDSCAPE_MARGIN,
5490                                                         W_FLASH_MODE_SETTING_LIST_LANDSCAPE, H_FLASH_MODE_SETTING_LIST_LANDSCAPE);
5491         }
5492
5493         _pCameraInfoPanel->SetDrawFlashMenuBackground(true);
5494         _pCameraInfoPanel->Invalidate(true);
5495         SetCameraTabSettingMainMenuCount(MAX_FLASH_MENU_COUNT);
5496
5497         if (_pListFlashMainMenu == null)
5498         {
5499                 _pListFlashMainMenu = new (std::nothrow) ListView();
5500                 _pListFlashMainMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
5501
5502                 _pListFlashMainMenu->SetItemProvider(*this);
5503                 _pListFlashMainMenu->AddListViewItemEventListener(*this);
5504                 _pListFlashMainMenu->SetName(IDS_MENU_FLASH_MENU_NAME);
5505         }
5506         else
5507         {
5508                 _pListFlashMainMenu->SetBounds(rectList);
5509                 _pListFlashMainMenu->SetShowState(true);
5510         }
5511         _pCameraInfoPanel->AddControl(_pListFlashMainMenu);
5512
5513         _pListFlashMainMenu->UpdateList();
5514         AppLogDebug("EXIT");
5515 }
5516
5517 void
5518 CameraForm::SetWhiteBalancePopop(void)
5519 {
5520         AppLogDebug("ENTER");
5521         Rectangle rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_LANDSCAPE, Y_FLASH_MODE_SETTING_LIST_LANDSCAPE,
5522                                                                 W_FLASH_MODE_SETTING_LIST_LANDSCAPE, H_FLASH_MODE_SETTING_LIST_LANDSCAPE);
5523         MakeSettingPopupTab(false);
5524         HidePopup();
5525
5526         if (__dir == ORIENTATION_STATUS_PORTRAIT
5527                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5528         {
5529                 rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_PORTRAIT, Y_FLASH_MODE_SETTING_LIST_PORTRAIT + Y_FLASH_MODE_SETTING_LIST_PORTRAIT_MARGIN,
5530                                                          W_FLASH_MODE_SETTING_LIST_PORTRAIT, H_FLASH_MODE_SETTING_LIST_PORTRAIT + H_WHITE_BALANC_SETTING_LIST_PORTRAIT_MARGIN);
5531         }
5532         else
5533         {
5534                 rectList = Rectangle(X_FLASH_MODE_SETTING_LIST_LANDSCAPE, Y_FLASH_MODE_SETTING_LIST_LANDSCAPE + Y_FLASH_MODE_SETTING_LIST_LANDSCAPE_MARGIN,
5535                                                         W_FLASH_MODE_SETTING_LIST_LANDSCAPE, H_FLASH_MODE_SETTING_LIST_LANDSCAPE + H_WHITE_BALANC_SETTING_LIST_LANDSCAPE_MARGIN);
5536         }
5537
5538         _pCameraInfoPanel->SetDrawWhiteBalanceBackground(true);
5539         _pCameraInfoPanel->Invalidate(true);
5540         SetCameraTabSettingMainMenuCount(MAX_WHITE_BALANCE_MENU_COUNT);
5541
5542         if (_pListWbMainMenu == null)
5543         {
5544                 _pListWbMainMenu = new (std::nothrow) ListView();
5545                 _pListWbMainMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
5546
5547                 _pListWbMainMenu->SetItemProvider(*this);
5548                 _pListWbMainMenu->AddListViewItemEventListener(*this);
5549                 _pListWbMainMenu->SetName(IDS_MENU_WB_MENU_NAME);
5550         }
5551         else
5552         {
5553                 _pListWbMainMenu->SetBounds(rectList);
5554                 _pListWbMainMenu->SetShowState(true);
5555         }
5556         _pCameraInfoPanel->AddControl(_pListWbMainMenu);
5557
5558         _pListWbMainMenu->UpdateList();
5559         AppLogDebug("EXIT");
5560 }
5561
5562 result
5563 CameraForm::ProcessFlashListPopup(int index)
5564 {
5565         AppLogDebug("ENTER");
5566         Rectangle rectPanel;
5567         Rectangle rectList;
5568         String strTitle = L"";
5569         String listName = L"";
5570         Bitmap* pBitmapNormal = null;
5571         Bitmap* pBitmapPress = null;
5572         result r = E_SUCCESS;
5573         CameraFlashMode cameraFlashMode = CAMERA_FLASH_MODE_OFF;
5574
5575         AppLogDebug("Sub Menu (%d)", index);
5576         int regVal = 0;
5577         bool value = false;
5578         int selfPortraitEnable = 0;
5579
5580         ResourceId resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_NOR;
5581         ResourceId resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_NOR;
5582
5583         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
5584         TryCatch(r == E_SUCCESS, , "GetValue Reg Fail[%s]", GetErrorMessage(r));
5585
5586         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
5587         {
5588                 AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is not support");
5589
5590                 regVal = SUBMENU_MODE_OFF;
5591                 resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_NOR;
5592                 resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS;
5593                 cameraFlashMode = CAMERA_FLASH_MODE_OFF;
5594         }
5595         else
5596         {
5597                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
5598
5599                 if (value == true && r == E_SUCCESS)
5600                 {
5601                         AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is support");
5602
5603                         switch (index)
5604                         {
5605                         case SUBMENU_MODE_OFF:
5606                                 {
5607                                         regVal = SUBMENU_MODE_OFF;
5608                                         resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_NOR;
5609                                         resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS;
5610                                         cameraFlashMode = CAMERA_FLASH_MODE_OFF;
5611                                 }
5612                                 break;
5613
5614                         case SUBMENU_MODE_ON:
5615                                 {
5616                                         regVal = SUBMENU_MODE_ON;
5617                                         resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_ON_NOR;
5618                                         resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_ON_PRESS;
5619                                         cameraFlashMode = CAMERA_FLASH_MODE_ON;
5620                                 }
5621                                 break;
5622
5623                         case SUBMENU_MODE_AUTO:
5624                                 {
5625                                         regVal = SUBMENU_MODE_AUTO;
5626                                         resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_NOR;
5627                                         resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_PRESS;
5628                                         cameraFlashMode = CAMERA_FLASH_MODE_AUTO;
5629                                 }
5630                                 break;
5631
5632                         default:
5633                                 break;
5634                         }
5635                 }
5636                 else
5637                 {
5638                         AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is not support");
5639
5640                         regVal = SUBMENU_MODE_OFF;
5641                         resIdNormal = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_NOR;
5642                         resIdPress = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_PRESS;
5643                         cameraFlashMode = CAMERA_FLASH_MODE_OFF;
5644                 }
5645         }       
5646         
5647         r = _pCameraPresentationModel->SetFlashMode(CameraFlashMode(index));
5648         TryCatch(r == E_SUCCESS, , "SetFlash fail[%s]", GetErrorMessage(r));
5649
5650         _pCameraPresentationModel->SetValue(FLASH_MODE_PRIMARY, regVal);
5651
5652         TryCatch(__pSettingPanel != null, r = E_SYSTEM, "__pSettingPanel is null");
5653
5654         TryCatch(_pFlashButton != null, r = E_SYSTEM, "_pFlashButton is null");
5655
5656         pBitmapNormal = ResourceManager::GetBitmapN(resIdNormal);
5657         TryCatch(pBitmapNormal != null, r = E_SYSTEM, "pBitmapNormal is null");
5658
5659         _pFlashButton->SetNormalBackgroundBitmap(*pBitmapNormal);
5660
5661         delete pBitmapNormal;
5662         pBitmapNormal = null;
5663
5664         pBitmapPress = ResourceManager::GetBitmapN(resIdPress);
5665         TryCatch(pBitmapPress != null, r = E_SYSTEM, "pBitmapPress is null");
5666
5667         _pFlashButton->SetPressedBackgroundBitmap(*pBitmapPress);
5668
5669         delete pBitmapPress;
5670         pBitmapPress = null;
5671
5672
5673
5674         HidePopup();
5675
5676         SetCameraTabSettingMainMenuCount(MENU_COUNT_CLEAR);
5677         SetCameraTabSubMenuListviewState(MENU_COUNT_CLEAR, CAMERA_TAB_SUB_MENU_CONTENT_MAX);
5678
5679
5680
5681         AppLogDebug("EXIT");
5682         return E_SUCCESS;
5683
5684 CATCH:
5685 AppLogDebug("Catch:");
5686         return r;
5687 }
5688
5689 result
5690 CameraForm::ProcessCameraTabMainListPopup(int index)
5691 {
5692         AppLogDebug("ENTER");
5693         Rectangle rectPanel;
5694         Rectangle rectList;
5695         String strTitle = L"";
5696         String listName = L"";
5697         bool resetPanel = false;
5698         int subPanelItemCount = 0;
5699
5700         int captureResolutionCount = 0;
5701         result r = E_SUCCESS;
5702         bool drawPopup = true;
5703
5704         listName = _pListViewCameraTabMainMenu->GetName();
5705
5706         AppResource* pAppResource = Application::GetInstance()->GetAppResource();
5707         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
5708
5709         if (listName.Equals(String(IDS_MENU_SETTING_MAIN_MENU_NAME)))
5710         {
5711                 if (_pCameraInfoSubPanel && _pListViewCameraTabSubMenu)
5712                 {
5713                         _pCameraInfoSubPanel->SetShowState(false);
5714                         _pCameraInfoSubPanel->RemoveControl(_pListViewCameraTabSubMenu);
5715                         _pListViewCameraTabSubMenu = null;
5716                         RemoveControl(_pCameraInfoSubPanel);
5717                         _pCameraInfoSubPanel = null;
5718
5719                         SetCameraTabSubMenuListviewState(MENU_COUNT_CLEAR, CAMERA_TAB_SUB_MENU_CONTENT_MAX);
5720                 }
5721
5722                 switch (index)
5723                 {
5724                 case CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE:
5725                         {
5726                                 int selfPortraitEnable = 0;
5727
5728                                 AppLogDebug("Set ISO");
5729                                 if (__pIsoList)
5730                                 {
5731                                         int isoCnt = __pIsoList->GetCount() -1;
5732
5733                                         subPanelItemCount = isoCnt;
5734                                         if (subPanelItemCount> 5)
5735                                         {
5736                                                 resetPanel = true;
5737                                         }
5738                                         if (isoCnt)
5739                                         {
5740                                                 int X_Panel = X_SUBMENU_ISO_MODE_PANEL;
5741                                                 int Y_Panel = Y_SUBMENU_ISO_MODE_PANEL;
5742                                                 int W_Panel = W_SUBMENU_ISO_MODE_PANEL;
5743                                                 int H_Panel = Y_SUBMENU_ISO_MODE_LIST + (isoCnt * H_SUBMENU_ISO_MODE_PANEL_MARGIN);
5744
5745                                                 int X_List = X_SUBMENU_ISO_MODE_LIST;
5746                                                 int Y_List = Y_SUBMENU_ISO_MODE_LIST;
5747                                                 int W_List = W_SUBMENU_ISO_MODE_LIST;
5748                                                 int H_List = (isoCnt * H_SUBMENU_ISO_MODE_LIST_MARGIN);
5749
5750                                                 rectPanel = Rectangle(X_Panel, Y_Panel, W_Panel, H_Panel + 20);
5751                                                 rectList = Rectangle(X_List, Y_List, W_List, H_List);
5752
5753                                                 pAppResource->GetString(IDS_CAM_BODY_ISO, strTitle);
5754                                                 SetCameraTabSubMenuListviewState(isoCnt, CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE);
5755                                         }
5756                                 }
5757
5758                                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
5759                                 TryCatch(r == E_SUCCESS, , "Reg GetValue() fail[%s]", GetErrorMessage(r));
5760
5761                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
5762                                 {
5763                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
5764                                 }
5765                                 else
5766                                 {
5767                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_ISO_LEVEL);
5768                                 }
5769
5770                                 if (r == E_SUCCESS)
5771                                 {
5772                                         AppLogDebug("Support ISO");
5773                                 }
5774                                 else
5775                                 {
5776                                         r = _pCameraPresentationModel->SetValue(ISO_VALUE, REG_DEFAULT_VAULE_ZERO);
5777                                         TryCatch(r == E_SUCCESS, , "Reg SetValue() fail[%s]", GetErrorMessage(r));
5778
5779                                         drawPopup = false;
5780                                 }
5781                         }
5782                         break;
5783
5784                 case CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE:
5785                         {
5786                                 if (__pCaptureResolutionList)
5787                                 {
5788                                         captureResolutionCount = __pCaptureResolutionList->GetCount();
5789
5790                                         subPanelItemCount = captureResolutionCount;
5791                                         if (subPanelItemCount > 5)
5792                                         {
5793                                                 resetPanel = true;
5794                                         }
5795
5796                                         if (captureResolutionCount > 1)
5797                                         {
5798                                                 int X_Panel = X_SUBMENU_WB_MODE_PANEL;
5799                                                 int Y_Panel = Y_SUBMENU_WB_MODE_PANEL;
5800                                                 int W_Panel = W_SUBMENU_WB_MODE_PANEL;
5801                                                 int H_Panel = H_SUBMENU_WB_MODE_LIST + (captureResolutionCount * H_SUBMENU_WB_MODE_PANEL_MARGIN);
5802
5803                                                 int X_List = X_SUBMENU_WB_MODE_LIST;
5804                                                 int Y_List = Y_SUBMENU_WB_MODE_LIST;
5805                                                 int W_List = W_SUBMENU_WB_MODE_LIST;
5806                                                 int H_List = (captureResolutionCount * W_SUBMENU_WB_MODE_LIST_MARGIN);
5807
5808                                                 rectPanel = Rectangle(X_Panel, Y_Panel, W_Panel, H_Panel);
5809                                                 rectList = Rectangle(X_List, Y_List, W_List, H_List);
5810
5811                                                 pAppResource->GetString(IDS_CAM_BODY_RESOLUTION, strTitle);
5812                                                 SetCameraTabSubMenuListviewState(captureResolutionCount, CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE);
5813                                         }
5814                                         else
5815                                         {
5816                                                 drawPopup = false;
5817                                         }
5818                                         AppLogDebug("captrueResolutionCnt count is %d",captureResolutionCount);
5819                                 }
5820                         }
5821                         break;
5822
5823                 default:
5824                         {
5825                                 SetCameraTabSubMenuListviewState(MENU_COUNT_CLEAR, CAMERA_TAB_SUB_MENU_CONTENT_MAX);
5826                                 AppLogDebug("Invaild index");
5827                                 drawPopup = false;
5828                         }
5829                         break;
5830                 }
5831
5832                 if (drawPopup)
5833                 {
5834                         if (__dir == ORIENTATION_STATUS_PORTRAIT
5835                                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
5836                         {
5837                                 rectPanel.x = X_SUBMENU_PANEL_START_PORTRAIT;
5838                                 rectPanel.y += Y_SUBMENU_PANEL_OFFSET_PORTRAIT;
5839                         }
5840                         else
5841                         {
5842                                 rectPanel.x = X_SUBMENU_PANEL_START_LANDSCAPE;
5843
5844                                 if (resetPanel)
5845                                 {
5846                                         rectList.height = rectList.height - 40 - (subPanelItemCount-5)*72;
5847                                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
5848                                         {
5849                                                 rectPanel.height = rectPanel.height - 100;
5850                                         }
5851
5852                                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE)
5853                                         {
5854                                                 rectPanel.height = rectPanel.height - 198;
5855                                                 rectList.height = rectList.height - 20;
5856                                         }
5857                                 }
5858                         }
5859
5860                         if (_pCameraInfoSubPanel == null)
5861                         {
5862                                 _pCameraInfoSubPanel = new (std::nothrow) CameraInfoSubPanel();
5863                                 TryCatch(_pCameraInfoSubPanel != null, r = E_FAILURE, "_pCameraInfoSubPanel is null");
5864
5865                                 r = _pCameraInfoSubPanel->Initialize(rectPanel);
5866                                 TryCatch(r == E_SUCCESS, , "_pCameraInfoSubPanel Initialize fail[%s]", GetErrorMessage(r));
5867
5868                                 _pCameraInfoSubPanel->SetName(IDS_CAMERA_SETTING_SUB_MENU);
5869                                 _pCameraInfoSubPanel->AddTouchEventListener(*this);
5870                                 AddOrientationEventListener(*this);
5871                                 AddControl(_pCameraInfoSubPanel);
5872                                 SetControlAlwaysOnTop(*_pCameraInfoSubPanel, true);
5873                         }
5874
5875                         _pCameraInfoSubPanel->SetMenuTitle(strTitle);
5876                         _pCameraInfoPanel->Invalidate(true);
5877                         _pCameraInfoSubPanel->Invalidate(true);
5878
5879                         _pListViewCameraTabSubMenu = new (std::nothrow) ListView();
5880                         _pListViewCameraTabSubMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
5881
5882                         _pListViewCameraTabSubMenu->SetItemProvider(*this);
5883                         _pListViewCameraTabSubMenu->AddListViewItemEventListener(*this);
5884                         _pCameraInfoSubPanel->AddControl(_pListViewCameraTabSubMenu);
5885
5886                         _pListViewCameraTabSubMenu->UpdateList();
5887                 }
5888         }
5889
5890         AppLogDebug("EXIT");
5891         return E_SUCCESS;
5892
5893 CATCH:
5894         if (_pCameraInfoSubPanel)
5895         {
5896                 RemoveControl(_pCameraInfoSubPanel);
5897                 SetCameraTabSubMenuListviewState(MENU_COUNT_CLEAR, CAMERA_TAB_SUB_MENU_CONTENT_MAX);
5898         }
5899         else
5900         {
5901                 delete _pListViewCameraTabSubMenu;
5902         }
5903
5904         _pCameraInfoSubPanel = null;
5905         _pListViewCameraTabSubMenu = null;
5906
5907         return r;
5908 }
5909
5910 result
5911 CameraForm::ProcessCameraTabSubListPopup(int index)
5912 {
5913         AppLogDebug("ENTER");
5914         String strRegKey = IDS_INIT_REG_KEY;
5915         result r = E_SUCCESS;
5916         int selfPortraitEnable = 0;
5917         CameraTabSubMenuContent idx = CAMERA_TAB_SUB_MENU_CONTENT_MAX;
5918
5919         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
5920         TryCatch(r == E_SUCCESS, , "Reg GetValue() fail[%s]", GetErrorMessage(r));
5921
5922         idx = GetCameraTabSettingSubMenuMode();
5923
5924         switch (idx)
5925         {
5926         case CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE:
5927                 {
5928                         r = SubListPopupIsoMode(index);                 
5929                         TryCatch(r == E_SUCCESS, , "SubListPopupIsoMode() fail[%s]", GetErrorMessage(r));
5930                 }
5931                 break;
5932
5933         case CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE:
5934                 {
5935                         r = SubListPopupResolutionMode(index);
5936                         TryCatch(r == E_SUCCESS, , "SubListPopupResolutionMode() fail[%s]", GetErrorMessage(r));
5937                 }
5938                 break;
5939
5940         default:
5941                 break;
5942         }
5943
5944         if (_pListViewCameraTabSubMenu)
5945         {
5946                 if (_pCameraInfoSubPanel != null)
5947                 {
5948                         _pCameraInfoSubPanel->SetShowState(false);
5949                 }
5950                 _pListViewCameraTabSubMenu->SetShowState(false);
5951
5952                 AppLogDebug("_currentSettingsMenuIndex is %d",_currentSettingsMenuIndex);
5953                 _pListViewCameraTabMainMenu->RefreshList(_currentSettingsMenuIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
5954         }
5955
5956         _pCameraInfoPanel->Invalidate(true);
5957
5958         AppLogDebug("EXIT");
5959         return r;
5960
5961 CATCH:
5962         HidePopup();
5963
5964         return r;
5965 }
5966
5967 result
5968 CameraForm::ProcessGeneraTabMainListPopup(int index)
5969 {
5970         AppLogDebug("ENTER");
5971         Rectangle rectPanel;
5972         Rectangle rectList;
5973         String strTitle = L"";
5974         String listName = L"";
5975
5976         result r = E_SUCCESS;
5977         bool drawPopup = true;
5978
5979         listName = _pListViewGeneralTabMainMenu->GetName();
5980
5981         AppResource* pAppResource = Application::GetInstance()->GetAppResource();
5982         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
5983
5984         if (listName.Equals(String(IDS_MENU_SETTING_GEN_MAIN_MENU_NAME)))
5985         {
5986                 if (_pCameraInfoGeneralSubPanel && _pListViewGeneralTabSubMenu)
5987                 {
5988                         _pCameraInfoGeneralSubPanel->SetShowState(false);
5989                         _pCameraInfoGeneralSubPanel->RemoveControl(_pListViewGeneralTabSubMenu);
5990                         _pListViewGeneralTabSubMenu = null;
5991                         RemoveControl(_pCameraInfoGeneralSubPanel);
5992                         _pCameraInfoGeneralSubPanel = null;
5993
5994                         SetGeneralTabSubMenuListviewState(MENU_COUNT_CLEAR, GENERAL_TAB_SUB_MENU_CONTENT_MAX);
5995                 }
5996
5997                 switch (index)
5998                 {
5999                 case GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE:
6000                         {
6001                                 pAppResource->GetString(IDS_CAM_BODY_TIMER, strTitle);
6002                                 rectPanel = Rectangle(X_SUBMENU_TIMER_MODE_PANEL, Y_SUBMENU_TIMER_MODE_PANEL,
6003                                                                         W_SUBMENU_TIMER_MODE_PANEL, H_SUBMENU_TIMER_MODE_PANEL);
6004                                 rectList = Rectangle(X_SUBMENU_TIMER_MODE_LIST, Y_SUBMENU_TIMER_MODE_LIST,
6005                                                                         W_SUBMENU_TIMER_MODE_LIST, H_SUBMENU_TIMER_MODE_LIST);
6006                                 SetGeneralTabSubMenuListviewState(SUBMENU_TIMER_COUNT, GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE);
6007                         }
6008                         break;
6009
6010                 case GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE:
6011                         {
6012                                 pAppResource->GetString(IDS_CAM_BODY_GUIDELINE, strTitle);
6013                                 SetGeneralTabSubMenuListviewState(SUBMENU_GUIDELINE_COUNT, GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE);
6014
6015                                 rectPanel = Rectangle(X_SUBMENU_GUIDELINE_MODE_PANEL, Y_SUBMENU_GUIDELINE_MODE_PANEL,
6016                                                                         W_SUBMENU_GUIDELINE_MODE_PANEL, H_SUBMENU_GUIDELINE_MODE_PANEL);
6017                                 rectList = Rectangle(X_SUBMENU_GUIDELINE_MODE_LIST, Y_SUBMENU_GUIDELINE_MODE_LIST,
6018                                                                         W_SUBMENU_GUIDELINE_MODE_LIST, H_SUBMENU_GUIDELINE_MODE_LIST);
6019                         }
6020                         break;
6021
6022                 case GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE:
6023                         {
6024                                 pAppResource->GetString(IDS_CAM_BODY_STORAGE, strTitle);
6025                                 rectPanel = Rectangle(X_SUBMENU_STORAGE_MODE_PANEL, Y_SUBMENU_STORAGE_MODE_PANEL,
6026                                                                         W_SUBMENU_STORAGE_MODE_PANEL, H_SUBMENU_STORAGE_MODE_PANEL);
6027                                 rectList = Rectangle(X_SUBMENU_STORAGE_MODE_LIST, Y_SUBMENU_STORAGE_MODE_LIST,
6028                                                                         W_SUBMENU_STORAGE_MODE_LIST, H_SUBMENU_STORAGE_MODE_LIST);
6029                                 SetGeneralTabSubMenuListviewState(SUBMENU_STORAGE_TYPE_COUNT, GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE);
6030                         }
6031                         break;
6032
6033                 case GENERAL_TAB_SUB_MENU_CONTENT_RESET_MODE:
6034                         {
6035                                 String tmpString;
6036
6037                                 pAppResource->GetString(L"IDS_CAM_POP_RESET_SETTINGS_Q", tmpString);
6038
6039                                 SetGeneralTabSubMenuListviewState(MENU_COUNT_CLEAR, GENERAL_TAB_SUB_MENU_CONTENT_RESET_MODE);
6040                                 drawPopup = false;
6041
6042                                 if (_pResetPopUp == null)
6043                                 {
6044                                         _pResetPopUp = new (std::nothrow) Popup();
6045                                         _pResetPopUp->Construct(L"IDL_RESET_POPUP");
6046                                         TryCatch(_pResetPopUp != null, , "Reset Popup not created!");
6047                                 }
6048
6049                                 if (_pYes == null)
6050                                 {
6051                                         _pYes = static_cast< Button*>(_pResetPopUp->GetControl(L"IDC_BUTTON_YES", true));
6052                                         TryCatch(_pYes != null, , "Reset Popup not created!");
6053                                         _pYes->SetActionId(IDA_BTN_YES);
6054                                         _pYes->AddActionEventListener(*this);
6055                                         _pYes->SetShowState(true);
6056                                 }
6057
6058                                 if (_pNo == null)
6059                                 {
6060                                         _pNo = static_cast< Button* >(_pResetPopUp->GetControl(L"IDC_BUTTON_NO", true));
6061                                         TryCatch(_pNo != null, , "Reset Popup not created!");
6062                                         _pNo->SetActionId(IDA_BTN_NO);
6063                                         _pNo->AddActionEventListener(*this);
6064                                         _pNo->SetShowState(true);
6065                                         _pResetPopUp->Show();
6066                                 }
6067
6068                                 _pResetPopUp->SetShowState(true);
6069                                 _pResetPopUp->Invalidate(true);
6070                                 _pResetPopUp->Show();
6071                         }
6072                         break;
6073
6074                 case GENERAL_TAB_SUB_MENU_OVERLAY_HELP_MODE:
6075                         {
6076                                 result r = E_SUCCESS;
6077
6078                                 r = _pCameraPresentationModel->SetValue(OVERLAY_HELP_ENABLE, SCREEN_OVERLAY_HELP_ENABLE);
6079                                 TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
6080
6081                                 r = SetScreenOverlayHelpTimer();
6082                                 TryCatch(r == E_SUCCESS, , "SetScreenOverlayHelpTimer() [%s]", GetErrorMessage(r));
6083
6084                                 r = DrawScreenOverlayHelp();
6085                                 TryCatch(r == E_SUCCESS, , "DrawScreenOverlayHelp() [%s]", GetErrorMessage(r));
6086
6087                                 drawPopup = false;
6088
6089                                 MakeSettingPopupTab(false);
6090
6091                                 HidePopup();
6092                                 HideUiQuickMenu();
6093                         }
6094                         break;
6095
6096                 default:
6097                         {
6098                                 SetGeneralTabSubMenuListviewState(MENU_COUNT_CLEAR, GENERAL_TAB_SUB_MENU_CONTENT_MAX);
6099                                 AppLogDebug("Invaild index");
6100                                 drawPopup = false;
6101                         }
6102                         break;
6103                 }
6104
6105                 if (drawPopup)
6106                 {
6107                         if (__dir == ORIENTATION_STATUS_PORTRAIT
6108                                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
6109                         {
6110                                 rectPanel.x = X_SUBMENU_PANEL_START_PORTRAIT;
6111                                 rectPanel.y += Y_SUBMENU_PANEL_OFFSET_PORTRAIT;
6112                         }
6113                         else
6114                         {
6115                                 rectPanel.x = X_SUBMENU_PANEL_START_LANDSCAPE;
6116                         }
6117
6118                         if (_pCameraInfoGeneralSubPanel == null)
6119                         {
6120                                 _pCameraInfoGeneralSubPanel = new (std::nothrow) CameraInfoGeneralSubPanel();
6121                                 TryCatch(_pCameraInfoGeneralSubPanel != null, r = E_FAILURE, "_pCameraInfoSubPanel is null");
6122
6123                                 r = _pCameraInfoGeneralSubPanel->Initialize(rectPanel);
6124                                 TryCatch(r == E_SUCCESS, , "_pCameraInfoGeneralSubPanel Initialize fail[%s]", GetErrorMessage(r));
6125
6126                                 if (index == GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE ||
6127                                                 index == GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE ||
6128                                                 index == GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE)
6129                                 {
6130                                         _pCameraInfoGeneralSubPanel->SetName(IDS_GENERAL_SETTING_SUB_MENU);
6131                                 }
6132                                 _pCameraInfoGeneralSubPanel->AddTouchEventListener(*this);
6133                                 AddOrientationEventListener(*this);
6134                                 AddControl(_pCameraInfoGeneralSubPanel);
6135                                 SetControlAlwaysOnTop(*_pCameraInfoGeneralSubPanel, true);
6136                         }
6137
6138                         _pCameraInfoGeneralSubPanel->SetMenuTitle(strTitle);
6139                         _pCameraInfoPanel->Invalidate(true);
6140                         _pCameraInfoGeneralSubPanel->Invalidate(true);
6141
6142                         _pListViewGeneralTabSubMenu = new (std::nothrow) ListView();
6143                         _pListViewGeneralTabSubMenu->Construct(rectList, true, SCROLL_STYLE_FAST_SCROLL);
6144
6145                         _pListViewGeneralTabSubMenu->SetItemProvider(*this);
6146                         _pListViewGeneralTabSubMenu->AddListViewItemEventListener(*this);
6147                         _pCameraInfoGeneralSubPanel->AddControl(_pListViewGeneralTabSubMenu);
6148
6149                         _pListViewGeneralTabSubMenu->UpdateList();
6150                 }
6151         }
6152
6153         AppLogDebug("EXIT");
6154         return r;
6155
6156 CATCH:
6157         if (_pCameraInfoGeneralSubPanel)
6158         {
6159                 RemoveControl(_pCameraInfoGeneralSubPanel);
6160                 SetGeneralTabSubMenuListviewState(MENU_COUNT_CLEAR, GENERAL_TAB_SUB_MENU_CONTENT_MAX);
6161         }
6162         else
6163         {
6164                 delete _pListViewGeneralTabSubMenu;
6165         }
6166
6167         _pCameraInfoGeneralSubPanel = null;
6168         _pListViewGeneralTabSubMenu = null;
6169
6170         AppLogDebug("EXIT - CATCH");
6171         return r;
6172 }
6173
6174 result
6175 CameraForm::ProcessGeneraTabSubListPopup(int index)
6176 {
6177         AppLogDebug("ENTER");
6178         String strRegKey = IDS_INIT_REG_KEY;
6179         result r = E_SUCCESS;
6180         int selfPortraitEnable = 0;
6181         GeneralTabSubMenuContent idx = GENERAL_TAB_SUB_MENU_CONTENT_MAX;
6182
6183         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
6184         TryCatch(r == E_SUCCESS, , "Reg GetValue() fail[%s]", GetErrorMessage(r));
6185
6186         idx = GetGeneralTabSettingSubMenuMode();
6187
6188         switch (idx)
6189         {
6190         case GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE:
6191                 {
6192                         r = SubListPopupTimerMode(index);
6193                         TryCatch(r == E_SUCCESS, , "SubListPopupTimerMode() fail[%s]", GetErrorMessage(r));
6194                 }
6195                 break;
6196         
6197         case GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE:
6198                 {
6199                         r = SubListPopupGuidelineMode(index);
6200                         TryCatch(r == E_SUCCESS, , "SubListPopupGuidelineMode() fail[%s]", GetErrorMessage(r));
6201                 }
6202                 break;
6203
6204         case GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE:
6205                 {
6206                         SubListPopupStorageTypeMode(index);
6207                 }
6208                 break;
6209
6210         case GENERAL_TAB_SUB_MENU_CONTENT_RESET_MODE:
6211                 {
6212                 }
6213                 break;
6214
6215         case GENERAL_TAB_SUB_MENU_OVERLAY_HELP_MODE:
6216                 {
6217                 }
6218                 break;
6219
6220         default:
6221                 break;
6222         }
6223
6224         if (_pListViewGeneralTabSubMenu)
6225         {
6226                 if (_pCameraInfoGeneralSubPanel != null)
6227                 {
6228                         _pCameraInfoGeneralSubPanel->SetShowState(false);
6229                 }
6230                 _pListViewGeneralTabSubMenu->SetShowState(false);
6231
6232                 AppLogDebug("_currentSettingsMenuIndex is %d",_currentSettingsMenuIndex);
6233                 _pListViewGeneralTabMainMenu->RefreshList(_currentSettingsMenuIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
6234         }
6235
6236         _pCameraInfoPanel->Invalidate(true);
6237         AppLogDebug("EXIT");
6238         return r;
6239
6240 CATCH:
6241         MakeSettingPopupTab(false);
6242         HidePopup();
6243
6244         return r;
6245 }
6246
6247 result
6248 CameraForm::StartPopupTimer(void)
6249 {
6250         AppLogDebug("ENTER");
6251         result r = E_SUCCESS;
6252         int timerInterval = 0;
6253
6254         _timeCount = 0;
6255
6256         _pPopupTimer = new (std::nothrow) Timer();
6257
6258         _pPopupTimer->Construct(*this);
6259
6260         r = _pPopupTimer->StartAsRepeatable(CAMERA_TIMER_1_SEC);
6261         TryCatch(r == E_SUCCESS, , "_pPopupTimer start fail[%s]", GetErrorMessage(r));
6262
6263         timerInterval = GetTimerIntervalValue();
6264
6265         switch (timerInterval)
6266         {
6267         case SETTING_TIMER_CAPTURE_2_SEC:
6268                 {
6269                         _timeCount = SETTING_TIMER_2_SEC_COUNT;
6270                 }
6271                 break;
6272
6273         case SETTING_TIMER_CAPTURE_5_SEC:
6274                 {
6275                         _timeCount = SETTING_TIMER_5_SEC_COUNT;
6276                 }
6277                 break;
6278
6279         case SETTING_TIMER_CAPTURE_10_SEC:
6280                 {
6281                         _timeCount = SETTING_TIMER_10_SEC_COUNT;
6282                 }
6283                 break;
6284
6285         default:
6286                 break;
6287         }
6288
6289         _pCameraInfoPanel->SetDrawPopupTimerUpdate(true);
6290         _pCameraInfoPanel->SetDrawPopupTimerCount(_timeCount);
6291         _pCameraInfoPanel->Invalidate(true);
6292
6293         AppLogDebug("EXIT");
6294         return E_SUCCESS;
6295
6296 CATCH:
6297         delete _pPopupTimer;
6298         _pPopupTimer = null;
6299
6300         return r;
6301 }
6302
6303 result
6304 CameraForm::StopPopupTimer(void)
6305 {
6306         AppLogDebug("ENTER");
6307         result r = E_SUCCESS;
6308         TryCatch(_pPopupTimer != null, r = E_SYSTEM, "_pPopupTimer is null");
6309
6310         r = _pPopupTimer->Cancel();
6311
6312         delete _pPopupTimer;
6313         _pPopupTimer = null;
6314
6315         AppLogDebug("EXIT");
6316         return E_SUCCESS;
6317
6318 CATCH:
6319         return r;
6320 }
6321
6322 void
6323 CameraForm::SetCameraSettingsDevice(void)
6324 {
6325         AppLogDebug("ENTER");
6326         int brightness = 0;
6327         int exposure = 0;
6328         int isoIndex = 0;
6329         int wbIndex = 0;
6330         result r = E_SUCCESS;
6331         int selfPortraitEnable = 0;
6332         bool exposureValue = false;
6333         bool brighnesstValue = false;
6334         int updatedIndex = 0;
6335
6336         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
6337         TryReturnVoid(r == E_SUCCESS, "Faled to Get value to registry[%s]", GetErrorMessage(r));
6338
6339         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6340         {
6341                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6342         }
6343         else
6344         {
6345                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
6346         }
6347
6348         if (exposureValue == true && r == E_SUCCESS)
6349         {
6350                 r = _pCameraPresentationModel->GetValue(EXPOSURE_VALUE, exposure);
6351                 TryReturnVoid(r == E_SUCCESS, "exposure Faled to Get value to registry[%s]", GetErrorMessage(r));
6352
6353                 _pCameraPresentationModel->SetExposure(exposure);
6354         }
6355         else
6356         {
6357                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6358                 {
6359                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6360                 }
6361                 else
6362                 {
6363                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6364                 }
6365
6366                 if (brighnesstValue == true && r == E_SUCCESS)
6367                 {
6368                         r = _pCameraPresentationModel->GetValue(BRIGHTNESS_VALUE, brightness);
6369                         TryReturnVoid(r == E_SUCCESS, "brightness Faled to Get value to registry[%s]", GetErrorMessage(r));
6370
6371                         _pCameraPresentationModel->SetBrightness(brightness);
6372                 }
6373         }
6374
6375         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6376         {
6377                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
6378         }
6379         else
6380         {
6381                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_ISO_LEVEL);
6382         }
6383
6384         if (r == E_SUCCESS)
6385         {
6386                 r = _pCameraPresentationModel->GetValue(ISO_VALUE, isoIndex);
6387                 TryReturnVoid(r == E_SUCCESS, "isoIndex Faled to Get value to registry[%s]", GetErrorMessage(r));
6388
6389                 if (isoIndex == 0)
6390                 {
6391                         updatedIndex = isoIndex + 2;
6392                 }
6393                 else
6394                 {
6395                         updatedIndex = isoIndex + 3;
6396                 }
6397                 _pCameraPresentationModel->SetIsoLevel((CameraIsoLevel)updatedIndex);
6398         }
6399
6400         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6401         {
6402                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
6403         }
6404         else
6405         {
6406                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
6407         }
6408
6409         if (r == E_SUCCESS)
6410         {
6411                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6412                 {
6413                         r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_PRIMARY, wbIndex);
6414                 }
6415                 else
6416                 {
6417                         r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_SECONDARY, wbIndex);
6418                 }
6419
6420                 TryReturnVoid(r == E_SUCCESS, "WB Faled to Get value to registry[%s]", GetErrorMessage(r));
6421
6422                 _pCameraPresentationModel->SetWhiteBalance((CameraWhiteBalance)wbIndex);
6423         }
6424         AppLogDebug("EXIT");
6425 }
6426
6427 Bitmap*
6428 CameraForm::RotationImageN(Bitmap* pSrcBitmap, ImageRotationType rotationType)
6429 {
6430         AppLogDebug("ENTER");
6431         Bitmap* pBitmap = null;
6432         ByteBuffer* pSrcByteBuff = null;
6433         ByteBuffer dstByteBuff;
6434         BufferInfo buffInfo;
6435         result r = E_SUCCESS;
6436         Dimension dim;
6437         int size = 0;
6438
6439         TryCatch(pSrcBitmap != null, r = E_SYSTEM, "pSrcBitmap is null");
6440
6441         if (rotationType == IMAGE_ROTATION_0)
6442         {
6443                 pBitmap = new (std::nothrow) Bitmap();
6444                 r = pBitmap->Construct(*pSrcBitmap, Rectangle(X_BASE_POS, Y_BASE_POS, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight()));
6445                 TryCatch(r == E_SUCCESS, , "pBitmap->Construct fail[%s]", GetErrorMessage(r));
6446
6447                 AppLogDebug("IMAGE_ROTATION_0 - EXIT");
6448                 return pBitmap;
6449         }
6450
6451         dim.width = pSrcBitmap->GetWidth();
6452         dim.height = pSrcBitmap->GetHeight();
6453
6454         size = dim.width * dim.height * (pSrcBitmap->GetBitsPerPixel() / BITS_PER_BYTE);
6455
6456         r = dstByteBuff.Construct(size);
6457         TryCatch(r == E_SUCCESS, r = GetLastResult(), "dstByteBuff.Construct failed:%s %d %d %f", GetErrorMessage(GetLastResult()), dim.width, dim.height, (pSrcBitmap->GetBitsPerPixel() / BITS_PER_BYTE));
6458
6459         r = dstByteBuff.SetPosition(BYTE_BUFFER_START_POS);
6460         TryCatch(r == E_SUCCESS, , "dstByteBuff SetPosition() fail[%s]", GetErrorMessage(r));
6461
6462         r = pSrcBitmap->Lock(buffInfo, CAMERA_TIMER_ONE_MILLI_SEC);
6463         TryCatch(r == E_SUCCESS, , "pSrcBitmap Lock() fail[%s]", GetErrorMessage(r));
6464
6465         dim.width = buffInfo.width;
6466         dim.height = buffInfo.height;
6467
6468         size = buffInfo.pitch * buffInfo.height;
6469
6470         pSrcByteBuff = new (std::nothrow) ByteBuffer();
6471         TryCatch(pSrcByteBuff, , "pSrcByteBuff failed:%s", GetErrorMessage(GetLastResult()));
6472
6473         r = pSrcByteBuff->Construct(size);
6474         TryCatch(r == E_SUCCESS, r = GetLastResult(), "pSrcByteBuff->Construct() failed:%s %d %d %f", GetErrorMessage(GetLastResult()), dim.width, dim.height, (pSrcBitmap->GetBitsPerPixel() / BITS_PER_BYTE));
6475
6476         r = pSrcByteBuff->SetPosition(BYTE_BUFFER_START_POS);
6477         TryCatch(r == E_SUCCESS, , "pSrcByteBuff SetPosition() fail[%s]", GetErrorMessage(r));
6478
6479         r = pSrcByteBuff->SetArray(static_cast<byte*>(buffInfo.pPixels), BYTE_ARRAY_START_POS, size);
6480         TryCatch(r == E_SUCCESS, , "pSrcByteBuff SetArray() fail[%s]", GetErrorMessage(r));
6481
6482         r = pSrcBitmap->Unlock();
6483         TryCatch(r == E_SUCCESS, , "pSrcBitmap Unlock() fail[%s]", GetErrorMessage(r));
6484
6485         r = ImageUtil::Rotate(*pSrcByteBuff, dstByteBuff, dim, rotationType, MEDIA_PIXEL_FORMAT_RGBA8888);
6486         TryCatch(r == E_SUCCESS, , "Rotate() fail[%s]", GetErrorMessage(r));
6487
6488         if (rotationType == IMAGE_ROTATION_90
6489                 || rotationType == IMAGE_ROTATION_270)
6490         {
6491                 dim.width = buffInfo.height;
6492                 dim.height = buffInfo.width;
6493         }
6494         else
6495         {
6496                 dim.width = buffInfo.width;
6497                 dim.height = buffInfo.height; 
6498         }
6499
6500         pBitmap = new (std::nothrow) Bitmap();
6501         r = pBitmap->Construct(dstByteBuff, dim, pSrcBitmap->GetPixelColorFormat());
6502         TryCatch(r == E_SUCCESS, , "pBitmap->Construct fail[%s]", GetErrorMessage(r));
6503
6504         delete pSrcByteBuff;
6505         pSrcByteBuff = null;
6506
6507         AppLogDebug("EXIT");
6508         return pBitmap;
6509
6510 CATCH:
6511         AppLogDebug("Image rotation process fail[%s]", GetErrorMessage(r));
6512         if (pSrcByteBuff != null)
6513         {
6514                 delete pSrcByteBuff;
6515                 pSrcByteBuff = null;
6516         }
6517
6518         if (pBitmap != null)                    //Prevent issue fix.
6519         {
6520                 delete pBitmap;
6521         }
6522         return null;
6523 }
6524
6525 result
6526 CameraForm::SetSliderAdjustValue(const Tizen::Graphics::Point& currentPosition, const Tizen::Graphics::Rectangle& movableValidRect, const Tizen::Base::String& entryName, const int maxEntryValue)
6527 {
6528         AppLogDebug("ENTER SliderAdjustValue %ls", entryName.GetPointer());
6529         result r = E_SUCCESS;
6530         int adjustEntryValue = 0;
6531         int currentEntryValue = 0;
6532         int step = 0;
6533         bool exposureValue = false;
6534         bool brighnesstValue = false;
6535         int selfPortraitEnable = 0;
6536         bool IsSliderAdjustValue = false;
6537
6538         if (__dir == ORIENTATION_STATUS_PORTRAIT
6539                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
6540         {
6541                 step = movableValidRect.width / maxEntryValue;
6542                 if (currentPosition.x > movableValidRect.x)
6543                 {
6544                         if (currentPosition.x > SLIDER_RECTVALID_X_POS)
6545                         {
6546                                 adjustEntryValue = maxEntryValue - ((currentPosition.x - movableValidRect.x) / step);
6547                                 AppLogDebug("currentEntryValue = %d , adjustEntryValue = %d", currentEntryValue, adjustEntryValue);
6548                                 if (adjustEntryValue == CAMERA_EXPOSURE_VALUE_ONE)
6549                                 {
6550                                         adjustEntryValue = CAMERA_EXPOSURE_VALUE_ZERO;
6551                                 }
6552                         }
6553                         else
6554                         {
6555                                 adjustEntryValue = maxEntryValue - ((currentPosition.x - movableValidRect.x) / step);
6556                         }
6557
6558                         IsSliderAdjustValue = true;
6559                 }
6560                 else
6561                 {
6562                         IsSliderAdjustValue = false;
6563                 }
6564         }
6565         else
6566         {
6567                 step = movableValidRect.height / maxEntryValue;
6568                 if (currentPosition.y > movableValidRect.y)
6569                 {
6570                         adjustEntryValue = ((currentPosition.y - movableValidRect.y) / step);
6571                         IsSliderAdjustValue = true;     
6572                 }
6573                 else
6574                 {
6575                         IsSliderAdjustValue = false;
6576                 }
6577         }
6578
6579         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
6580         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
6581
6582         if (entryName.Equals(String(EXPOSURE_VALUE)))
6583         {
6584                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6585                 {
6586                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6587                 }
6588                 else
6589                 {
6590                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
6591                 }
6592
6593                 if (exposureValue == true && r == E_SUCCESS)
6594                 {
6595                         r = _pCameraPresentationModel->GetValue(EXPOSURE_VALUE, currentEntryValue);
6596                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
6597                 }
6598                 else
6599                 {
6600                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6601                         {
6602                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6603                         }
6604                         else
6605                         {
6606                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6607                         }
6608
6609                         if (brighnesstValue == true && r == E_SUCCESS)
6610                         {
6611                                 r = _pCameraPresentationModel->GetValue(BRIGHTNESS_VALUE, currentEntryValue);
6612                                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
6613                         }
6614                 }
6615
6616                 AppLogDebug("currentEntryValue = %d , adjustEntryValue = %d", currentEntryValue, adjustEntryValue);
6617                 if (currentEntryValue != adjustEntryValue && IsSliderAdjustValue)
6618                 {
6619                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6620                         {
6621                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6622                         }
6623                         else
6624                         {
6625                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
6626                         }
6627
6628                         if (exposureValue == true && r == E_SUCCESS)
6629                         {
6630                                 r = _pCameraPresentationModel->SetValue(EXPOSURE_VALUE, adjustEntryValue);
6631                                 TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
6632                         }
6633                         else
6634                         {
6635                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6636                                 {
6637                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6638                                 }
6639                                 else
6640                                 {
6641                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6642                                 }
6643
6644                                 if (brighnesstValue == true && r == E_SUCCESS)
6645                                 {
6646                                         r = _pCameraPresentationModel->SetValue(BRIGHTNESS_VALUE, adjustEntryValue);
6647                                         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
6648                                 }
6649                         }
6650
6651                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6652                         {
6653                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6654                         }
6655                         else
6656                         {
6657                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
6658                         }
6659
6660                         if (exposureValue == true && r == E_SUCCESS)
6661                         {
6662                                 _pCameraPresentationModel->SetExposure(adjustEntryValue);
6663                         }
6664                         else
6665                         {
6666                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6667                                 {
6668                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6669                                 }
6670                                 else
6671                                 {
6672                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6673                                 }
6674
6675                                 if (brighnesstValue == true && r == E_SUCCESS)
6676                                 {
6677                                         _pCameraPresentationModel->SetBrightness(adjustEntryValue);
6678                                 }
6679                                 else
6680                                 {
6681                                         AppLogDebug("Exposure do not support");
6682                                 }
6683                         }
6684                 }
6685         }
6686
6687         AppLogDebug("EXIT");
6688         return r;
6689
6690 CATCH:
6691         return r;
6692 }
6693
6694 result
6695 CameraForm::CreateExposureSlider(void)
6696 {
6697         AppLogDebug("ENTER");
6698         result r = E_SUCCESS;
6699
6700         TryCatch(_pCameraInfoPanel != null, r = E_FAILURE, "_pCameraInfoPanel is null");
6701
6702         _closeTimerValue = 0;
6703         _pExposureCloseTimer = new (std::nothrow) Timer();
6704         _pExposureCloseTimer->Construct(*this);
6705
6706         _pExposureCloseTimer->StartAsRepeatable(CAMERA_EXPOSURE_TIMER_VALUE);
6707         TryCatch(r == E_SUCCESS, , "Timer::start fail[%s]", GetErrorMessage(r));
6708
6709         _pCameraInfoPanel->SetDrawExposure(true);
6710         _pCameraInfoPanel->Invalidate(true);
6711
6712         AppLogDebug("EXIT");
6713         return r;
6714
6715 CATCH:
6716         delete _pExposureCloseTimer;
6717         _pExposureCloseTimer = null;
6718
6719         return r;
6720 }
6721
6722 result
6723 CameraForm::DrawExposureSlider(void)
6724 {
6725         AppLogDebug("ENTER");
6726         Point buttonPosition;
6727         result r = E_SUCCESS;
6728         Rectangle rectSlider;
6729         int exposure = 0;
6730         int step = 0;
6731         int selfPortraitEnable = 0;
6732         bool exposureValue = false;
6733         bool brighnesstValue = false;
6734
6735         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
6736         TryCatch(r == E_SUCCESS, , "exposure Faled to Get value to registry[%s]", GetErrorMessage(r));
6737
6738         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6739         {
6740                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6741         }
6742         else
6743         {
6744                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
6745         }
6746
6747         if (exposureValue == true && r == E_SUCCESS)
6748         {
6749                 r = _pCameraPresentationModel->GetValue(EXPOSURE_VALUE, exposure);
6750                 TryCatch(r == E_SUCCESS, , "exposure Faled to Get value to registry[%s]", GetErrorMessage(r));
6751                 AppLogDebug("Exposure value %d", exposure);
6752         }
6753         else
6754         {
6755                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6756                 {
6757                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6758                 }
6759                 else
6760                 {
6761                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
6762                 }
6763
6764                 if (brighnesstValue == true && r == E_SUCCESS)
6765                 {
6766                         r = _pCameraPresentationModel->GetValue(BRIGHTNESS_VALUE, exposure);
6767                         TryCatch(r == E_SUCCESS, , "exposure Faled to Get value to registry[%s]", GetErrorMessage(r));
6768                         AppLogDebug("Exposure value %d", exposure);
6769                 }
6770         }
6771
6772         if (__dir == ORIENTATION_STATUS_PORTRAIT
6773                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
6774         {
6775                 rectSlider = Rectangle(X_EXPOSURE_PANEL_SIDER_PORTRAIT, Y_EXPOSURE_PANEL_SIDER_PORTRAIT,
6776                                                         W_EXPOSURE_PANEL_SIDER_PORTRAIT, H_EXPOSURE_PANEL_SIDER_PORTRAIT);
6777                 step = rectSlider.width / MAX_CAMERA_EXPOSURE_VALUE;
6778
6779                 buttonPosition.x = (step * (MAX_CAMERA_EXPOSURE_VALUE - exposure)) + rectSlider.x;
6780                 buttonPosition.y = rectSlider.y;
6781                 AppLogDebug("DrawExposureSlider X Point %d", buttonPosition.x);
6782         }
6783         else
6784         {
6785                 rectSlider = Rectangle(X_EXPOSURE_PANEL_SIDER_LANDSCAPE, Y_EXPOSURE_PANEL_SIDER_LANDSCAPE,
6786                                                         W_EXPOSURE_PANEL_SIDER_LANDSCAPE, H_EXPOSURE_PANEL_SIDER_LANDSCAPE);
6787                 step = rectSlider.height / MAX_CAMERA_EXPOSURE_VALUE;
6788
6789                 buttonPosition.x = rectSlider.x;
6790                 buttonPosition.y = (step * exposure) + rectSlider.y;
6791                 AppLogDebug("DrawExposureSlider Y Point %d", buttonPosition.y);
6792         }
6793
6794         r = DrawExposureSlider(buttonPosition, DRAW_INITIALIZED);
6795         TryCatch(r == E_SUCCESS, , "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
6796
6797         AppLogDebug("EXIT");
6798         return r;
6799
6800 CATCH:
6801         return r;
6802 }
6803
6804 result
6805 CameraForm::DrawExposureSlider(const Tizen::Graphics::Point& currentPosition, int DrawMode)
6806 {
6807         AppLogDebug("ENTER");
6808         result r = E_SUCCESS;
6809         Point buttonPosition;
6810         Rectangle rectSlider;
6811         float adjustedXvalue = 0;
6812         int adjustedXinInt = 0;
6813
6814         bool IsSliderRectValid = false;
6815
6816         AppLogDebug("DrawExposureSlider DrawMode %d, X Point %d, Y Point %d", DrawMode, currentPosition.x, currentPosition.y);
6817
6818         if (__dir == ORIENTATION_STATUS_PORTRAIT
6819                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
6820         {
6821                 rectSlider = Rectangle(X_EXPOSURE_PANEL_SIDER_PORTRAIT, Y_EXPOSURE_PANEL_SIDER_PORTRAIT,
6822                                                         W_EXPOSURE_PANEL_SIDER_PORTRAIT, H_EXPOSURE_PANEL_SIDER_PORTRAIT);
6823                 switch (DrawMode)
6824                 {
6825                 case DRAW_INITIALIZED:
6826                         {
6827                                 buttonPosition.x = currentPosition.x - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6828                                 buttonPosition.y = currentPosition.y;
6829                                 IsSliderRectValid = true;
6830                         }
6831                         break;
6832
6833                 case DRAW_RELEASED:
6834                 {
6835                         if ((currentPosition.x >= rectSlider.x) && (currentPosition.x <= (rectSlider.x + rectSlider.width)))
6836                         {
6837                                 if ((currentPosition.y >= rectSlider.y) && (currentPosition.y <= (rectSlider.y + rectSlider.height)))
6838                                 {
6839                                         buttonPosition.x = currentPosition.x - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6840                                         buttonPosition.y = rectSlider.y;
6841                                         IsSliderRectValid = true;
6842                                         AppLogDebug("button x= %d , y=%d",buttonPosition.x,buttonPosition.y);
6843
6844                                         adjustedXvalue = (float)buttonPosition.x - X_EXPOSURE_PANEL_SIDER_PORTRAIT;
6845                                         adjustedXinInt = buttonPosition.x - X_EXPOSURE_PANEL_SIDER_PORTRAIT;
6846
6847                                         adjustedXvalue = adjustedXvalue / BRIGHTNESS_DIVIDER_PORTRAIT_MODE;
6848                                         adjustedXinInt = adjustedXinInt/ BRIGHTNESS_DIVIDER_PORTRAIT_MODE;
6849
6850                                         if ((adjustedXvalue - adjustedXinInt) != 0)
6851                                         {
6852                                                 adjustedXinInt = adjustedXinInt+1;
6853                                         }
6854
6855                                         adjustedXinInt = BRIGHTNESS_DIVIDER_PORTRAIT_MODE*adjustedXinInt;
6856
6857                                         buttonPosition.x = X_EXPOSURE_PANEL_SIDER_PORTRAIT + adjustedXinInt;
6858                                         AppLogDebug("updated button x poitn is %d",buttonPosition.x);
6859                                         r = SetSliderAdjustValue(currentPosition, rectSlider, EXPOSURE_VALUE, MAX_CAMERA_EXPOSURE_VALUE);
6860                                         TryCatch(r == E_SUCCESS, , "SliderAdjustValue() fail[%s]", GetErrorMessage(r));
6861                                 }
6862                         }
6863                         else
6864                         {
6865                                 IsSliderRectValid = false;
6866                         }
6867                 }
6868                 break;
6869
6870                 case DRAW_MOVED:
6871                         {
6872                                 if ((currentPosition.x >= rectSlider.x) && (currentPosition.x <= (rectSlider.x + rectSlider.width)))
6873                                 {
6874                                         if ((currentPosition.y >= rectSlider.y) && (currentPosition.y <= (rectSlider.y + rectSlider.height)))
6875                                         {
6876                                                 buttonPosition.x = currentPosition.x - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6877                                                 buttonPosition.y = rectSlider.y;
6878                                                 IsSliderRectValid = true;
6879                                                 r = SetSliderAdjustValue(currentPosition, rectSlider, EXPOSURE_VALUE, MAX_CAMERA_EXPOSURE_VALUE);
6880                                                 TryCatch(r == E_SUCCESS, , "SliderAdjustValue() fail[%s]", GetErrorMessage(r));
6881                                         }
6882                                 }
6883                                 else
6884                                 {
6885                                         IsSliderRectValid = false;
6886                                 }
6887
6888                                 if ((buttonPosition.y % FRAME_SKIP) != INDEX_UNIT_ZERO)
6889                                 {
6890                                         IsSliderRectValid = false;
6891                                 }
6892                         }
6893                         break;
6894
6895                 default:
6896                         break;
6897                 }
6898         }
6899         else
6900         {
6901                 rectSlider = Rectangle(X_EXPOSURE_PANEL_SIDER_LANDSCAPE, Y_EXPOSURE_PANEL_SIDER_LANDSCAPE,
6902                                                         W_EXPOSURE_PANEL_SIDER_LANDSCAPE, H_EXPOSURE_PANEL_SIDER_LANDSCAPE);
6903                 switch (DrawMode)
6904                 {
6905                 case DRAW_INITIALIZED:
6906                         {
6907                                 buttonPosition.x = currentPosition.x;
6908                                 buttonPosition.y = currentPosition.y - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6909                                 IsSliderRectValid = true;
6910                         }
6911                         break;
6912
6913                 case DRAW_RELEASED:
6914                         {
6915                                 if ((currentPosition.x >= rectSlider.x) && (currentPosition.x <= (rectSlider.x + rectSlider.width)))
6916                                 {
6917                                         if ((currentPosition.y >= rectSlider.y) && (currentPosition.y <= (rectSlider.y + rectSlider.height)))
6918                                         {
6919                                                 buttonPosition.x = rectSlider.x;
6920                                                 buttonPosition.y = currentPosition.y - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6921                                                 IsSliderRectValid = true;
6922                                                 r = SetSliderAdjustValue(currentPosition, rectSlider, EXPOSURE_VALUE, MAX_CAMERA_EXPOSURE_VALUE);
6923                                                 TryCatch(r == E_SUCCESS, , "SliderAdjustValue() fail[%s]", GetErrorMessage(r));
6924                                         }
6925                                 }
6926                                 else
6927                                 {
6928                                         IsSliderRectValid = false;
6929                                 }
6930                         }
6931                         break;
6932
6933                 case DRAW_MOVED:
6934                         {
6935                                 if ((currentPosition.x >= rectSlider.x) && (currentPosition.x <= (rectSlider.x + rectSlider.width)))
6936                                 {
6937                                         if ((currentPosition.y >= rectSlider.y) && (currentPosition.y <= (rectSlider.y + rectSlider.height)))
6938                                         {
6939                                                 buttonPosition.x = rectSlider.x;
6940                                                 buttonPosition.y = currentPosition.y - OFFSET_EXPOSURE_PANEL_SLIDER_BUTTON;
6941                                                 IsSliderRectValid = true;
6942                                                 r = SetSliderAdjustValue(currentPosition, rectSlider, EXPOSURE_VALUE, MAX_CAMERA_EXPOSURE_VALUE);
6943                                                 TryCatch(r == E_SUCCESS, , "SliderAdjustValue() fail[%s]", GetErrorMessage(r));
6944                                         }
6945                                 }
6946                                 else
6947                                 {
6948                                         IsSliderRectValid = false;
6949                                 }
6950
6951                                 if ((buttonPosition.y % FRAME_SKIP) != INDEX_UNIT_ZERO)
6952                                 {
6953                                         IsSliderRectValid = false;
6954                                 }
6955                         }
6956                         break;
6957
6958                 default:
6959                         break;
6960                 }
6961         }
6962
6963         if (IsSliderRectValid)
6964         {
6965                 _pCameraInfoPanel->SetButtonPoint(buttonPosition);
6966                 _pCameraInfoPanel->Invalidate(true);
6967         }
6968
6969         AppLogDebug("EXIT");
6970         return r;
6971
6972 CATCH:
6973         return r;
6974 }
6975
6976 void
6977 CameraForm::ShowExposureSlider(void)
6978 {
6979         AppLogDebug("ENTER");
6980         int selfPortraitEnable = CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY;
6981         bool exposureValue = false;
6982         bool brighnesstValue = false;
6983         result r = E_SUCCESS;
6984
6985         if (_pExposureCloseTimer)
6986         {
6987                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
6988                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
6989
6990                 if (_pExposureCloseTimer->Cancel() == E_SUCCESS)
6991                 {
6992                         HidePopup();
6993
6994                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
6995                         {
6996                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_EXPOSURE, exposureValue);
6997                         }
6998                         else
6999                         {
7000                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_EXPOSURE, exposureValue);
7001                         }
7002
7003                         if (exposureValue == true && r == E_SUCCESS)
7004                         {
7005                                 r = CreateExposureSlider();
7006                                 TryReturnVoid(r == E_SUCCESS, "CreateExposureSlider() fail[%s]", GetErrorMessage(r));
7007
7008                                 r = DrawExposureSlider();
7009                                 TryReturnVoid(r == E_SUCCESS, "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
7010                         }
7011                         else
7012                         {
7013                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
7014                                 {
7015                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_BRIGHTNESS, brighnesstValue);
7016                                 }
7017                                 else
7018                                 {
7019                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_BRIGHTNESS, brighnesstValue);
7020                                 }
7021
7022                                 if (brighnesstValue == true && r == E_SUCCESS)
7023                                 {
7024                                         r = CreateExposureSlider();
7025                                         TryReturnVoid(r == E_SUCCESS, "CreateExposureSlider() fail[%s]", GetErrorMessage(r));
7026
7027                                         r = DrawExposureSlider();
7028                                         TryReturnVoid(r == E_SUCCESS, "DrawExposureSlider() fail[%s]", GetErrorMessage(r));
7029                                 }
7030                         }
7031                 }
7032         }
7033         AppLogDebug("EXIT");
7034 }
7035
7036 void
7037 CameraForm::SetOverlayPanelOrientationChanged(Tizen::Ui::OrientationStatus orientationStatus)
7038 {
7039         AppLogDebug("ENTER");
7040         result r = E_SUCCESS;
7041         bool modified = false;
7042         bool isValidRect = false;
7043         Dimension dimRendererSize;
7044
7045         if (__screenMode == SCREEN_MODE_NORMAL)
7046         {
7047                 Dimension dim = Dimension(0, 0);
7048                 Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7049                 Rectangle evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7050                 Rectangle clientRect = GetClientAreaBounds();
7051                 bool isToCompensated = false;
7052
7053                 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
7054                         || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
7055                 {
7056                         if (clientRect.height == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
7057                         {
7058                                 evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
7059                                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
7060                         }
7061                         else
7062                         {
7063                                 evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
7064                                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
7065                         }
7066                 }
7067                 else
7068                 {
7069                         if (clientRect.width == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
7070                         {
7071                                 evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7072                                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7073                         }
7074                         else
7075                         {
7076                                 evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, H_PREVIEW_OVERLAY_LANDSCAPE);
7077                                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, H_PREVIEW_OVERLAY_LANDSCAPE);
7078                         }
7079                 }
7080
7081                 TryReturnVoid(__pOverlayPanel != null, "__pOverlayPanel is null");
7082
7083                 AppLogDebug("Client area rect (%d, %d, %d, %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
7084                 AppLogDebug("Input EvaluateBounds (%d, %d, %d, %d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
7085
7086                 isValidRect = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN, evaluateBoundsRect, modified);
7087                 TryReturnVoid(isValidRect == true, "OverlayRegion::EvaluateBounds returned error[%s]", GetErrorMessage(GetLastResult()));
7088
7089                 if (modified == true)
7090                 {
7091                         AppLogDebug("OverlayRegion::EvaluateBounds is modified to (%d,%d,%d,%d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
7092                 }
7093
7094                 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
7095                         || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
7096                 {
7097                         if (evaluateBoundsRect.height == rect.height)
7098                         {
7099                                 isToCompensated = false;
7100                         }
7101                         else
7102                         {
7103                                 isToCompensated = true;
7104                         }
7105                 }
7106                 else
7107                 {
7108                         if (evaluateBoundsRect.width == rect.width)
7109                         {
7110                                 isToCompensated = false;
7111                         }
7112                         else
7113                         {
7114                                 isToCompensated = true;
7115                         }
7116                 }
7117
7118                 r = __pOverlayPanel->SetBounds(rect);
7119                 AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
7120                 AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7121
7122                 if (isToCompensated == true)
7123                 {
7124                         AppLogDebug("isToCompensated = true");
7125
7126                         rect = __pOverlayPanel->GetBounds();
7127                         AppLogDebug("__pOverlayPanel GetBounds area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7128
7129                         r = __pOverlayPanel->SetBounds(rect);
7130                         AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
7131                         AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7132                 }
7133
7134                 dimRendererSize = __pOverlayPanel->GetSize();
7135                 AppLogDebug("__pOverlayPanel->GetSize() area rect (%d, %d)", dimRendererSize.width, dimRendererSize.height);
7136                 __pOverlayPanel->SetRenderSize(dimRendererSize);
7137         }
7138         else
7139         {
7140                 Rectangle evaluateBoundsRect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
7141                 Rectangle rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
7142                 Rectangle clientRect = GetClientAreaBounds();
7143                 bool isToCompensated = false;
7144
7145                 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
7146                         || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
7147                 {
7148                         if (clientRect.height == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
7149                         {
7150                                 rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
7151                         }
7152                         else
7153                         {
7154                                 rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
7155                         }
7156                 }
7157                 else
7158                 {
7159                         if (clientRect.width == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
7160                         {
7161                                 rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
7162                         }
7163                         else
7164                         {
7165                                 rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, GetClientAreaBounds().height);
7166                         }
7167                 }
7168
7169                 TryReturnVoid(__pOverlayPanel != null, "__pOverlayPanel is null");
7170
7171                 AppLogDebug("Client area rect (%d, %d, %d, %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
7172                 AppLogDebug("Input EvaluateBounds (%d, %d, %d, %d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
7173
7174                 isValidRect = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, evaluateBoundsRect, modified);
7175                 TryReturnVoid(isValidRect == true, "OverlayRegion::EvaluateBounds returned error[%s]", GetErrorMessage(GetLastResult()));
7176
7177                 if (modified == true)
7178                 {
7179                         AppLogDebug("OverlayRegion::EvaluateBounds is modified to (%d,%d,%d,%d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
7180                 }
7181
7182                 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT
7183                         || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
7184                 {
7185                         if (evaluateBoundsRect.height == rect.height)
7186                         {
7187                                 isToCompensated = false;
7188                         }
7189                         else
7190                         {
7191                                 isToCompensated = true;
7192                         }
7193                 }
7194                 else
7195                 {
7196                         if (evaluateBoundsRect.width == rect.width)
7197                         {
7198                                 isToCompensated = false;
7199                         }
7200                         else
7201                         {
7202                                 isToCompensated = true;
7203                         }
7204                 }
7205
7206                 r = __pOverlayPanel->SetBounds(rect);
7207                 AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
7208                 AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7209
7210                 if (isToCompensated == true)
7211                 {
7212                         AppLogDebug("isToCompensated = true");
7213                         rect = __pOverlayPanel->GetBounds();
7214                         AppLogDebug("__pOverlayPanel GetBounds area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7215
7216                         r = __pOverlayPanel->SetBounds(rect);
7217                         AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
7218                         AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
7219                 }
7220
7221                 dimRendererSize = __pOverlayPanel->GetSize();
7222                 AppLogDebug("__pOverlayPanel->GetSize() area rect (%d, %d)", dimRendererSize.width, dimRendererSize.height);
7223                 __pOverlayPanel->SetRenderSize(dimRendererSize); 
7224         }
7225         AppLogDebug("EXIT");
7226 }
7227
7228 void
7229 CameraForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
7230 {
7231         AppLogDebug("ENTER");
7232         result r = E_SUCCESS;
7233         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7234         Rectangle evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
7235         Rectangle clientRect = GetClientAreaBounds();
7236         BufferInfo bufferinfo;
7237         String listName = L"";
7238         int selfPortraitEnable = CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY;
7239         int guideLineEnable = DISABLE_GUIDELINE;
7240
7241         if (_appControlActionCompleted)
7242         {
7243                 AppLogDebug("OnOrientationChanged >> TerminateApp Execution");
7244
7245                 if (__dir != orientationStatus)
7246                 {
7247                         __dir = orientationStatus;
7248                         __deviceOrientation = orientationStatus;
7249                 }
7250                 return;
7251         }
7252
7253         if (__dir != orientationStatus)
7254         {
7255                 __isOrientationChanged = true;
7256
7257                 if (_pAppTimer != null)
7258                 {
7259                         _pAppTimer->Cancel();
7260
7261                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
7262                 }
7263                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
7264                 TryReturnVoid(r == E_SUCCESS, "Read Reg fail[%s]", GetErrorMessage(r));
7265
7266                 SetOverlayPanelOrientationChanged(orientationStatus);
7267
7268                 if (__pOverlayPanel)
7269                 {
7270                         switch (orientationStatus)
7271                         {
7272                         case ORIENTATION_STATUS_PORTRAIT:
7273                                 {
7274                                         AppLogDebug("PORTRAIT");
7275                                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_90);
7276                                 }
7277                                 break;
7278
7279                         case ORIENTATION_STATUS_PORTRAIT_REVERSE:
7280                                 {
7281                                         AppLogDebug("PORTRAIT_REVERSE");
7282                                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_270);
7283                                 }
7284                                 break;
7285
7286                         case ORIENTATION_STATUS_LANDSCAPE:
7287                                 {
7288                                         AppLogDebug("LANDSCAPE");
7289                                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_NONE);
7290                                 }
7291                                 break;
7292
7293                         case ORIENTATION_STATUS_LANDSCAPE_REVERSE:
7294                                 {
7295                                         AppLogDebug("LANDSCAPE_REVERSE");
7296                                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_180);
7297                                 }
7298                                 break;
7299
7300                         default:
7301                                 break;
7302                         }
7303                 }
7304
7305                 if (__screenMode == SCREEN_MODE_FULL)
7306                 {
7307                         HidePanel(true, true);
7308                 }
7309
7310                 __dir = orientationStatus;
7311                 __deviceOrientation = orientationStatus;
7312
7313                 AppLogDebug("__dir = %d", __dir);
7314                 _pCameraPresentationModel->SetOrientation(__dir);
7315
7316                 r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, guideLineEnable);
7317                 TryReturnVoid(r == E_SUCCESS, "Read Reg fail[%s]", GetErrorMessage(r));
7318
7319                 if (guideLineEnable == DISABLE_GUIDELINE)
7320                 {
7321                         DrawMarker(false);
7322                 }
7323                 else
7324                 {
7325                         DrawMarker(true);
7326                 }
7327
7328                 UpdateUiPanelIcon();
7329                 UpdateUiActionPanelIcon();
7330                 OnHelpCloseTimerExpired();
7331
7332                 if (__isTimerRunning)
7333                 {
7334                         if (_pHelpCloseTimer)
7335                         {
7336                                 _pHelpCloseTimer->Cancel();
7337
7338                                 delete _pHelpCloseTimer;
7339                                 _pHelpCloseTimer = null;
7340                         }
7341
7342                         HideScreenOverlayHelp();
7343                 }
7344
7345                 if (_pListViewCameraTabMainMenu != null)
7346                 {
7347                         listName = _pListViewCameraTabMainMenu->GetName();
7348                         if (listName.Equals(String(IDS_MENU_SETTING_MAIN_MENU_NAME)) && _pListViewCameraTabMainMenu->GetShowState() == true)
7349                         {
7350                                 HidePopup();
7351                         }
7352                 }
7353
7354                 if (_pListViewGeneralTabMainMenu != null)
7355                 {
7356                         listName = _pListViewGeneralTabMainMenu->GetName();
7357                         if (listName.Equals(String(IDS_MENU_SETTING_GEN_MAIN_MENU_NAME)) && _pListViewGeneralTabMainMenu->GetShowState() == true)
7358                         {
7359                                 HidePopup();
7360                         }
7361                 }
7362
7363                 if (_pListFlashMainMenu != null)
7364                 {
7365                         listName = _pListFlashMainMenu->GetName();
7366
7367                         if (listName.Equals(String(IDS_MENU_FLASH_MENU_NAME))&& _pListFlashMainMenu->GetShowState() == true)
7368                         {
7369                                 HidePopup();
7370                         }
7371                 }
7372
7373                 if (_pListWbMainMenu != null)
7374                 {
7375                         listName = _pListWbMainMenu->GetName();
7376
7377                         if (listName.Equals(String(IDS_MENU_WB_MENU_NAME))&& _pListWbMainMenu->GetShowState() == true)
7378                         {
7379                                 HidePopup();
7380                         }
7381                 }
7382
7383                 if (_pListViewCameraTabSubMenu != null)
7384                 {
7385                         if (_pListViewCameraTabSubMenu->GetShowState() == true)
7386                         {
7387                                 HidePopup();
7388                         }
7389                 }
7390
7391                 if (_pListViewGeneralTabSubMenu != null)
7392                 {
7393                         if (_pListViewGeneralTabSubMenu->GetShowState() == true)
7394                         {
7395                                 HidePopup();
7396                         }
7397                 }
7398
7399                 ShowExposureSlider();
7400
7401                 MakeSettingPopupTab(false);
7402
7403                 Invalidate(true);
7404                 __isOrientationChanged = false;
7405         }
7406         AppLogDebug("EXIT");
7407 }
7408
7409 void
7410 CameraForm::HidePopup(void)
7411 {
7412         AppLogDebug("ENTER");
7413         TryReturnVoid(_pCameraInfoPanel != null, "_pCameraInfoPanel is null");
7414
7415         if (_pListViewCameraTabSubMenu)
7416         {
7417                 if (_pCameraInfoSubPanel != null)
7418                 {
7419                         _pCameraInfoSubPanel->SetShowState(false);
7420                 }
7421
7422                 _pListViewCameraTabSubMenu->SetShowState(false);
7423         }
7424
7425         if (_pListViewCameraTabMainMenu)
7426         {
7427                 _pListViewCameraTabMainMenu->SetShowState(false);
7428         }
7429
7430         if (_pListFlashMainMenu)
7431         {
7432                 _pListFlashMainMenu->SetShowState(false);
7433         }
7434
7435         if (_pListWbMainMenu)
7436         {
7437                 _pListWbMainMenu->SetShowState(false);
7438         }
7439
7440         if (_pListViewGeneralTabSubMenu)
7441         {
7442                 if (_pCameraInfoGeneralSubPanel != null)
7443                 {
7444                         _pCameraInfoGeneralSubPanel->SetShowState(false);
7445                 }
7446                 _pListViewGeneralTabSubMenu->SetShowState(false);
7447         }
7448
7449         if (_pListViewGeneralTabMainMenu)
7450         {
7451                 _pListViewGeneralTabMainMenu->SetShowState(false);
7452         }
7453
7454         _pCameraInfoPanel->SetDrawExposure(false);
7455         _pCameraInfoPanel->SetDrawWhiteBalanceBackground(false);
7456         _pCameraInfoPanel->SetDrawFlashMenuBackground(false);
7457         _pCameraInfoPanel->SetDrawSettingMenuBackground(false);
7458         _pCameraInfoPanel->SetGeneralDrawSettingMenuBackground(false);
7459
7460         if (__isOrientationChanged)
7461         {
7462                 __isOrientationChanged = false;
7463                 _pCameraInfoPanel->Invalidate(true);
7464         }
7465         else
7466         {
7467                 _pCameraInfoPanel->Draw();
7468                 _pCameraInfoPanel->Show();
7469         }
7470         __resolutionChange = false;
7471         AppLogDebug("EXIT");
7472 }
7473
7474 void
7475 CameraForm::CheckStorageInfo(void)
7476 {
7477         AppLogDebug("ENTER");
7478         result r = E_SUCCESS;
7479         MessageBox messageBox;
7480         int result = 0;
7481         String strTemp = L"";
7482         int remainedNum = 0;
7483
7484         remainedNum = _pCameraInfoPanel->GetRemainedPhoto();
7485         AppLogDebug("CheckStorageInfo remainedNum = %d", remainedNum);
7486
7487         if (remainedNum == STORAGE_VALUE_ZERO)
7488         {
7489                 if (__lowMemoryCapacity == false)
7490                 {
7491                         __lowMemoryCapacity = true;
7492                         __isMemoryFull = false;
7493                         r = messageBox.Construct(L"", L"Low Memory Left. You may take some photo depending on the subject", MSGBOX_STYLE_OK, MESSAGEBOX_DISPLAY_TIME_3_SEC);
7494                 }
7495                 else if (__lowMemoryCapacity == true)
7496                 {
7497                         __isMemoryFull = true;
7498                         r = messageBox.Construct(L"", L"Memory Full", MSGBOX_STYLE_OK, MESSAGEBOX_DISPLAY_TIME_3_SEC);
7499                 }
7500                 TryReturnVoid(r == E_SUCCESS, "msgBox::Construct() failed by [%s]", GetErrorMessage(r));
7501
7502                 r = messageBox.ShowAndWait(result);
7503                 TryReturnVoid(r == E_SUCCESS, "ShowAndWait() fail(%s)", GetErrorMessage(r));
7504
7505                 switch (result)
7506                 {
7507                 case MSGBOX_RESULT_OK:
7508                         {
7509                                 if (__lowMemoryCapacity == true)
7510                                 {
7511                                         strTemp.Format(UI_INDICATOR_STORAGE_FREE_SPACE_BUFFER_LEN, L"%d", remainedNum);
7512                                         _pCameraInfoPanel->SetStorageTitle(strTemp);
7513                                         _pCameraInfoPanel->SetDrawIndicatorStroageInfo(false);
7514                                         _pCameraInfoPanel->SetDrawMemoryfulIndicator(true);
7515                                         _pCameraInfoPanel->Invalidate(true);
7516                                 }
7517
7518                                 if (__isMemoryFull == true)
7519                                 {
7520                                         strTemp.Format(UI_INDICATOR_STORAGE_FREE_SPACE_BUFFER_LEN, L"%d", remainedNum);
7521                                         _pCameraInfoPanel->SetStorageTitle(strTemp);
7522                                         _pCameraInfoPanel->SetDrawIndicatorStroageInfo(false);
7523                                         _pCameraInfoPanel->SetDrawMemoryfulIndicator(true);
7524                                         _pCameraInfoPanel->Invalidate(true);
7525                                 }
7526                         }
7527                         break;
7528
7529                 default:
7530                         break;
7531                 }
7532                 //r = TerminateApp();
7533                 //TryCatch(r == E_SUCCESS, , "TerminateApp fail[%s]", GetErrorMessage(r));
7534         }
7535         else
7536         {
7537                 if (remainedNum > STORAGE_VALUE_ZERO && remainedNum <= STORAGE_DISPLAY_PLACE)
7538                 {
7539                         _pCameraInfoPanel->SetStorageTitle(strTemp);
7540                         _pCameraInfoPanel->SetDrawIndicatorStroageInfo(true);
7541                         _pCameraInfoPanel->SetDrawMemoryfulIndicator(false);
7542                         _pCameraInfoPanel->Invalidate(true);
7543                 }
7544
7545                 SetExifOrientation(__deviceOrientation);
7546                 StartCaptured();
7547         }
7548 /*CATCH:
7549         AppLogDebug("EXIT");*/
7550 }
7551
7552 void
7553 CameraForm::AppControlRequestHideButton(void)
7554 {
7555         AppLogDebug("ENTER");
7556         CameraApp* pApp = static_cast<CameraApp*>(UiApp::GetInstance());
7557         const IMap* pArguments = pApp->GetAppControlArguments();
7558         if (pArguments == null)
7559         {
7560                 AppLogDebug("pAllowSwtich is null");
7561                 if (__pCameraIconLabel)
7562                 {
7563                         __pCameraIconLabel->SetShowState(true);
7564                 }
7565
7566                 if (__pCamcoderIconLabel)
7567                 {
7568                         __pCamcoderIconLabel->SetShowState(true);
7569                 }
7570
7571                 if (__pSwButton)
7572                 {
7573                         __pSwButton->SetShowState(true);
7574                 }
7575         }
7576         else
7577         {
7578                 AppLogDebug("pAllowSwitch is not null");
7579                 const String* pAllowSwitch = static_cast<const String*>(pArguments->GetValue(String(ALLOW_SWITCH)));
7580                 if (pAllowSwitch->Equals(ALLOW_SWITCH_TRUE, false) == true)
7581                 {
7582                         AppLogDebug("ALLOW_SWITCH_TRUE");
7583
7584                         if (__isTimerRunning)
7585                         {
7586                                 if (__pCameraIconLabel)
7587                                 {
7588                                         __pCameraIconLabel->SetShowState(false);
7589                                 }
7590
7591                                 if (__pCamcoderIconLabel)
7592                                 {
7593                                         __pCamcoderIconLabel->SetShowState(false);
7594                                 }
7595
7596                                 if (__pSwButton)
7597                                 {
7598                                         __pSwButton->SetShowState(false);
7599                                 }
7600                         }
7601                         else
7602                         {
7603                                 if (__pCameraIconLabel)
7604                                 {
7605                                         __pCameraIconLabel->SetShowState(true);
7606                                 }
7607
7608                                 if (__pCamcoderIconLabel)
7609                                 {
7610                                         __pCamcoderIconLabel->SetShowState(true);
7611                                 }
7612
7613                                 if (__pSwButton)
7614                                 {
7615                                         __pSwButton->SetShowState(true);
7616                                 }
7617                         }
7618                 }
7619                 else
7620                 {
7621                         AppLogDebug("ALLOW_SWITCH_FALSE");
7622                         if (__pCameraIconLabel)
7623                         {
7624                                 __pCameraIconLabel->SetShowState(false);
7625                         }
7626
7627                         if (__pCamcoderIconLabel)
7628                         {
7629                                 __pCamcoderIconLabel->SetShowState(false);
7630                         }
7631
7632                         if (__pSwButton)
7633                         {
7634                                 __pSwButton->SetShowState(false);
7635                         }
7636                 }
7637         }
7638         AppLogDebug("EXIT");
7639 }
7640
7641 void
7642 CameraForm::HideUiActionButton(void)
7643 {
7644         AppLogDebug("ENTER");
7645         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
7646         {
7647                 AppControlRequestHideButton();
7648         }
7649         else
7650         {
7651                 if (__pCameraIconLabel)
7652                 {
7653                         __pCameraIconLabel->SetShowState(true);
7654                 }
7655
7656                 if (__pCamcoderIconLabel)
7657                 {
7658                         __pCamcoderIconLabel->SetShowState(true);
7659                 }
7660
7661                 if (__pSwButton)
7662                 {
7663                         __pSwButton->SetShowState(true);
7664                 }
7665         }
7666         AppLogDebug("EXIT");
7667 }
7668
7669 void
7670 CameraForm::HideUiPanel(bool state)
7671 {
7672         AppLogDebug("ENTER");
7673         if (state == true)
7674         {
7675                 _pFlashButton->SetShowState(false);
7676                 _pSelfShotButton->SetShowState(false);
7677                 _pSettingButton->SetShowState(false);
7678                 __pSettingLine->SetShowState(false);
7679
7680                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
7681                 {
7682                         CameraApp* pApp = static_cast<CameraApp*>(UiApp::GetInstance());
7683                         const IMap* pArguments = pApp->GetAppControlArguments();
7684                         if (pArguments == null)
7685                         {
7686                                 AppLogDebug("pArguments is null");
7687                                 if (__pCameraIconLabel)
7688                                 {
7689                                         __pCameraIconLabel->SetShowState(false);
7690                                 }
7691
7692                                 if (__pCamcoderIconLabel)
7693                                 {
7694                                         __pCamcoderIconLabel->SetShowState(false);
7695                                 }
7696
7697                                 if (__pSwButton)
7698                                 {
7699                                         __pSwButton->SetShowState(false);
7700                                 }
7701                         }
7702                         else
7703                         {
7704                                 const String* pAllowSwitch = static_cast<const String*>(pArguments->GetValue(String(ALLOW_SWITCH)));
7705                                 if (pAllowSwitch->Equals(ALLOW_SWITCH_TRUE, false) == true)
7706                                 {
7707                                         if (__isTimerRunning)
7708                                         {
7709                                                 if (__pCameraIconLabel)
7710                                                 {
7711                                                         __pCameraIconLabel->SetShowState(false);
7712                                                 }
7713
7714                                                 if (__pCamcoderIconLabel)
7715                                                 {
7716                                                         __pCamcoderIconLabel->SetShowState(false);
7717                                                 }
7718
7719                                                 if (__pSwButton)
7720                                                 {
7721                                                         __pSwButton->SetShowState(false);
7722                                                 }
7723                                         }
7724                                         else
7725                                         {
7726                                                 if (__pCameraIconLabel)
7727                                                 {
7728                                                         __pCameraIconLabel->SetShowState(true);
7729                                                 }
7730
7731                                                 if (__pCamcoderIconLabel)
7732                                                 {
7733                                                         __pCamcoderIconLabel->SetShowState(true);
7734                                                 }
7735
7736                                                 if (__pSwButton)
7737                                                 {
7738                                                         __pSwButton->SetShowState(true);
7739                                                 }
7740                                         }
7741                                 }
7742                                 else
7743                                 {
7744                                         AppLogDebug("ALLOW_SWITCH_FALSE");
7745                                         if (__pCameraIconLabel)
7746                                         {
7747                                                 __pCameraIconLabel->SetShowState(false);
7748                                         }
7749
7750                                         if (__pCamcoderIconLabel)
7751                                         {
7752                                                 __pCamcoderIconLabel->SetShowState(false);
7753                                         }
7754
7755                                         if (__pSwButton)
7756                                         {
7757                                                 __pSwButton->SetShowState(false);
7758                                         }
7759                                 }
7760                         }
7761                 }
7762                 else
7763                 {
7764                         if (__isTimerRunning)
7765                         {
7766                                 __pCameraIconLabel->SetShowState(false);
7767                                 __pCamcoderIconLabel->SetShowState(false);
7768                                 __pSwButton->SetShowState(false);
7769                         }
7770                         else
7771                         {
7772                                 __pCameraIconLabel->SetShowState(true);
7773                                 __pCamcoderIconLabel->SetShowState(true);
7774                                 __pSwButton->SetShowState(true);
7775                         }
7776                 }
7777         
7778
7779                 _pQuickSettingButton->SetShowState(false);
7780                 _pWhiteBalanceButton->SetShowState(false);
7781                 _pExposureValueButton->SetShowState(false);
7782                 _pCloseButton->SetShowState(false);
7783                 __pShutterButton->SetShowState(false);
7784                 __pThumbnailButton->SetShowState(false);
7785                 _pThumbnailPanel->SetShowState(false);
7786
7787                 if (__screenMode == SCREEN_MODE_NORMAL)
7788                 {
7789                         __pSettingPanel->SetBackgroundColor(COLOR_PANEL_BACKGROUND_BLACK);
7790                         __pActionPanel->SetBackgroundColor(COLOR_PANEL_BACKGROUND_BLACK);
7791                 }
7792         }
7793         else
7794         {
7795                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
7796                 {
7797                         if (__pThumbnailButton)
7798                         {
7799                                 if (IsControlAlwaysOnTop(__pThumbnailButton) == true)
7800                                 {
7801                                         AppLogDebug("IsControlAlwaysOnTop __pThumbnailButton");
7802                                         SetControlAlwaysOnTop(*__pThumbnailButton, false);
7803                                 }
7804                         }
7805
7806                         if (_pThumbnailPanel)
7807                         {
7808                                 if (IsControlAlwaysOnTop(_pThumbnailPanel) == true)
7809                                 {
7810                                         AppLogDebug("IsControlAlwaysOnTop _pThumbnailPanel");
7811                                         SetControlAlwaysOnTop(*_pThumbnailPanel, false);
7812                                 }
7813                         }
7814                 }
7815                 _pFlashButton->SetShowState(false);
7816                 _pSelfShotButton->SetShowState(true);
7817                 _pSettingButton->SetShowState(true);
7818                 __pSettingLine->SetShowState(true);
7819                 _pQuickSettingButton->SetShowState(false);
7820                 _pWhiteBalanceButton->SetShowState(false);
7821                 _pExposureValueButton->SetShowState(false);
7822                 _pCloseButton->SetShowState(false);
7823
7824                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
7825                 {
7826                         AppControlRequestHideButton();
7827                 }
7828                 else
7829                 {
7830                         __pCameraIconLabel->SetShowState(true);
7831                         __pCamcoderIconLabel->SetShowState(true);
7832                         __pSwButton->SetShowState(true);
7833                 }
7834         
7835                 __pShutterButton->SetShowState(true);
7836                 __pThumbnailButton->SetShowState(true);
7837                 _pThumbnailPanel->SetShowState(true);
7838
7839                 if (__screenMode == SCREEN_MODE_NORMAL)
7840                 {
7841                         __pSettingPanel->SetBackgroundColor(COLOR_PANEL_BACKGROUND_GRAY);
7842                         __pActionPanel->SetBackgroundColor(COLOR_PANEL_BACKGROUND_GRAY);
7843                 }
7844         }
7845
7846         if (__screenMode == SCREEN_MODE_FULL)
7847         {
7848                 Invalidate(true);
7849         }
7850         else
7851         {
7852                 Draw();
7853                 Show();
7854         }
7855         AppLogDebug("EXIT");
7856 }
7857
7858 void
7859 CameraForm::HideUiSettingMenu(void)
7860 {
7861         AppLogDebug("ENTER");
7862         if (_pCameraInfoPanel)
7863         {
7864                 _pCameraInfoPanel->SetDrawExposure(false);
7865                 _pCameraInfoPanel->SetDrawWhiteBalanceBackground(false);
7866                 _pCameraInfoPanel->SetDrawFlashMenuBackground(false);
7867                 _pCameraInfoPanel->SetDrawSettingMenuBackground(false);
7868                 _pCameraInfoPanel->SetGeneralDrawSettingMenuBackground(false);
7869         }
7870
7871         if (_pListViewCameraTabSubMenu)
7872         {
7873                 if (_pCameraInfoSubPanel != null)
7874                 {
7875                   _pCameraInfoSubPanel->SetShowState(false);
7876                 }
7877
7878                 _pListViewCameraTabSubMenu->SetShowState(false);
7879         }
7880
7881         if (_pListViewCameraTabMainMenu)
7882         {
7883                 _pListViewCameraTabMainMenu->SetShowState(false);
7884         }
7885
7886         if (_pListFlashMainMenu)
7887         {
7888                 _pListFlashMainMenu->SetShowState(false);
7889         }
7890
7891         if (_pListWbMainMenu)
7892         {
7893                 _pListWbMainMenu->SetShowState(false);
7894         }
7895
7896         if (_pListViewGeneralTabSubMenu)
7897         {
7898                 if (_pCameraInfoGeneralSubPanel != null)
7899                 {
7900                         _pCameraInfoGeneralSubPanel->SetShowState(false);
7901                 }
7902                 _pListViewGeneralTabSubMenu->SetShowState(false);
7903         }
7904
7905         if (_pListViewGeneralTabMainMenu)
7906         {
7907                 _pListViewGeneralTabMainMenu->SetShowState(false);
7908         }
7909         AppLogDebug("EXIT");
7910 }
7911
7912 void
7913 CameraForm::HideUiQuickMenu(void)
7914 {
7915         AppLogDebug("ENTER");
7916         if (_pSelfShotButton != null)
7917         {
7918                 _pSelfShotButton->SetShowState(true);
7919                 _pSelfShotButton->Invalidate(true);
7920         }
7921
7922         if (_pSettingButton != null)
7923         {
7924                 _pSettingButton->SetShowState(true);
7925                 _pSettingButton->Invalidate(true);
7926         }
7927
7928         if (__pSettingLine != null)
7929         {
7930                 __pSettingLine->SetShowState(true);
7931                 __pSettingLine->Invalidate(true);
7932         }
7933
7934         if (_pCameraInfoPanel != null)
7935         {
7936                 _pCameraInfoPanel->SetDrawIndicator(true);
7937                 _pCameraInfoPanel->Invalidate(true);
7938         }
7939
7940         if (_pFlashButton != null)
7941         {
7942                 _pFlashButton->SetShowState(false);
7943                 _pFlashButton->Invalidate(true);
7944         }
7945
7946         if (_pQuickSettingButton != null)
7947         {
7948                 _pQuickSettingButton->SetShowState(false);
7949                 _pQuickSettingButton->Invalidate(true);
7950         }
7951
7952         if (_pWhiteBalanceButton != null)
7953         {
7954                 _pWhiteBalanceButton->SetShowState(false);
7955                 _pWhiteBalanceButton->Invalidate(true);
7956         }
7957
7958         if (_pExposureValueButton != null)
7959         {
7960                 _pExposureValueButton->SetShowState(false);
7961                 _pExposureValueButton->Invalidate(true);
7962         }
7963
7964         if (_pCloseButton != null)
7965         {
7966                 _pCloseButton->SetShowState(false);
7967                 _pCloseButton->Invalidate(true);
7968         }
7969         AppLogDebug("EXIT");
7970 }
7971
7972 void
7973 CameraForm::ShowUiQuickMenu(void)
7974 {
7975         AppLogDebug("ENTER");
7976         if (_pCameraInfoPanel != null)
7977         {
7978                 _pCameraInfoPanel->SetDrawIndicator(false);
7979                 _pCameraInfoPanel->Invalidate(true);
7980         }
7981
7982         if (_pSelfShotButton != null)
7983         {
7984                 _pSelfShotButton->SetShowState(false);
7985                 _pSelfShotButton->Invalidate(true);
7986         }
7987
7988         if (_pSettingButton != null)
7989         {
7990                 _pSettingButton->SetShowState(false);
7991                 _pSettingButton->Invalidate(true);
7992         }
7993
7994         if (__pSettingLine != null)
7995         {
7996                 __pSettingLine->SetShowState(false);
7997                 __pSettingLine->Invalidate(true);
7998         }
7999
8000         if (_pFlashButton != null)
8001         {
8002                 _pFlashButton->SetShowState(true);
8003                 _pFlashButton->Invalidate(true);
8004         }
8005
8006         if (_pQuickSettingButton != null)
8007         {
8008                 _pQuickSettingButton->SetShowState(true);
8009                 _pQuickSettingButton->Invalidate(true);
8010         }
8011
8012         if (_pWhiteBalanceButton != null)
8013         {
8014                 _pWhiteBalanceButton->SetShowState(true);
8015                 _pWhiteBalanceButton->Invalidate(true);
8016         }
8017
8018         if (_pExposureValueButton != null)
8019         {
8020                 _pExposureValueButton->SetShowState(true);
8021                 _pExposureValueButton->Invalidate(true);
8022         }
8023
8024         if (_pCloseButton != null)
8025         {
8026                 _pCloseButton->SetShowState(true);
8027                 _pCloseButton->Invalidate(true);
8028         }
8029         AppLogDebug("EXIT");
8030 }
8031
8032 void 
8033 CameraForm::SetCameraMode(bool isWideMode)
8034 {
8035         AppLogDebug("ENTER");
8036         result r = E_SUCCESS;
8037         Dimension normalMode(PREVIEW_RESOLOTION_WIDTH, PREVIEW_RESOLOTION_HEIGHT);
8038         Dimension resolutionDim;
8039         Dimension captureResolutionDim;
8040         IList* pList = null;
8041         int previewResolutionSize = 0;
8042         int resolutionCnt = 0;
8043         int resolutionRatio = 0;
8044         int index = 0;
8045         int tempResolutionIndex = 0;
8046         int count = 0;
8047         int selfPortraitEnable = 0;
8048         BufferInfo bufferinfo;
8049
8050         r = _pCameraPresentationModel->SetMode(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
8051         TryReturnVoid(r == E_SUCCESS, "SetMode() failed:%s", GetErrorMessage(r));
8052
8053         if (isWideMode == true)
8054         {
8055                 pList = _pCameraPresentationModel->GetPreviewResolutionList();
8056
8057                 if (pList)
8058                 {
8059                         resolutionCnt = pList->GetCount();
8060
8061                         if (resolutionCnt > 0)
8062                         {
8063                                 for (index = 0; index < resolutionCnt; index++)
8064                                 {
8065                                         resolutionDim = *(static_cast<Dimension*>(pList->GetAt(index)));
8066
8067                                         resolutionRatio = (resolutionDim.width * MULTIPLY_BY_TEN) / (resolutionDim.height);
8068
8069                                         if (resolutionRatio > NORMAL_MODE_RATIO)
8070                                         {
8071                                                 count++;
8072                                         }
8073                                 }
8074                         }
8075
8076                         resolutionDim = *(static_cast<Dimension*>(pList->GetAt(count - INDEX_UNIT_ONE)));
8077                         __previewResolutionWidth = resolutionDim.width;
8078                         __previewResolutionHeight = resolutionDim.height;
8079                 }
8080                 else
8081                 {
8082                         __previewResolutionWidth = PREVIEW_RESOLOTION_WIDTH;
8083                         __previewResolutionHeight = PREVIEW_RESOLOTION_HEIGHT;
8084                 }
8085
8086                 AppLogDebug("Wide Mode W[%d] x H[%d]", resolutionDim.width, resolutionDim.height);
8087
8088                 _pCameraPresentationModel->SetPreviewResolution(resolutionDim);
8089         }
8090         else
8091         {
8092                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
8093                 TryReturnVoid(r == E_SUCCESS, "Faled to set value to registry[%s]", GetErrorMessage(r));
8094
8095                 _pCameraPresentationModel->SetPreviewResolution(normalMode);
8096
8097                 __previewResolutionWidth = normalMode.width;
8098                 __previewResolutionHeight = normalMode.height;
8099
8100                 AppLogDebug("Normal Mode W[%d] x H[%d]", normalMode.width, normalMode.height);
8101
8102                 if (__isToggleCameraDirection)
8103                 {
8104                         pList = _pCameraPresentationModel->GetPreviewResolutionList();
8105
8106                         resolutionCnt = pList->GetCount();
8107
8108                         AppLogDebug("pList resolutionCnt = %d", resolutionCnt);
8109
8110                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
8111                         {
8112                                 captureResolutionDim.width = __captureResolutionWidth;
8113
8114                                 captureResolutionDim.height = __captureResolutionHeight;
8115
8116                                 if (resolutionCnt > 0)
8117                                 {
8118                                         for (index = 0; index < resolutionCnt; index++)
8119                                         {
8120                                                 resolutionDim = *(static_cast<Dimension*>(pList->GetAt(index)));
8121
8122                                                 if (resolutionDim == captureResolutionDim)
8123                                                 {
8124                                                         tempResolutionIndex = index;
8125
8126                                                         AppLogDebug("primary captureResolutionDim == W:%d H:%d for index = %d", resolutionDim.width, resolutionDim.height, index);
8127                                                 }
8128                                         }
8129
8130                                         __primaryCurrentResolutionIndex = resolutionCnt - tempResolutionIndex;
8131                                 }
8132
8133                                 AppLogDebug("__primaryCurrentResolutionIndex = %d", __primaryCurrentResolutionIndex);
8134                         }
8135                         else
8136                         {
8137                                 captureResolutionDim = _pCameraPresentationModel->GetCaptureResolution();
8138                                 __captureResolutionWidth = captureResolutionDim.width;
8139                                 __captureResolutionHeight = captureResolutionDim.height;
8140
8141                                 AppLogDebug("secondary captureResolutionDim : w->%d x h->%d", captureResolutionDim.width, captureResolutionDim.height);
8142                         }
8143                 }
8144         }
8145
8146         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
8147         TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
8148
8149         _pCameraPresentationModel->StartPreview(&bufferinfo);
8150
8151         _pCameraPresentationModel->SetContinuousAutoFocus();
8152
8153         previewResolutionSize = __previewResolutionWidth * __previewResolutionHeight;
8154
8155         _pCameraInfoPanel->SetPreviewResolutionSize(previewResolutionSize);
8156         AppLogDebug("EXIT");
8157 }
8158
8159 void
8160 CameraForm::SetOverlayRendererRotation(void)
8161 {
8162         AppLogDebug("ENTER");
8163         TryReturnVoid(__pOverlayPanel != null, "__pOverlayPanel is null");
8164
8165         switch (__dir)
8166         {
8167         case ORIENTATION_STATUS_PORTRAIT:
8168                 {
8169                         AppLogDebug("ORIENTATION_STATUS_PORTRAIT");
8170                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_90);
8171                 }
8172                 break;
8173
8174         case ORIENTATION_STATUS_PORTRAIT_REVERSE:
8175                 {
8176                         AppLogDebug("ORIENTATION_STATUS_PORTRAIT_REVERSE");
8177                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_270);
8178                 }
8179                 break;
8180
8181         case ORIENTATION_STATUS_LANDSCAPE:
8182                 {
8183                         AppLogDebug("ORIENTATION_STATUS_LANDSCAPE");
8184                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_NONE);
8185                 }
8186                 break;
8187
8188         case ORIENTATION_STATUS_LANDSCAPE_REVERSE:
8189                 {
8190                         AppLogDebug("ORIENTATION_STATUS_LANDSCAPE_REVERSE");
8191                         __pOverlayPanel->SetRendererRotation(__pOverlayPanel->ROTATION_180);
8192                 }
8193                 break;
8194
8195         default:
8196                 break;
8197         }
8198         AppLogDebug("EXIT");
8199 }
8200
8201 result
8202 CameraForm::CreateOverlayRegion(Rectangle rect)
8203 {
8204         AppLogDebug("ENTER");
8205         result r = E_SUCCESS;
8206
8207         __pOverlayPanel = new (std::nothrow) OverlayPanel();
8208         r = __pOverlayPanel->Construct(rect);
8209         TryCatch(r == E_SUCCESS, , "pOverlayPanel->Construct() failed:%s", GetErrorMessage(r));
8210         //AppLogDebug("pOverlayPanel->Construct() [%s]", GetErrorMessage(r));
8211
8212         r = AddControl(__pOverlayPanel);
8213         //TryCatch(r == E_SUCCESS, , "AddControl(__pOverlayPanel) failed:%s", GetErrorMessage(r));
8214         AppLogDebug("CreateOverlayRegion::AddControl() [%s]", GetErrorMessage(r));
8215
8216         __pOverlayPanel->AddTouchEventListener(*this);
8217
8218         AppLogDebug("EXIT");
8219         return r;
8220
8221 CATCH:
8222         RemoveControl(__pOverlayPanel);
8223         __pOverlayPanel = null;
8224         AppLogDebug("EXIT - CATCH");
8225         return r;
8226 }
8227
8228 result
8229 CameraForm::SetOverlayPanel(Rectangle rect, Rectangle evaluateBoundsRect, Rectangle clientRect, bool destroyOverlay, bool isWideMode)
8230 {
8231         AppLogDebug("ENTER");
8232         bool modified = false;
8233         bool isValidRect = false;
8234         Dimension dim = Dimension(0, 0);        
8235         bool isToCompensated = false;
8236         Dimension dimRendererSize;
8237         result r = E_SUCCESS;
8238
8239         if (destroyOverlay == true)
8240         {
8241                 if (__pOverlayPanel)
8242                 {
8243                         __pOverlayPanel->RemoveTouchEventListener(*this);
8244                         RemoveControl(__pOverlayPanel);
8245                         __pOverlayPanel = null;
8246                 }
8247
8248                 AppLogDebug("Client area rect (%d, %d, %d, %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
8249                 AppLogDebug("Input EvaluateBounds (%d, %d, %d, %d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
8250
8251                 if (isWideMode == false)
8252                 {
8253                         isValidRect = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN, evaluateBoundsRect, modified);
8254                         r = GetLastResult();
8255                 }
8256                 else
8257                 {
8258                         isValidRect = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, evaluateBoundsRect, modified);
8259                         r = GetLastResult();
8260                 }
8261                 TryReturn(isValidRect == true, null, "OverlayRegion::EvaluateBounds returned error[%s]", GetErrorMessage(GetLastResult()));
8262                 TryReturn(r == E_SUCCESS, null, "OverlayRegion::EvaluateBounds returned error[%s]", GetErrorMessage(r));
8263
8264                 if (modified == true)
8265                 {
8266                         AppLogDebug("OverlayRegion::EvaluateBounds is modified to (%d,%d,%d,%d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
8267                 }
8268
8269                 if (__dir == ORIENTATION_STATUS_PORTRAIT
8270                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
8271                 {
8272                         if (evaluateBoundsRect.height == rect.height)
8273                         {
8274                                 isToCompensated = false;
8275                         }
8276                         else
8277                         {
8278                                 isToCompensated = true;
8279                         }
8280                 }
8281                 else
8282                 {
8283                         if (evaluateBoundsRect.width == rect.width)
8284                         {
8285                                 isToCompensated = false;
8286                         }
8287                         else
8288                         {
8289                                 isToCompensated = true;
8290                         }
8291                 }
8292
8293                 r = CreateOverlayRegion(rect);
8294                 AppLogDebug("CreateOverlayRegion() [%s]", GetErrorMessage(r));
8295
8296                 if (isToCompensated == true)
8297                 {
8298                         AppLogDebug("isToCompensated = true");
8299
8300                         rect = __pOverlayPanel->GetBounds();
8301                         AppLogDebug("__pOverlayPanel->GetBounds area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
8302
8303                         r = __pOverlayPanel->SetBounds(rect);
8304                         AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
8305                 }
8306
8307                 dimRendererSize = __pOverlayPanel->GetSize();
8308                 AppLogDebug("__pOverlayPanel->GetSize() area rect (%d, %d)", dimRendererSize.width, dimRendererSize.height);
8309
8310                 __pOverlayPanel->SetRenderSize(dimRendererSize);
8311         }
8312         else
8313         {
8314                 TryCatch(__pOverlayPanel != null, , "__pOverlayPanel is null");
8315
8316                 AppLogDebug("Client area rect (%d, %d, %d, %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
8317                 AppLogDebug("Input EvaluateBounds (%d, %d, %d, %d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
8318
8319                 isValidRect = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN, evaluateBoundsRect, modified);
8320                 TryReturn(isValidRect == true, null, "OverlayRegion::EvaluateBounds returned error[%s]", GetErrorMessage(GetLastResult()));
8321
8322                 if (modified == true)
8323                 {
8324                         AppLogDebug("OverlayRegion::EvaluateBounds is modified to (%d,%d,%d,%d)", evaluateBoundsRect.x, evaluateBoundsRect.y, evaluateBoundsRect.width, evaluateBoundsRect.height);
8325                 }
8326
8327                 if (__dir == ORIENTATION_STATUS_PORTRAIT
8328                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
8329                 {
8330                         if (evaluateBoundsRect.height == rect.height)
8331                         {
8332                                 isToCompensated = false;
8333                         }
8334                         else
8335                         {
8336                                 isToCompensated = true;
8337                         }
8338                 }
8339                 else
8340                 {
8341                         if (evaluateBoundsRect.width == rect.width)
8342                         {
8343                                 isToCompensated = false;
8344                         }
8345                         else
8346                         {
8347                                 isToCompensated = true;
8348                         }
8349                 }
8350
8351                 r = __pOverlayPanel->SetBounds(rect);
8352                 AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
8353                 AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
8354
8355                 if (isToCompensated == true)
8356                 {
8357                         rect = __pOverlayPanel->GetBounds();
8358                         AppLogDebug("__pOverlayPanel GetBounds area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
8359
8360                         r = __pOverlayPanel->SetBounds(rect);
8361                         AppLogDebug("pOverlayPanel->SetBounds() [%s]", GetErrorMessage(r));
8362                         AppLogDebug("__pOverlayPanel->SetBounds() area rect (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
8363                 }
8364
8365                 dimRendererSize = __pOverlayPanel->GetSize();
8366                 AppLogDebug("__pOverlayPanel->GetSize() area rect (%d, %d)", dimRendererSize.width, dimRendererSize.height);
8367                 __pOverlayPanel->SetRenderSize(dimRendererSize);
8368         }
8369         AppLogDebug("EXIT");
8370         return r;
8371
8372 CATCH:
8373         RemoveControl(__pOverlayPanel);
8374         __pOverlayPanel = null;
8375         AppLogDebug("EXIT - CATCH");
8376         return r;
8377 }
8378
8379 void
8380 CameraForm::SetOverlayPanelNormalMode(bool isRemoved)
8381 {
8382         AppLogDebug("ENTER");
8383         result r = E_SUCCESS;
8384         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
8385         Rectangle evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
8386         Rectangle clientRect = GetClientAreaBounds();
8387
8388         if (__dir == ORIENTATION_STATUS_PORTRAIT
8389                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
8390         {
8391                 if (clientRect.height == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
8392                 {
8393                         evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
8394                         rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
8395                 }
8396                 else
8397                 {
8398                         evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
8399                         rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
8400                 }
8401         }
8402         else
8403         {
8404                 if (clientRect.width == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
8405                 {
8406                         evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
8407                         rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
8408                 }
8409                 else
8410                 {
8411                         evaluateBoundsRect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, H_PREVIEW_OVERLAY_LANDSCAPE);
8412                         rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, H_PREVIEW_OVERLAY_LANDSCAPE);
8413                 }
8414         }
8415
8416         r = SetOverlayPanel(rect, evaluateBoundsRect, clientRect, isRemoved, false);
8417         AppLogDebug("SetOverlayPanel() failed:%s", GetErrorMessage(r));
8418         AppLogDebug("EXIT");
8419 }
8420
8421 void
8422 CameraForm::SetOverlayPanelWideMode(bool isRemoved)
8423 {
8424         AppLogDebug("ENTER");
8425         result r = E_SUCCESS;
8426         Rectangle evaluateBoundsRect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
8427         Rectangle rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
8428         Rectangle clientRect = GetClientAreaBounds();
8429
8430         if (__dir == ORIENTATION_STATUS_PORTRAIT
8431                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
8432         {
8433                 if (clientRect.height == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
8434                 {
8435                         rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
8436                 }
8437                 else
8438                 {
8439                         rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN);
8440                 }
8441         }
8442         else
8443         {
8444                 if (clientRect.width == (CAMERA_PANEL_SUM_SIZE + PREVIEW_OVERLAY_PANEL_SIZE))
8445                 {
8446                         rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width, GetClientAreaBounds().height);
8447                 }
8448                 else
8449                 {
8450                         rect = Rectangle(X_BASE_POS, Y_BASE_POS, GetClientAreaBounds().width - PREVIEW_OVERLAY_PANEL_SIZE_MARGIN, GetClientAreaBounds().height);
8451                 }
8452         }
8453
8454         r = SetOverlayPanel(rect, evaluateBoundsRect, clientRect, isRemoved, true);
8455         AppLogDebug("SetOverlayPanel() failed:%s", GetErrorMessage(r));
8456         AppLogDebug("EXIT");
8457 }
8458
8459 void
8460 CameraForm::SetControlAlwaysOnTopPanel(void)
8461 {
8462         AppLogDebug("ENTER");
8463         if (__pSettingPanel)
8464         {
8465                 if (IsControlAlwaysOnTop(__pSettingPanel) == false)
8466                 {
8467                         AppLogDebug("IsControlAlwaysOnTop __pSettingPanel");
8468                         SetControlAlwaysOnTop(*__pSettingPanel, true);
8469                 }
8470         }
8471
8472         if (__pActionPanel)
8473         {
8474                 if (IsControlAlwaysOnTop(__pActionPanel) == false)
8475                 {
8476                         AppLogDebug("IsControlAlwaysOnTop __pActionPanel");
8477                         SetControlAlwaysOnTop(*__pActionPanel, true);
8478                 }
8479         }
8480
8481         if (_pFlashButton)
8482         {
8483                 if (IsControlAlwaysOnTop(_pFlashButton) == false)
8484                 {
8485                         AppLogDebug("IsControlAlwaysOnTop _pFlashButton");
8486                         SetControlAlwaysOnTop(*_pFlashButton, true);
8487                 }
8488         }
8489
8490         if (_pSelfShotButton)
8491         {
8492                 if (IsControlAlwaysOnTop(_pSelfShotButton) == false)
8493                 {
8494                         AppLogDebug("IsControlAlwaysOnTop _pSelfShotButton");
8495                         SetControlAlwaysOnTop(*_pSelfShotButton, true);
8496                 }
8497         }
8498
8499         if (_pSettingButton)
8500         {
8501                 if (IsControlAlwaysOnTop(_pSettingButton) == false)
8502                 {
8503                         AppLogDebug("IsControlAlwaysOnTop _pSettingButton");
8504                         SetControlAlwaysOnTop(*_pSettingButton, true);
8505                 }
8506         }
8507
8508         if (__pSettingLine)
8509         {
8510                 if (IsControlAlwaysOnTop(__pSettingLine) == false)
8511                 {
8512                         AppLogDebug("IsControlAlwaysOnTop __pSettingLine");
8513                         SetControlAlwaysOnTop(*__pSettingLine, true);
8514                 }
8515         }
8516
8517         if (__pCameraIconLabel)
8518         {
8519                 if (IsControlAlwaysOnTop(__pCameraIconLabel) == false)
8520                 {
8521                         AppLogDebug("IsControlAlwaysOnTop _pSelfShotButton");
8522                         SetControlAlwaysOnTop(*__pCameraIconLabel, true);
8523                 }
8524         }
8525
8526         if (__pCamcoderIconLabel)
8527         {
8528                 if (IsControlAlwaysOnTop(__pCamcoderIconLabel) == false)
8529                 {
8530                         AppLogDebug("IsControlAlwaysOnTop __pCamcoderIconLabel");
8531                         SetControlAlwaysOnTop(*__pCamcoderIconLabel, true);
8532                 }
8533         }
8534
8535         if (_pQuickSettingButton)
8536         {
8537                 if (IsControlAlwaysOnTop(_pQuickSettingButton) == false)
8538                 {
8539                         AppLogDebug("IsControlAlwaysOnTop _pQuickSettingButton");
8540                         SetControlAlwaysOnTop(*_pQuickSettingButton, true);
8541                 }
8542         }
8543
8544         if (_pWhiteBalanceButton)
8545         {
8546                 if (IsControlAlwaysOnTop(_pWhiteBalanceButton) == false)
8547                 {
8548                         AppLogDebug("IsControlAlwaysOnTop _pWhiteBalanceButton");
8549                         SetControlAlwaysOnTop(*_pWhiteBalanceButton, true);
8550                 }
8551         }
8552
8553         if (_pExposureValueButton)
8554         {
8555                 if (IsControlAlwaysOnTop(_pExposureValueButton) == false)
8556                 {
8557                         AppLogDebug("IsControlAlwaysOnTop _pExposureValueButton");
8558                         SetControlAlwaysOnTop(*_pExposureValueButton, true);
8559                 }
8560         }
8561
8562         if (_pCloseButton)
8563         {
8564                 if (IsControlAlwaysOnTop(_pCloseButton) == false)
8565                 {
8566                         AppLogDebug("IsControlAlwaysOnTop _pCloseButton");
8567                         SetControlAlwaysOnTop(*_pCloseButton, true);
8568                 }
8569         }
8570
8571         if (__pBatteryState)
8572         {
8573                 if (IsControlAlwaysOnTop(__pBatteryState) == false)
8574                 {
8575                         AppLogDebug("IsControlAlwaysOnTop __pBatteryState");
8576                         SetControlAlwaysOnTop(*__pBatteryState, true);
8577                 }
8578         }
8579
8580         if (__pSwButton)
8581         {
8582                 if (IsControlAlwaysOnTop(__pSwButton) == false)
8583                 {
8584                         AppLogDebug("IsControlAlwaysOnTop __pSwButton");
8585                         SetControlAlwaysOnTop(*__pSwButton, true);
8586                 }
8587         }
8588
8589
8590         if (__pShutterButton)
8591         {
8592                 if (IsControlAlwaysOnTop(__pShutterButton) == false)
8593                 {
8594                         AppLogDebug("IsControlAlwaysOnTop __pShutterButton");
8595                         SetControlAlwaysOnTop(*__pShutterButton, true);
8596                 }
8597         }
8598
8599         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
8600         {
8601                 if (__pThumbnailButton)
8602                 {
8603                         if (IsControlAlwaysOnTop(__pThumbnailButton) == true)
8604                         {
8605                                 AppLogDebug("IsControlAlwaysOnTop __pThumbnailButton");
8606                                 SetControlAlwaysOnTop(*__pThumbnailButton, false);
8607                         }
8608                 }
8609
8610                 if (_pThumbnailPanel)
8611                 {
8612                         if (IsControlAlwaysOnTop(_pThumbnailPanel) == true)
8613                         {
8614                                 AppLogDebug("IsControlAlwaysOnTop _pThumbnailPanel");
8615                                 SetControlAlwaysOnTop(*_pThumbnailPanel, false);
8616                         }
8617                 }
8618         }
8619         else
8620         {
8621                 if (__pThumbnailButton)
8622                 {
8623                         if (IsControlAlwaysOnTop(__pThumbnailButton) == false)
8624                         {
8625                                 AppLogDebug("IsControlAlwaysOnTop __pThumbnailButton");
8626                                 SetControlAlwaysOnTop(*__pThumbnailButton, true);
8627                         }
8628                 }
8629
8630                 if (_pThumbnailPanel)
8631                 {
8632                         if (IsControlAlwaysOnTop(_pThumbnailPanel) == false)
8633                         {
8634                                 AppLogDebug("IsControlAlwaysOnTop _pThumbnailPanel");
8635                                 SetControlAlwaysOnTop(*_pThumbnailPanel, true);
8636                         }
8637                 }
8638         }
8639
8640         if (_pHelpGoToGallery)
8641         {
8642                 if (IsControlAlwaysOnTop(_pHelpGoToGallery) == false)
8643                 {
8644                         AppLogDebug("IsControlAlwaysOnTop _pHelpGoToGallery");
8645                         SetControlAlwaysOnTop(*_pHelpGoToGallery, true);
8646                 }
8647         }
8648
8649         if (_pHelpGoToGalleryText)
8650         {
8651                 if (IsControlAlwaysOnTop(_pHelpGoToGalleryText) == false)
8652                 {
8653                         AppLogDebug("IsControlAlwaysOnTop _pHelpGoToGalleryText");
8654                         SetControlAlwaysOnTop(*_pHelpGoToGalleryText, true);
8655                 }
8656         }
8657
8658         if (_pHelpSwitchCamera)
8659         {
8660                 if (IsControlAlwaysOnTop(_pHelpSwitchCamera) == false)
8661                 {
8662                         AppLogDebug("IsControlAlwaysOnTop _pHelpSwitchCamera");
8663                         SetControlAlwaysOnTop(*_pHelpSwitchCamera, true);
8664                 }
8665         }
8666
8667         if (_pHelpSwitchCameraText)
8668         {
8669                 if (IsControlAlwaysOnTop(_pHelpSwitchCameraText) == false)
8670                 {
8671                         AppLogDebug("IsControlAlwaysOnTop _pHelpSwitchCameraText");
8672                         SetControlAlwaysOnTop(*_pHelpSwitchCameraText, true);
8673                 }
8674         }
8675
8676         if (_pHelpQuickSetting)
8677         {
8678                 if (IsControlAlwaysOnTop(_pHelpQuickSetting) == false)
8679                 {
8680                         AppLogDebug("IsControlAlwaysOnTop _pHelpQuickSetting");
8681                         SetControlAlwaysOnTop(*_pHelpQuickSetting, true);
8682                 }
8683         }
8684
8685         if (_pHelpQuickSettingText)
8686         {
8687                 if (IsControlAlwaysOnTop(_pHelpQuickSettingText) == false)
8688                 {
8689                         AppLogDebug("IsControlAlwaysOnTop _pHelpQuickSettingText");
8690                         SetControlAlwaysOnTop(*_pHelpQuickSettingText, true);
8691                 }
8692         }
8693
8694         if (_pHelpRecordVideo)
8695         {
8696                 if (IsControlAlwaysOnTop(_pHelpRecordVideo) == false)
8697                 {
8698                         AppLogDebug("IsControlAlwaysOnTop _pHelpRecordVideo");
8699                         SetControlAlwaysOnTop(*_pHelpRecordVideo, true);
8700                 }
8701         }
8702
8703         if (_pHelpRecordVideoText)
8704         {
8705                 if (IsControlAlwaysOnTop(_pHelpRecordVideoText) == false)
8706                 {
8707                         AppLogDebug("IsControlAlwaysOnTop _pHelpRecordVideoText");
8708                         SetControlAlwaysOnTop(*_pHelpRecordVideoText, true);
8709                 }
8710         }
8711
8712         if (_pHelpShutter)
8713         {
8714                 if (IsControlAlwaysOnTop(_pHelpShutter) == false)
8715                 {
8716                         AppLogDebug("IsControlAlwaysOnTop _pHelpShutter");
8717                         SetControlAlwaysOnTop(*_pHelpShutter, true);
8718                 }
8719         }
8720
8721         if (_pHelpShutterText)
8722         {
8723                 if (IsControlAlwaysOnTop(_pHelpShutterText) == false)
8724                 {
8725                         AppLogDebug("IsControlAlwaysOnTop _pHelpShutterText");
8726                         SetControlAlwaysOnTop(*_pHelpShutterText, true);
8727                 }
8728         }
8729
8730         if (__pCameraSetting)
8731         {
8732                 if (IsControlAlwaysOnTop(__pCameraSetting) == false)
8733                 {
8734                         AppLogDebug("IsControlAlwaysOnTop __pCameraSetting");
8735                         SetControlAlwaysOnTop(*__pCameraSetting, true);
8736                 }
8737         }
8738
8739         if (__pCameraSettingLable)
8740         {
8741                 if (IsControlAlwaysOnTop(__pCameraSettingLable) == false)
8742                 {
8743                         AppLogDebug("IsControlAlwaysOnTop __pCameraSettingLable");
8744                         SetControlAlwaysOnTop(*__pCameraSettingLable, true);
8745                 }
8746         }
8747
8748         if (__pGeneralSetting)
8749         {
8750                 if (IsControlAlwaysOnTop(__pGeneralSetting) == false)
8751                 {
8752                         AppLogDebug("IsControlAlwaysOnTop __pGeneralSetting");
8753                         SetControlAlwaysOnTop(*__pGeneralSetting, true);
8754                 }
8755         }
8756
8757         if (__pGeneralSettingLable)
8758         {
8759                 if (IsControlAlwaysOnTop(__pGeneralSettingLable) == false)
8760                 {
8761                         AppLogDebug("IsControlAlwaysOnTop __pGeneralSettingLable");
8762                         SetControlAlwaysOnTop(*__pGeneralSettingLable, true);
8763                 }
8764         }
8765         AppLogDebug("EXIT");
8766 }
8767
8768 void
8769 CameraForm::HidePanel(bool isWideMode, bool isInvalidated)
8770 {
8771         AppLogDebug("ENTER");
8772         result r = E_SUCCESS;
8773
8774         SetControlAlwaysOnTopPanel();
8775
8776         if (isWideMode == true)
8777         {
8778                 AppLogDebug("Wide MODE");
8779
8780                 if (__pSettingPanel)
8781                 {
8782                         r = __pSettingPanel->SetShowState(false);
8783                         AppLogDebug("__pSettingPanel->SetShowState(false) fail[%s]", GetErrorMessage(r));
8784                 }
8785
8786                 if (__pActionPanel)
8787                 {
8788                         r = __pActionPanel->SetShowState(false);
8789                         AppLogDebug("__pActionPanel->SetShowState(false) fail[%s]", GetErrorMessage(r));
8790                 }
8791         }
8792         else
8793         {
8794                 AppLogDebug("Normal MODE");
8795
8796                 if (__pSettingPanel)
8797                 {
8798                         r = __pSettingPanel->SetShowState(true);
8799                         AppLogDebug("__pSettingPanel->SetShowState(false) fail[%s]", GetErrorMessage(r));
8800                 }
8801
8802                 if (__pActionPanel)
8803                 {
8804                         r = __pActionPanel->SetShowState(true);
8805                         AppLogDebug("__pActionPanel->SetShowState(false) fail[%s]", GetErrorMessage(r));
8806                 }
8807         }
8808
8809         if (isInvalidated == true)
8810         {
8811                 Invalidate(true);
8812         }
8813         else
8814         {
8815                 Draw();
8816                 Show();
8817         }
8818         AppLogDebug("EXIT");
8819 }
8820
8821 result
8822 CameraForm::SetScreenMode(const ScreenMode mode, bool destory)
8823 {
8824         AppLogDebug("ENTER");
8825         result r = E_SUCCESS;   
8826
8827         AppLogDebug("__screenMode[%d] mode[%d]", __screenMode, mode);
8828
8829         switch (mode)
8830         {
8831         case SCREEN_MODE_NORMAL:
8832                 {
8833                         if (destory == true)
8834                         {
8835                                 if (__screenMode != mode)
8836                                 {
8837                                         TryCatch(_pAppTimer != null, r = E_SYSTEM, "_pAppTimer is null");
8838                                         _pAppTimer->Cancel();
8839
8840                                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
8841                                         TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
8842
8843                                         _pCameraPresentationModel->KeepScreenOnState(true, false);
8844
8845                                         _pCameraPresentationModel->StopCamera();
8846                                 }
8847                                 else
8848                                 {
8849                                         if (__isToggleCameraDirection || __resolutionChange)
8850                                         {
8851                                                 TryCatch(_pAppTimer != null, r = E_SYSTEM, "_pAppTimer is null");
8852                                                 _pAppTimer->Cancel();
8853
8854                                                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
8855                                                 TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
8856
8857                                                 _pCameraPresentationModel->KeepScreenOnState(true, false);
8858
8859                                                 _pCameraPresentationModel->StopCamera();
8860                                         }
8861                                 }
8862
8863                                 SetOverlayPanelNormalMode(true);
8864
8865                                 SetOverlayRendererRotation();
8866
8867                                 if (__screenMode != mode)
8868                                 {
8869                                         SetCameraMode(false);
8870                                 }
8871                                 else
8872                                 {
8873                                         if (__isToggleCameraDirection || __resolutionChange)
8874                                         {
8875                                                 SetCameraMode(false);
8876                                         }
8877                                 }
8878
8879                                 __screenMode = SCREEN_MODE_NORMAL;
8880                         }
8881                         else
8882                         {
8883                                 SetOverlayPanelNormalMode(false);
8884
8885                                 SetOverlayRendererRotation();
8886
8887                                 __screenMode = SCREEN_MODE_NORMAL;
8888                         }
8889
8890                         if (__pOverlayPanel != null)
8891                         {
8892                                 __pOverlayPanel->RemoveTouchEventListener(*this);
8893                         }
8894
8895                         _pCameraInfoPanel->SetOverlayPanelMode(__screenMode);
8896                         HidePanel(false, false);
8897                 }
8898                 break;
8899
8900         case SCREEN_MODE_FULL:
8901                 {
8902                         if (destory == true)
8903                         {
8904                                 if (__screenMode != mode)
8905                                 {
8906                                         TryCatch(_pAppTimer != null, r = E_SYSTEM, "_pAppTimer is null");
8907                                         _pAppTimer->Cancel();
8908
8909                                         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
8910                                         TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
8911
8912                                         _pCameraPresentationModel->KeepScreenOnState(true, false);
8913
8914                                         _pCameraPresentationModel->StopCamera();
8915                                 }
8916                                 else
8917                                 {
8918                                         if (__isToggleCameraDirection || __resolutionChange)
8919                                         {
8920                                                 TryCatch(_pAppTimer != null, r = E_SYSTEM, "_pAppTimer is null");
8921                                                 _pAppTimer->Cancel();
8922
8923                                                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
8924                                                 TryCatch(r == E_SUCCESS, , "_pAppTimer start fail[%s]", GetErrorMessage(r));
8925
8926                                                 _pCameraPresentationModel->KeepScreenOnState(true, false);
8927
8928                                                 _pCameraPresentationModel->StopCamera();
8929                                         }
8930                                 }
8931
8932                                 SetOverlayPanelWideMode(true);
8933
8934                                 SetOverlayRendererRotation();
8935
8936                                 if (__screenMode != mode)
8937                                 {
8938                                         SetCameraMode(true);
8939                                 }
8940                                 else
8941                                 {
8942                                         if (__isToggleCameraDirection || __resolutionChange)
8943                                         {
8944                                                 SetCameraMode(true);
8945                                         }
8946                                 }
8947
8948                                 __screenMode = SCREEN_MODE_FULL;
8949                         }
8950                         else
8951                         {
8952                                 SetOverlayPanelWideMode(false);
8953
8954                                 SetOverlayRendererRotation();
8955
8956                                 __screenMode = SCREEN_MODE_FULL;
8957                         }
8958
8959                         if (__pOverlayPanel != null)
8960                         {
8961                                 __pOverlayPanel->AddTouchEventListener(*this);
8962                         }
8963
8964                         _pCameraInfoPanel->SetOverlayPanelMode(__screenMode);
8965                         HidePanel(true, false);
8966                 }
8967                 break;
8968
8969         default:
8970                 break;
8971         }
8972
8973         AppLogDebug("EXIT");
8974         return E_SUCCESS;
8975
8976 CATCH:
8977         _pCameraInfoPanel->SetOverlayPanelMode(SCREEN_MODE_NORMAL);
8978         __screenMode = SCREEN_MODE_NORMAL;
8979
8980         return r;
8981 }
8982
8983 result
8984 CameraForm::BackButtonPerformed(void)
8985 {
8986         AppLogDebug("ENTER");
8987         result r = E_SUCCESS;
8988
8989         if (_pHelpGoToGallery->GetShowState() == true)
8990         {
8991                 AppLogDebug("EXIT - Screen Overlay Help");
8992                 OnHelpCloseTimerExpired();
8993                 return E_SUCCESS;
8994         }
8995
8996         if (_pCameraPresentationModel->GetPreviewState() == false)
8997         {
8998                 AppLogDebug("EXIT - StartPreview do not call");
8999                 return E_SUCCESS;
9000         }
9001
9002         if (_pCameraInfoPanel->GetDrawExposure() == true)
9003         {
9004                 _closeTimerValue = 0;
9005
9006                 if (_pExposureCloseTimer)
9007                 {
9008                         _pExposureCloseTimer->Cancel();
9009                 }
9010
9011                 _pCameraInfoPanel->SetDrawExposure(false);
9012                 Invalidate(true);
9013         }
9014         else
9015         {
9016                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
9017                 {
9018                         r = PressBackButton();
9019                         TryCatch(r == E_SUCCESS, , "PressBackButton fail[%s]", GetErrorMessage(r));
9020                 }
9021                 else
9022                 {
9023                         if (__isTimerRunning == true)
9024                         {
9025                                 OnTimerCapturePause();
9026                                 UpdatePopUp();
9027                         }
9028                         else
9029                         {
9030                                 r = TerminateApp();
9031                                 TryCatch(r == E_SUCCESS, , "TerminateApp fail[%s]", GetErrorMessage(r));
9032                         }
9033                 }
9034         }
9035
9036         AppLogDebug("EXIT");
9037         return r;
9038
9039 CATCH:
9040         AppLogDebug("EXIT - CATCH");
9041         return r;
9042 }
9043
9044 result
9045 CameraForm::PressBackButton(void)
9046 {
9047         AppLogDebug("ENTER");
9048         result r = E_SUCCESS;
9049
9050         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
9051         {
9052                 AppLogDebug("PressBackButton >> Back to the App");
9053
9054                 if (_pCameraPresentationModel->GetCameraState()!= CAMERA_STATE_CAPTURED)
9055                 {
9056                         _pCameraPresentationModel->SetAppControlRequestType(CameraPresentationModel::APP_CONTROL_REQUEST_TYPE_CANCELED);
9057                 }
9058
9059                 r = TerminateApp();
9060                 AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
9061         }
9062
9063         AppLogDebug("EXIT");
9064         return r;
9065 }
9066
9067 void
9068 CameraForm::DrawTouchAutoFocus(const Tizen::Graphics::Point& currentPosition)
9069 {
9070         AppLogDebug("ENTER");
9071         result r = E_SUCCESS;
9072         bool focusSupport = false;
9073         int selfPortraitEnable = 0;
9074
9075         if (__isTimerRunning == false)
9076         {
9077                 AppLogDebug("__isTimerRunning:false");
9078
9079                 r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
9080                 TryReturnVoid(r == E_SUCCESS, "Reg getValue fail[%s]", GetErrorMessage(r));
9081
9082                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
9083                 {
9084                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FOCUS, focusSupport);
9085                 }
9086                 else
9087                 {
9088                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_FOCUS, focusSupport);
9089                 }
9090
9091                 if (focusSupport == true && r == E_SUCCESS)
9092                 {
9093                         _pCameraInfoPanel->SetDrawMarkerFocusType(CAMERA_FOCUS_NOT_READY);
9094                         _pCameraInfoPanel->SetCurrentPoint(currentPosition);
9095                         _pCameraInfoPanel->SetDrawMarkerFocus(true);
9096                         _pCameraInfoPanel->Invalidate(true);
9097                 }
9098                 else
9099                 {
9100                         _pCameraInfoPanel->SetDrawMarkerFocus(false);
9101                         _pCameraInfoPanel->Invalidate(true);
9102                 }
9103                 _pCameraPresentationModel->SetAutoFocusPoint(currentPosition);
9104         }
9105         else
9106         {
9107                 AppLogDebug("__isTimerRunning:true");
9108         }
9109         AppLogDebug("EXIT");
9110 }
9111
9112 void
9113 CameraForm::DoCapture(void)
9114 {
9115         AppLogDebug("ENTER");
9116         _pCameraPresentationModel->SetStorageCardChageState(CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN);
9117
9118         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
9119         _pAppTimer->Cancel();
9120
9121         if (_pPopupTimer)
9122         {
9123                 _timeCount = INDEX_UNIT_ZERO;
9124                 _pPopupTimer->Cancel();
9125         }
9126
9127         if (_pExposureCloseTimer)
9128         {
9129                 _pExposureCloseTimer->Cancel();
9130         }
9131
9132         if (_pCameraInfoPanel->GetDrawExposure() == true)
9133         {
9134                 _pCameraInfoPanel->SetDrawExposure(false);
9135                 Invalidate(true);
9136         }
9137
9138         if (_pTouchAutoFocusTimer)
9139         {
9140                 _pTouchAutoFocusTimer->Cancel();
9141         }
9142
9143         if (_pChargingTimer)
9144         {
9145                 _pChargingTimer->Cancel();
9146         }
9147
9148         HidePopup();
9149
9150         _pCameraInfoPanel->CheckAvailableStorageSpace();
9151         CheckStorageInfo();
9152         AppLogDebug("EXIT");
9153 }
9154
9155 void
9156 CameraForm::SetUri(const Tizen::Base::String& uri)
9157 {
9158         AppLogDebug("ENTER");
9159         AppLogDebug("[URI] %ls", uri.GetPointer());
9160         __uri = String(uri);
9161         AppLogDebug("EXIT");
9162 }
9163
9164 void
9165 CameraForm::SetMime(const Tizen::Base::String& mime)
9166 {
9167         AppLogDebug("ENTER");
9168         AppLogDebug("[MIME] %ls", mime.GetPointer());
9169         __mime = String(mime);
9170         AppLogDebug("EXIT");
9171 }
9172
9173 const Tizen::Base::String&
9174 CameraForm::GetUri(void) const
9175 {
9176         AppLogDebug("ENTER");
9177         AppLogDebug("EXIT");
9178         return __uri;
9179 }
9180
9181 const Tizen::Base::String&
9182 CameraForm::GetMime(void) const
9183 {
9184         AppLogDebug("ENTER");
9185         AppLogDebug("EXIT");
9186         return __mime;
9187 }
9188
9189 void
9190 CameraForm::LaunchImageview(void)
9191 {
9192         AppLogDebug("ENTER");
9193         result r = E_SUCCESS;
9194         const String* filePath = null;
9195         String listIndex = L"";
9196         String* temp = null;
9197         int index = 0;
9198         int loopCount = 0;
9199  
9200         if (_pPopupTimer)
9201         {
9202                 _timeCount = INDEX_UNIT_ZERO;
9203                 _pPopupTimer->Cancel();
9204         }
9205
9206         if (_pExposureCloseTimer)
9207         {
9208                 _pExposureCloseTimer->Cancel();
9209         }
9210
9211         HidePopup();
9212
9213         HashMap* pExtraData = new (std::nothrow) HashMap(SingleObjectDeleter);
9214         pExtraData->Construct();
9215
9216         ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
9217         pArrayList->Construct();
9218
9219         ArrayList* pContentPathList = new (std::nothrow) ArrayList(SingleObjectDeleter);
9220         pContentPathList->Construct();
9221
9222         pContentPathList = _pCameraPresentationModel->GetContentPathListN(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
9223         if (pContentPathList == null)
9224         {
9225                 delete pExtraData;
9226                 pExtraData = null;
9227                 AppLogDebug("EXIT - pContentPathList is null");
9228                 return;
9229         }
9230
9231         loopCount = _pCameraPresentationModel->GetContentCount();
9232         for (index = 0; index < loopCount; ++index)
9233         {
9234                 filePath = static_cast<const String*>(pContentPathList->GetAt(index));
9235                 AppLogDebug("filePath = %ls", filePath->GetPointer());
9236                 pArrayList->Add(new (std::nothrow) String(*filePath));
9237         }
9238
9239         listIndex.Format(INDEX_FREE_SPACE_BUFFER_LEN, L"%d", loopCount - INDEX_UNIT_ONE);
9240         AppLogDebug("listIndex : %ls", listIndex.GetPointer());
9241
9242         pExtraData->Add(new (std::nothrow) String(INPUT_KEY_PATH), (Object*)pArrayList);
9243         pExtraData->Add(new (std::nothrow) String(INPUT_KEY_INDEX), new (std::nothrow) String(listIndex));
9244
9245         SetUri(URI_VALUE);
9246         SetMime(MIME_TYPE_VALUE_IMAGE);
9247
9248         r = LaunchAppControl(APPCONTROL_PROVIDER_ID_IMAGEVIEW, APPCONTROL_OPERATION_ID_IMAGEVIEW, &GetUri(), &GetMime(), pExtraData);
9249         TryReturnVoid(r == E_SUCCESS, "Faled to LaunchAppControl[%s]", GetErrorMessage(r));
9250
9251         loopCount = pArrayList->GetCount();
9252         for (int i = 0; i < loopCount; ++i)
9253         {
9254                 temp = static_cast<String*>(pArrayList->GetAt(i));
9255                 AppLog("print temp(%ls)", temp->GetPointer());
9256         }
9257         AppLogDebug("EXIT");
9258 }
9259
9260 void
9261 CameraForm::InDrawFocus(void)
9262 {
9263         AppLogDebug("ENTER");
9264         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
9265                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9266         Rectangle clientRect = GetClientAreaBounds();
9267         result r = E_SUCCESS;
9268         int selfPortraitEnable = 0;
9269         Point currentPosition;
9270         bool focusSupport = false;
9271
9272         if (__dir == ORIENTATION_STATUS_PORTRAIT
9273                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9274         {
9275                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
9276                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
9277                 currentPosition.x = (rect.width / DIVIDE_BY_TWO);
9278                 currentPosition.y = (rect.height / DIVIDE_BY_TWO);
9279         }
9280         else
9281         {
9282                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
9283                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9284                 currentPosition.x = (rect.width / DIVIDE_BY_TWO);
9285                 currentPosition.y = (rect.height / DIVIDE_BY_TWO);
9286         }
9287
9288         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
9289         TryReturnVoid(r == E_SUCCESS, "Read Reg fail[%s]", GetErrorMessage(r));
9290
9291         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
9292         {
9293                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FOCUS, focusSupport);
9294         }
9295         else
9296         {
9297                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_SUPPORT_FOCUS, focusSupport);
9298         }
9299
9300         if (focusSupport == true && r == E_SUCCESS)
9301         {
9302                 _pCameraInfoPanel->SetCurrentPoint(currentPosition);
9303                 _pCameraInfoPanel->SetDrawMarkerFocus(true);
9304                 _pCameraInfoPanel->SetDrawMarkerFocusType(CAMERA_FOCUS_NOT_READY);
9305         }
9306         else
9307         {
9308                 _pCameraInfoPanel->SetDrawMarkerFocus(false);
9309                 _pCameraInfoPanel->Draw();
9310                 _pCameraInfoPanel->Show();
9311         }
9312         AppLogDebug("EXIT");
9313 }
9314
9315 void
9316 CameraForm::GetCameraToForeground(void)
9317 {
9318         AppLogDebug("ENTER");
9319         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
9320                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9321         Rectangle clientRect = GetClientAreaBounds();
9322         result r = E_SUCCESS;
9323         Dimension previewResolutionDim;
9324         Dimension captureResolutionDim;
9325         int previewResolutionSize = 0;
9326         BufferInfo bufferinfo;
9327
9328         __isLockScreenMode = false;
9329
9330         _pCameraPresentationModel->KeepScreenOnState(true, false);
9331
9332         StartInitAppTimer();
9333
9334         StartPreviewFailPopupTimer();
9335
9336         _batteryStatus = GetCurrentBatteryState();
9337         AppLogDebug("_batteryStatus [%d]", _batteryStatus);
9338
9339         StartInitChargingTimer();
9340
9341         r = _pCameraPresentationModel->SetMode(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
9342         TryReturnVoid(r == E_SUCCESS, "SetMode() failed:%s", GetErrorMessage(r));
9343
9344         Update();
9345
9346         previewResolutionDim = _pCameraPresentationModel->GetPreviewResolution();
9347         AppLogDebug("CameraForm::GetPreviewResolution(W:%d, H:%d)", previewResolutionDim.width, previewResolutionDim.height);
9348
9349         __previewResolutionWidth = previewResolutionDim.width;
9350         __previewResolutionHeight = previewResolutionDim.height;
9351
9352         captureResolutionDim = _pCameraPresentationModel->GetCaptureResolution();
9353         AppLogDebug("CameraForm::captureResolutionDim(W:%d, H:%d)", previewResolutionDim.width, previewResolutionDim.height);
9354
9355         AppLogDebug("__screenMode [%d]", __screenMode);
9356
9357         r = SetScreenMode(__screenMode, false);
9358         TryReturnVoid(r == E_SUCCESS, "SetScreenMode() failed:%s", GetErrorMessage(r));
9359
9360         if (__dir == ORIENTATION_STATUS_PORTRAIT
9361                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9362         {
9363                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT, W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
9364         }
9365         else
9366         {
9367                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE, W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9368         }
9369
9370         InDrawFocus();
9371
9372         r = _pCameraPresentationModel->SetValue(CURRENT_MODE, CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
9373         TryReturnVoid(r == E_SUCCESS, "Write Reg fail[%s]", GetErrorMessage(r));
9374
9375         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
9376         TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
9377
9378         _pCameraPresentationModel->StartPreview(&bufferinfo);
9379
9380         _pCameraPresentationModel->SetContinuousAutoFocus();
9381
9382         previewResolutionSize = __previewResolutionWidth * __previewResolutionHeight;
9383
9384         _pCameraInfoPanel->SetPreviewResolutionSize(previewResolutionSize);
9385
9386         SetCameraSettingsDevice();
9387         AppLogDebug("EXIT");
9388 }
9389
9390 void
9391 CameraForm::SendCameraToBackground(void)
9392 {
9393         AppLogDebug("ENTER");
9394         if (__isTimerRunning == true)
9395         {
9396                 StopPopupTimer();
9397                 _timeCount = INDEX_UNIT_ZERO;
9398                 __isTimerRunning = false;
9399                 _pCameraPresentationModel->SetIntervalTimerRun(false);
9400                 _isUsedTimerCaptured = false;
9401
9402                 if (_pIntervalValueTimer != null)
9403                 {
9404                         _pIntervalValueTimer->Cancel();
9405                 }
9406
9407                 _pCameraInfoPanel->SetDrawPopupTimerUpdate(false);
9408                 _pCameraInfoPanel->SetDrawPopupTimerCount(0);
9409                 _pCameraInfoPanel->SetDrawPopupTimer(false);
9410                 _pCameraInfoPanel->Invalidate(true);
9411                 HideUiPanel(false);
9412         }
9413
9414         if (_pAppTimer != null)
9415         {
9416                 _pAppTimer->Cancel();
9417         }
9418
9419         if (_pChargingTimer != null)
9420         {
9421                 _chargingCount = 0;     
9422                 _pChargingTimer->Cancel();
9423         }
9424
9425         if (_pChargingCompletedTimer != null)
9426         {
9427                 _chargingCount = 0;
9428                 _blinkCount  = 0;
9429                 _pChargingCompletedTimer->Cancel();
9430         }
9431
9432         if (_pPreviewFailPopupTimer != null)
9433         {
9434                 _pPreviewFailPopupTimer->Cancel();
9435         }
9436
9437         _pCameraInfoPanel->SetDrawMarkerFocus(false);
9438         _pCameraInfoPanel->Invalidate(true);
9439
9440         HidePopup();
9441
9442         _pCameraPresentationModel->SetStorageCardChageState(CameraPresentationModel::STORAGE_CARD_CHAGE_STATE_UNKNOWN);
9443         _pCameraPresentationModel->StopCamera();
9444         _pCameraPresentationModel->KeepScreenOnState(false, true);
9445
9446         AppLogDebug("EXIT");
9447 }
9448
9449 void
9450 CameraForm::DrawThumbnail(void)
9451 {
9452         AppLogDebug("ENTER");
9453         if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
9454         {
9455                 if (__pThumbnailButton)
9456                 {
9457                         __pThumbnailButton->SetShowState(true);
9458                         __pThumbnailButton->Draw();
9459                         __pThumbnailButton->Show();
9460                 }
9461
9462                 if (_pThumbnailPanel)
9463                 {
9464                         _pThumbnailPanel->SetShowState(false);
9465                         _pThumbnailPanel->Draw();
9466                         _pThumbnailPanel->Show();
9467                 }
9468         }
9469         else
9470         {
9471                 if (__pThumbnailButton)
9472                 {
9473                         __pThumbnailButton->SetShowState(false);
9474                         __pThumbnailButton->Draw();
9475                         __pThumbnailButton->Show();
9476                 }
9477
9478                 if (_pThumbnailPanel)
9479                 {
9480                         _pThumbnailPanel->SetShowState(true);
9481                         _pThumbnailPanel->Draw();
9482                         _pThumbnailPanel->Show();
9483                 }
9484         }
9485         AppLogDebug("EXIT");
9486 }
9487
9488 void
9489 CameraForm::SetCameraErrorOccurred(void)
9490 {
9491         AppLogDebug("ENTER");
9492         result r = E_SUCCESS;
9493         Point currentPosition;
9494         Rectangle rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
9495                                                         W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9496         int guideLineEnable = 0;
9497         BufferInfo bufferinfo;
9498
9499         if (__dir == ORIENTATION_STATUS_PORTRAIT
9500                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9501         {
9502                 rect = Rectangle(X_PREVIEW_OVERLAY_PORTRAIT, Y_PREVIEW_OVERLAY_PORTRAIT,
9503                                                 W_PREVIEW_OVERLAY_PORTRAIT, H_PREVIEW_OVERLAY_PORTRAIT);
9504         }
9505         else
9506         {
9507                 rect = Rectangle(X_PREVIEW_OVERLAY_LANDSCAPE, Y_PREVIEW_OVERLAY_LANDSCAPE,
9508                                                 W_PREVIEW_OVERLAY_LANDSCAPE, H_PREVIEW_OVERLAY_LANDSCAPE);
9509         }
9510
9511         TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
9512         _pAppTimer->Cancel();
9513
9514         r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
9515         TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
9516
9517         r = __pOverlayPanel->GetBackgroundBufferInfo(bufferinfo);
9518         TryReturnVoid(r == E_SUCCESS, "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
9519
9520         _pCameraPresentationModel->StartPreview(&bufferinfo);
9521
9522         _pCameraPresentationModel->SetContinuousAutoFocus();
9523
9524         r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, guideLineEnable);
9525         TryReturnVoid(r == E_SUCCESS, "Read Reg fail[%s]", GetErrorMessage(r));
9526
9527         if (guideLineEnable == DISABLE_GUIDELINE)
9528         {
9529                 DrawMarker(false);
9530         }
9531         else
9532         {
9533                 DrawMarker(true);
9534         }
9535
9536         InDrawFocus();
9537
9538         StopPopupTimer();
9539
9540         _isUsedTimerCaptured = false;
9541         AppLogDebug("EXIT");
9542 }
9543
9544 result
9545 CameraForm::SetScreenOverlayHelpTimer(void)
9546 {
9547         AppLogDebug("ENTER");
9548         result r = E_SUCCESS;
9549         int overlayHelpEnable = 0;
9550
9551         r = _pCameraPresentationModel->GetValue(OVERLAY_HELP_ENABLE, overlayHelpEnable);
9552         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
9553
9554         AppLogDebug("SetScreenOverlayHelpTimer : overlayHelpEnable = %d", overlayHelpEnable);
9555
9556         if (overlayHelpEnable == SCREEN_OVERLAY_HELP_ENABLE)
9557         {
9558                 _pHelpCloseTimer = new (std::nothrow) Timer();
9559                 _pHelpCloseTimer->Construct(*this);
9560
9561                 r = _pHelpCloseTimer->Start(CAMERA_SCREEN_OVERLAY_HELP_TIMER_VALUE);
9562                 TryCatch(r == E_SUCCESS, , "Timer::start fail[%s]", GetErrorMessage(r));
9563         }
9564
9565         AppLogDebug("EXIT");
9566         return r;
9567
9568 CATCH:
9569         delete _pHelpCloseTimer;
9570         _pHelpCloseTimer = null;
9571
9572         AppLogDebug("EXIT - CATCH");
9573         return r;
9574 }
9575
9576 result
9577 CameraForm::DrawScreenOverlayHelp(void)
9578 {
9579         AppLogDebug("ENTER");
9580         Bitmap* pBitmap = null;
9581         result r = E_SUCCESS;
9582         int overlayHelpEnable = 0;
9583         String ovelayHelpStr = L"";
9584         bool checkAppControlSwitch = false;
9585         //AppResource* pAppResource = null;
9586
9587         TryCatch(_pHelpGoToGallery != null, r = E_FAILURE, "_pHelpGoToGallery is null");
9588         TryCatch(_pHelpGoToGalleryText != null, r = E_FAILURE, "_pHelpGoToGalleryText is null");
9589         TryCatch(_pHelpSwitchCamera != null, r = E_FAILURE, "_pHelpSwitchCamera is null");
9590         TryCatch(_pHelpSwitchCameraText != null, r = E_FAILURE, "_pHelpSwitchCameraText is null");
9591         TryCatch(_pHelpQuickSetting != null, r = E_FAILURE, "_pHelpQuickSetting is null");
9592         TryCatch(_pHelpQuickSettingText != null, r = E_FAILURE, "_pHelpQuickSettingText is null");
9593         TryCatch(_pHelpRecordVideo != null, r = E_FAILURE, "_pHelpRecordVideo is null");
9594         TryCatch(_pHelpRecordVideoText != null, r = E_FAILURE, "_pHelpRecordVideoText is null");
9595         TryCatch(_pHelpShutter != null, r = E_FAILURE, "_pHelpShutter is null");
9596         TryCatch(_pHelpShutterText != null, r = E_FAILURE, "_pHelpShutterText is null");
9597
9598         r = _pCameraPresentationModel->GetValue(OVERLAY_HELP_ENABLE, overlayHelpEnable);
9599         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
9600
9601         AppLogDebug("DrawScreenOverlayHelp : overlayHelpEnable = %d", overlayHelpEnable);
9602
9603         if (overlayHelpEnable == SCREEN_OVERLAY_HELP_DISABLE)
9604         {
9605                 HideScreenOverlayHelp();
9606         }
9607         else
9608         {
9609                 //pAppResource = Application::GetInstance()->GetAppResource();
9610                 //TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
9611
9612                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_MAIN)
9613                 {
9614                         _pHelpGoToGallery->SetShowState(true);
9615                         //pAppResource->GetString(L"IDS_HELP_GOTO_GALLERY", ovelayHelpStr);
9616                         ovelayHelpStr = L"GO to Gallery";
9617                         _pHelpGoToGalleryText->SetText(ovelayHelpStr);
9618                         _pHelpGoToGalleryText->SetTextColor(COLOR_SCREEN_OVERLAY_HELP_TEXT);
9619                         _pHelpGoToGalleryText->SetTextConfig(FONT_SIZE_SCREEN_OVERLAY_HELP, LABEL_TEXT_STYLE_NORMAL);
9620                         _pHelpGoToGalleryText->SetShowState(true);
9621                 }
9622
9623                 _pHelpSwitchCamera->SetShowState(true);
9624                 //pAppResource->GetString(L"IDS_HELP_SWITCH_CAMERA", ovelayHelpStr);
9625                 ovelayHelpStr = L"Switch camera";
9626                 _pHelpSwitchCameraText->SetText(ovelayHelpStr);
9627                 _pHelpSwitchCameraText->SetTextColor(COLOR_SCREEN_OVERLAY_HELP_TEXT);
9628                 _pHelpSwitchCameraText->SetTextConfig(FONT_SIZE_SCREEN_OVERLAY_HELP, LABEL_TEXT_STYLE_NORMAL);
9629                 _pHelpSwitchCameraText->SetShowState(true);
9630
9631                 _pHelpQuickSetting->SetShowState(true);
9632                 //pAppResource->GetString(L"IDS_HELP_QUICK_SETTINGT", ovelayHelpStr);
9633                 ovelayHelpStr = L"Quick Settings";
9634                 _pHelpQuickSettingText->SetText(ovelayHelpStr);
9635                 _pHelpQuickSettingText->SetTextColor(COLOR_SCREEN_OVERLAY_HELP_TEXT);
9636                 _pHelpQuickSettingText->SetTextConfig(FONT_SIZE_SCREEN_OVERLAY_HELP, LABEL_TEXT_STYLE_NORMAL);
9637                 _pHelpQuickSettingText->SetShowState(true);
9638
9639
9640                 if (GetAppLaunchType() == APP_LAUNCH_TYPE_REQUESET)
9641                 {
9642                         checkAppControlSwitch = (static_cast<CameraApp*>(UiApp::GetInstance()))->GetAppControlSwitch();
9643                 }
9644                 else
9645                 {
9646                         checkAppControlSwitch = true;
9647                 }
9648
9649                 if (checkAppControlSwitch)
9650                 {
9651                         _pHelpRecordVideo->SetShowState(true);
9652                         //pAppResource->GetString(L"IDS_HELP_CAPTURE_IMAGE", ovelayHelpStr);
9653                         ovelayHelpStr = L"Capture image";
9654                         _pHelpRecordVideoText->SetText(ovelayHelpStr);
9655                         _pHelpRecordVideoText->SetTextColor(COLOR_SCREEN_OVERLAY_HELP_TEXT);
9656                         _pHelpRecordVideoText->SetTextConfig(FONT_SIZE_SCREEN_OVERLAY_HELP, LABEL_TEXT_STYLE_NORMAL);
9657                         _pHelpRecordVideoText->SetShowState(true);
9658                 }
9659
9660                 _pHelpShutter->SetShowState(true);
9661                 //pAppResource->GetString(L"IDS_HELP_SHUTTER", ovelayHelpStr);
9662                 ovelayHelpStr = L"Shutter";
9663                 _pHelpShutterText->SetText(ovelayHelpStr);
9664                 _pHelpShutterText->SetTextColor(COLOR_SCREEN_OVERLAY_HELP_TEXT);
9665                 _pHelpShutterText->SetTextConfig(FONT_SIZE_SCREEN_OVERLAY_HELP, LABEL_TEXT_STYLE_NORMAL);
9666                 _pHelpShutterText->SetShowState(true);
9667
9668                 if (__dir == ORIENTATION_STATUS_PORTRAIT
9669                         || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9670                 {
9671                         _pHelpGoToGalleryText->Invalidate(true);
9672                         _pHelpSwitchCameraText->Invalidate(true);
9673                         _pHelpQuickSettingText->Invalidate(true);
9674                         _pHelpRecordVideoText->Invalidate(true);
9675                         _pHelpShutterText->Invalidate(true);
9676
9677                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_10);
9678                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9679
9680                         _pHelpGoToGallery->SetBackgroundBitmap(*pBitmap);
9681                         _pHelpGoToGallery->Invalidate(true);
9682
9683                         delete pBitmap;
9684                         pBitmap = null;
9685
9686                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_04);
9687                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9688
9689                         _pHelpSwitchCamera->SetBackgroundBitmap(*pBitmap);
9690                         _pHelpSwitchCamera->Invalidate(true);
9691
9692                         delete pBitmap;
9693                         pBitmap = null;
9694
9695                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_10);
9696                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9697
9698                         _pHelpQuickSetting->SetBackgroundBitmap(*pBitmap);
9699                         _pHelpQuickSetting->Invalidate(true);
9700
9701                         delete pBitmap;
9702                         pBitmap = null;
9703
9704                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_08);
9705                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9706
9707                         _pHelpRecordVideo->SetBackgroundBitmap(*pBitmap);
9708                         _pHelpRecordVideo->Invalidate(true);
9709
9710                         delete pBitmap;
9711                         pBitmap = null;
9712
9713                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_05);
9714                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9715
9716                         _pHelpShutter->SetBackgroundBitmap(*pBitmap);
9717                         _pHelpShutter->Invalidate(true);
9718
9719                         delete pBitmap;
9720                         pBitmap = null;
9721
9722                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_12);
9723                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9724
9725                                         delete pBitmap;
9726                         pBitmap = null;
9727                 }
9728                 else
9729                 {
9730                         _pHelpGoToGalleryText->Invalidate(true);
9731                         _pHelpSwitchCameraText->Invalidate(true);
9732                         _pHelpQuickSettingText->Invalidate(true);
9733                         _pHelpRecordVideoText->Invalidate(true);
9734                         _pHelpShutterText->Invalidate(true);
9735
9736                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_06);
9737                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9738
9739                         _pHelpGoToGallery->SetBackgroundBitmap(*pBitmap);
9740                         _pHelpGoToGallery->Invalidate(true);
9741
9742                         delete pBitmap;
9743                         pBitmap = null;
9744
9745                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_01);
9746                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9747
9748                         _pHelpSwitchCamera->SetBackgroundBitmap(*pBitmap);
9749                         _pHelpSwitchCamera->Invalidate(true);
9750
9751                         delete pBitmap;
9752                         pBitmap = null;
9753
9754                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_06);
9755                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9756
9757                         _pHelpQuickSetting->SetBackgroundBitmap(*pBitmap);
9758                         _pHelpQuickSetting->Invalidate(true);
9759
9760                         delete pBitmap;
9761                         pBitmap = null;
9762
9763                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_03);
9764                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9765
9766                         _pHelpRecordVideo->SetBackgroundBitmap(*pBitmap);
9767                         _pHelpRecordVideo->Invalidate(true);
9768
9769                         delete pBitmap;
9770                         pBitmap = null;
9771
9772                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_03);
9773                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9774
9775                         _pHelpShutter->SetBackgroundBitmap(*pBitmap);
9776                         _pHelpShutter->Invalidate(true);
9777
9778                         delete pBitmap;
9779                         pBitmap = null;
9780
9781                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_SCREEN_OVERLAY_HELP_04);
9782                         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9783
9784                         delete pBitmap;
9785                         pBitmap = null;
9786                 }
9787         }
9788
9789         AppLogDebug("EXIT");
9790         return r;
9791
9792 CATCH:
9793         AppLogDebug("EXIT - CATCH");
9794         return r;
9795 }
9796
9797 void
9798 CameraForm::CheckCameraSettingLabel(void)
9799 {
9800         AppLogDebug("ENTER");
9801         if (__pCameraSettingLable)
9802         {
9803                 result r = E_SUCCESS;
9804
9805                 TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
9806                 _pAppTimer->Cancel();
9807
9808                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
9809                 TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
9810
9811                 if (_pListViewGeneralTabMainMenu)
9812                 {
9813                         _pListViewGeneralTabMainMenu->SetShowState(false);
9814                 }
9815
9816                 if (_pListViewGeneralTabSubMenu)
9817                 {
9818                         _pListViewGeneralTabSubMenu->SetShowState(false);
9819                 }
9820
9821                 MakeCameraTabSettingPopup();
9822         }
9823         AppLogDebug("Exit");
9824 }
9825
9826 void
9827 CameraForm::CheckGeneralSettingLabel(void)
9828 {
9829         AppLogDebug("ENTER");
9830         if(__pGeneralSettingLable)
9831         {
9832                 result r = E_SUCCESS;
9833
9834                 TryReturnVoid(_pAppTimer != null, "_pAppTimer is null");
9835                 _pAppTimer->Cancel();
9836
9837                 r = _pAppTimer->Start(CAMERA_TIMER_LIMIT);
9838                 TryReturnVoid(r == E_SUCCESS, "_pAppTimer start fail[%s]", GetErrorMessage(r));
9839
9840                 if (_pListViewCameraTabMainMenu)
9841                 {
9842                         _pListViewCameraTabMainMenu->SetShowState(false);
9843                 }
9844                 if (_pListViewCameraTabSubMenu)
9845                 {
9846                         _pListViewCameraTabSubMenu->SetShowState(false);
9847                 }
9848
9849                 MakeGeneralTabSettingPopup();
9850         }
9851         AppLogDebug("Exit");
9852 }
9853
9854 result
9855 CameraForm::DrawBatteryLevelFull(void)
9856 {
9857         AppLogDebug("ENTER");
9858         Bitmap* pBitmap = null;
9859         result r = E_SUCCESS;
9860
9861         TryCatch(__pBatteryState != null, r = E_FAILURE, "__pBatteryState is null");
9862
9863         if (__dir == ORIENTATION_STATUS_PORTRAIT
9864                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9865         {
9866                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_PORTRAIT, Y_INDICATOR_BATTERY_PORTRAIT);
9867         }
9868         else
9869         {
9870                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_LANDSCAPE, Y_INDICATOR_BATTERY_LANDSCAPE);
9871         }
9872
9873         _batteryStatus = BATTERY_STATE_20;
9874
9875         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_20);
9876         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
9877
9878         __pBatteryState->SetBackgroundBitmap(*pBitmap);
9879         __pBatteryState->Invalidate(true);
9880
9881         delete pBitmap;
9882         pBitmap = null;
9883
9884         AppLogDebug("EXIT");
9885         return r;
9886
9887 CATCH:
9888         AppLogDebug("EXIT - CATCH");
9889         return r;
9890 }
9891
9892 result
9893 CameraForm::CheckBatteryStatus(void)
9894 {
9895         AppLogDebug("ENTER");
9896         Bitmap* pBitmap = null;
9897         result r = E_SUCCESS;
9898         int batteryLevel = 0;
9899         bool isCharging = false;
9900
9901         Battery::IsCharging(isCharging);
9902         Battery::GetCurrentLevelInPercentage(batteryLevel);
9903
9904         AppLogDebug("isCharging = %d", isCharging);
9905         AppLogDebug("batteryLevel = %d", batteryLevel);
9906
9907         TryCatch(__pBatteryState != null, r = E_FAILURE, "__pBatteryState is null");
9908
9909         if (__dir == ORIENTATION_STATUS_PORTRAIT
9910                 || __dir == ORIENTATION_STATUS_PORTRAIT_REVERSE)
9911         {
9912                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_PORTRAIT, Y_INDICATOR_BATTERY_PORTRAIT);
9913         }
9914         else
9915         {
9916                 __pBatteryState->SetPosition(X_INDICATOR_BATTERY_LANDSCAPE, Y_INDICATOR_BATTERY_LANDSCAPE);
9917         }
9918
9919         if (isCharging)
9920         {
9921                 _batteryStatus = GetCurrentBatteryState();
9922                 AppLogDebug("_batteryStatus [%d]", _batteryStatus);
9923
9924                 int currentImage = GetCurrentBatteryImage();
9925
9926                 AppLogDebug("currentImage = %d", currentImage);
9927
9928                 pBitmap = ResourceManager::GetBitmapN(currentImage);
9929
9930                 StartInitChargingTimer();
9931         }
9932         else
9933         {
9934                 if (batteryLevel > BATT_LEVEL_VALUE_95 && batteryLevel <= BATT_LEVEL_VALUE_100)
9935                 {
9936                         _batteryStatus = BATTERY_STATE_20;
9937
9938                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_20);
9939                 }
9940                 else if (batteryLevel > BATT_LEVEL_VALUE_90 && batteryLevel <= BATT_LEVEL_VALUE_95)
9941                 {
9942                         _batteryStatus = BATTERY_STATE_19;
9943
9944                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_19);
9945                 }
9946                 else if (batteryLevel > BATT_LEVEL_VALUE_85 && batteryLevel <= BATT_LEVEL_VALUE_90)
9947                 {
9948                         _batteryStatus = BATTERY_STATE_18;
9949
9950                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_18);
9951                 }
9952                 else if (batteryLevel > BATT_LEVEL_VALUE_80 && batteryLevel <= BATT_LEVEL_VALUE_85)
9953                 {
9954                         _batteryStatus = BATTERY_STATE_17;
9955
9956                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_17);
9957                 }
9958                 else if (batteryLevel > BATT_LEVEL_VALUE_75 && batteryLevel <= BATT_LEVEL_VALUE_80)
9959                 {
9960                         _batteryStatus = BATTERY_STATE_16;
9961
9962                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_16);
9963                 }
9964                 else if (batteryLevel > BATT_LEVEL_VALUE_70 && batteryLevel <= BATT_LEVEL_VALUE_75)
9965                 {
9966                         _batteryStatus = BATTERY_STATE_15;
9967
9968                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_15);
9969                 }
9970                 else if (batteryLevel > BATT_LEVEL_VALUE_65 && batteryLevel <= BATT_LEVEL_VALUE_70)
9971                 {
9972                         _batteryStatus = BATTERY_STATE_14;
9973
9974                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_14);
9975                 }
9976                 else if (batteryLevel > BATT_LEVEL_VALUE_60 && batteryLevel <= BATT_LEVEL_VALUE_65)
9977                 {
9978                         _batteryStatus = BATTERY_STATE_13;
9979
9980                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_13);
9981                 }
9982                 else if (batteryLevel > BATT_LEVEL_VALUE_55 && batteryLevel <= BATT_LEVEL_VALUE_60)
9983                 {
9984                         _batteryStatus = BATTERY_STATE_12;
9985
9986                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_12);
9987                 }
9988                 else if (batteryLevel > BATT_LEVEL_VALUE_50 && batteryLevel <= BATT_LEVEL_VALUE_55)
9989                 {
9990                         _batteryStatus = BATTERY_STATE_11;
9991
9992                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_11);
9993                 }
9994                 else if (batteryLevel > BATT_LEVEL_VALUE_45 && batteryLevel <= BATT_LEVEL_VALUE_50)
9995                 {
9996                         _batteryStatus = BATTERY_STATE_10;
9997
9998                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_10);
9999                 }
10000                 else if (batteryLevel > BATT_LEVEL_VALUE_40 && batteryLevel <= BATT_LEVEL_VALUE_45)
10001                 {
10002                         _batteryStatus = BATTERY_STATE_9;
10003
10004                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_09);
10005                 }
10006                 else if (batteryLevel > BATT_LEVEL_VALUE_35 && batteryLevel <= BATT_LEVEL_VALUE_40)
10007                 {
10008                         _batteryStatus = BATTERY_STATE_8;
10009
10010                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_08);
10011                 }
10012                 else if (batteryLevel > BATT_LEVEL_VALUE_30 && batteryLevel <= BATT_LEVEL_VALUE_35)
10013                 {
10014                         _batteryStatus = BATTERY_STATE_7;
10015
10016                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_07);
10017                 }
10018                 else if (batteryLevel > BATT_LEVEL_VALUE_25 && batteryLevel <= BATT_LEVEL_VALUE_30)
10019                 {
10020                         _batteryStatus = BATTERY_STATE_6;
10021
10022                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_06);
10023                 }
10024                 else if (batteryLevel > BATT_LEVEL_VALUE_20 && batteryLevel <= BATT_LEVEL_VALUE_25)
10025                 {
10026                         _batteryStatus = BATTERY_STATE_5;
10027
10028                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_05);
10029                 }
10030                 else if (batteryLevel > BATT_LEVEL_VALUE_15 && batteryLevel <= BATT_LEVEL_VALUE_20)
10031                 {
10032                         _batteryStatus = BATTERY_STATE_4;
10033
10034                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_04);
10035                 }
10036                 else if (batteryLevel > BATT_LEVEL_VALUE_10 && batteryLevel <= BATT_LEVEL_VALUE_15)
10037                 {
10038                         _batteryStatus = BATTERY_STATE_3;
10039
10040                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_03);
10041                 }
10042                 else if (batteryLevel > BATT_LEVEL_VALUE_05 && batteryLevel <= BATT_LEVEL_VALUE_10)
10043                 {
10044                         _batteryStatus = BATTERY_STATE_2;
10045
10046                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_02);
10047                 }
10048                 else if (batteryLevel > BATT_LEVEL_VALUE_00 && batteryLevel <= BATT_LEVEL_VALUE_05)
10049                 {
10050                         _batteryStatus = BATTERY_STATE_1;
10051
10052                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_01);
10053                 }
10054                 else if (batteryLevel == BATT_LEVEL_VALUE_00)
10055                 {
10056                         _batteryStatus = BATTERY_STATE_0;
10057
10058                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_IC_CAMERA_BATTERY_00);
10059                 }
10060         }
10061         TryCatch(pBitmap != null, r = E_FAILURE, "pBitmap is null");
10062
10063         AppLogDebug("_batteryStatus = %d", _batteryStatus);
10064
10065         __pBatteryState->SetBackgroundBitmap(*pBitmap);
10066         __pBatteryState->Invalidate(true);
10067
10068         delete pBitmap;
10069         pBitmap = null;
10070
10071         AppLogDebug("EXIT");
10072         return r;
10073
10074 CATCH:
10075         AppLogDebug("EXIT - CATCH");
10076         return r;
10077 }
10078
10079 void
10080 CameraForm::CancelTimer(void)
10081 {
10082         AppLogDebug("ENTER");
10083         if (_pAppTimer != null)
10084         {
10085                 _pAppTimer->Cancel();
10086         }
10087
10088         if (_pIntervalValueTimer != null)
10089         {
10090                 _pIntervalValueTimer->Cancel();
10091         }
10092
10093         if (_pCaptureStartTimer != null)
10094         {
10095                 _pCaptureStartTimer->Cancel();
10096         }
10097
10098         if (_pTouchAutoFocusTimer != null)
10099         {
10100                 _pTouchAutoFocusTimer->Cancel();
10101         }
10102
10103         if (_pPopupTimer)
10104         {
10105                 _pPopupTimer->Cancel();
10106         }
10107
10108         if (_pExposureCloseTimer)
10109         {
10110                 _pExposureCloseTimer->Cancel();
10111         }
10112
10113         if (_pHelpCloseTimer)
10114         {
10115                 _pHelpCloseTimer->Cancel();
10116         }
10117
10118         if (_pChargingTimer)
10119         {
10120                 _chargingCount = INDEX_UNIT_ZERO;
10121
10122                 _pChargingTimer->Cancel();
10123         }
10124
10125         if (_pChargingCompletedTimer != null)
10126         {
10127                 _chargingCount = 0;
10128                 _blinkCount = 0;
10129                 _pChargingCompletedTimer->Cancel();
10130         }
10131
10132         if (_pPreviewFailPopupTimer != null)
10133         {
10134                 _pPreviewFailPopupTimer->Cancel();
10135         }
10136         AppLogDebug("EXIT");
10137 }
10138
10139 result
10140 CameraForm::MakeCameraTabMenuString(void)
10141 {
10142         AppLogDebug("ENTER");
10143         int idx = 0;
10144         String tmpString;
10145         result r = E_SUCCESS;
10146         AppResource* pAppResource = null;
10147
10148         if (__pSettingMenuString == null)
10149         {
10150                 pAppResource = Application::GetInstance()->GetAppResource();
10151                 TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
10152
10153                 __pSettingMenuString = new (std::nothrow) String*[MAX_SETTING_MENU_COUNT];
10154
10155                 TryCatch(__pSettingMenuString != null, r = E_FAILURE, "__pSettingMenuString is null");
10156
10157                 for (idx = 0; idx < MAX_SETTING_MENU_COUNT; ++idx)
10158                 {
10159                         __pSettingMenuString[idx] = new (std::nothrow) String[MAX_SUBMENU_CONTENT];
10160                         TryCatch(__pSettingMenuString[idx] != null, r = E_FAILURE, "__pSettingMenuString[%d] is null", idx);
10161                 }
10162
10163                 pAppResource->GetString(IDS_CAM_BODY_RESOLUTION, tmpString);
10164                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE][MENU_IDX_01] = tmpString;
10165
10166                 pAppResource->GetString(IDS_CAM_BODY_ISO, tmpString);
10167                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_01] = tmpString;
10168                 pAppResource->GetString(IDS_CAM_BODY_AUTO, tmpString);
10169                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_02] = tmpString;
10170                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_03] = IDS_MENU_ISO_50;
10171                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_04] = IDS_MENU_ISO_100;
10172                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_05] = IDS_MENU_ISO_200;
10173                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_06] = IDS_MENU_ISO_400;
10174                 __pSettingMenuString[CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE][MENU_IDX_07] = IDS_MENU_ISO_800;
10175         }
10176         AppLogDebug("EXIT");
10177         return r;
10178
10179 CATCH:
10180         if (__pSettingMenuString)
10181         {
10182                 for (idx = 0; idx < MAX_SETTING_MENU_COUNT; ++idx)
10183                 {
10184                         if (__pSettingMenuString[idx])
10185                         {
10186                                 delete [] __pSettingMenuString[idx];
10187                                 __pSettingMenuString[idx] = null;
10188                         }
10189                         else
10190                         {
10191                                 break;
10192                         }
10193                 }
10194
10195                 delete __pSettingMenuString;
10196                 __pSettingMenuString = null;
10197         }
10198
10199         return r;
10200 }
10201
10202 result
10203 CameraForm::MakeGeneralTabMenuString(void)
10204 {
10205         AppLogDebug("ENTER");
10206         int idx = 0;
10207         String tmpString;
10208         result r = E_SUCCESS;
10209         AppResource* pAppResource = null;
10210
10211         if (__pSettingGeneralMenuString == null)
10212         {
10213                 pAppResource = Application::GetInstance()->GetAppResource();             
10214                 TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
10215
10216                 __pSettingGeneralMenuString = new (std::nothrow) String*[MAX_GENERAL_TAB_SETTING_MENU_COUNT];
10217
10218                 TryCatch(__pSettingGeneralMenuString != null, r = E_FAILURE, "__pSettingGeneralMenuString is null");
10219
10220                 for (idx = 0; idx < MAX_GENERAL_TAB_SETTING_MENU_COUNT; ++idx)
10221                 {
10222                         __pSettingGeneralMenuString[idx] = new (std::nothrow) String[MAX_SUBMENU_CONTENT];
10223                         TryCatch(__pSettingGeneralMenuString[idx] != null, r = E_FAILURE, "__pSettingGeneralMenuString[%d] is null", idx);
10224                 }
10225
10226                 pAppResource->GetString(IDS_CAM_BODY_TIMER, tmpString);
10227                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE][MENU_IDX_01] = tmpString;
10228
10229                 pAppResource->GetString(IDS_CAM_BODY_OFF, tmpString);
10230                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE][MENU_IDX_02] = tmpString;
10231                 pAppResource->GetString(IDS_CAM_BODY_2_SEC, tmpString);
10232                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE][MENU_IDX_03] = tmpString;
10233                 pAppResource->GetString(IDS_CAM_BODY_5_SEC, tmpString);
10234                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE][MENU_IDX_04] = tmpString;
10235                 pAppResource->GetString(IDS_CAM_BODY_10_SEC, tmpString);
10236                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE][MENU_IDX_05] = tmpString;
10237
10238                 pAppResource->GetString(IDS_CAM_BODY_GUIDELINE, tmpString);
10239                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE][MENU_IDX_01] = tmpString;
10240                 pAppResource->GetString(IDS_CAM_BODY_OFF, tmpString);
10241                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE][MENU_IDX_02] = tmpString;
10242                 pAppResource->GetString(IDS_CAM_BODY_ON, tmpString);
10243                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE][MENU_IDX_03] = tmpString;
10244
10245                 pAppResource->GetString(IDS_CAM_BODY_STORAGE, tmpString);
10246                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE][MENU_IDX_01] = tmpString;
10247                 pAppResource->GetString(IDS_CAM_BODY_PHONE, tmpString);
10248                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE][MENU_IDX_02] = tmpString;
10249                 pAppResource->GetString(IDS_CAM_OPT_MEMORY_CARD, tmpString);
10250                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE][MENU_IDX_03] = tmpString;
10251
10252                 pAppResource->GetString(IDS_CAM_BODY_RESET_SETTINGS_RESET, tmpString);
10253                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_CONTENT_RESET_MODE][MENU_IDX_01] = tmpString;
10254
10255                 //pAppResource->GetString(IDS_CAM_OVERLAY_HELP_VALUE, tmpString);
10256                 //__pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_OVERLAY_HELP_MODE][MENU_IDX_01] = tmpString;         
10257                 __pSettingGeneralMenuString[GENERAL_TAB_SUB_MENU_OVERLAY_HELP_MODE][MENU_IDX_01] = IDS_MENU_OVERLAY_HELP_VALUE;
10258         }
10259         AppLogDebug("EXIT");
10260         return r;
10261
10262 CATCH:
10263         if (__pSettingGeneralMenuString)
10264         {
10265                 for (idx = 0; idx < MAX_GENERAL_TAB_SETTING_MENU_COUNT; ++idx)
10266                 {
10267                         if (__pSettingGeneralMenuString[idx])
10268                         {
10269                                 delete [] __pSettingGeneralMenuString[idx];
10270                                 __pSettingGeneralMenuString[idx] = null;
10271                         }
10272                         else
10273                         {
10274                                 break;
10275                         }
10276                 }
10277
10278                 delete __pSettingGeneralMenuString;
10279                 __pSettingGeneralMenuString = null;
10280         }
10281
10282         return r;
10283 }
10284
10285 result
10286 CameraForm::RunStartPreviewThread(void)
10287 {
10288         AppLogDebug("ENTER");
10289         result r = E_SUCCESS;
10290
10291         r  = __pOverlayPanel->GetBackgroundBufferInfo(__bufferInfo);
10292         TryCatch(r == E_SUCCESS, , "GetBackgroundBufferInfo fail[%s]", GetErrorMessage(r));
10293
10294         __pCameraStarterThread = CameraStarterThread::GetInstance();
10295         TryCatch(__pCameraStarterThread != null, , "__pCameraStarterThread is null");
10296
10297         r = __pCameraStarterThread->SetBufferinfo(&__bufferInfo);
10298         TryCatch(r == E_SUCCESS, , "SetBufferinfo fail[%s]", GetErrorMessage(r));
10299
10300         r = __pCameraStarterThread->Start();
10301         TryCatch(r == E_SUCCESS, , "SetBufferinfo fail[%s]", GetErrorMessage(r));
10302
10303         AppLogDebug("EXIT");
10304         return r;
10305
10306 CATCH:
10307         ShowCameraFailPopup();
10308
10309         AppLogDebug("EXIT - CATCH");
10310         return r;
10311 }
10312
10313 result
10314 CameraForm::SubListPopupTimerMode(int index)
10315 {
10316         AppLogDebug("ENTER");
10317         result r = E_SUCCESS;
10318         int regVal = 0;
10319
10320         __settingTimeInterval = index;
10321         regVal = index;
10322
10323         r = _pCameraPresentationModel->SetValue(TIMER_INTERVAL, regVal);
10324         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10325
10326         _pCameraInfoPanel->SetTimerType(regVal);
10327         _pCameraInfoPanel->Invalidate(true);
10328
10329         AppLogDebug("EXIT");
10330         return r;
10331
10332 CATCH:
10333         AppLogDebug("EXIT - CATCH");
10334         return r;
10335 }
10336
10337 result
10338 CameraForm::SubListPopupIsoMode(int index)
10339 {
10340         AppLogDebug("ENTER");
10341         result r = E_SUCCESS;
10342         int regVal = 0;
10343         int selfPortraitEnable = 0;
10344         int updatedIndex = 0;
10345
10346         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
10347         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
10348
10349         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10350         {
10351                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
10352         }
10353         else
10354         {
10355                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_ISO_LEVEL);
10356         }
10357
10358         if (r == E_SUCCESS)
10359         {
10360                 if (index == 0)
10361                 {
10362                         updatedIndex = index + 2;
10363                 }
10364                 else
10365                 {
10366                         updatedIndex = index + 3;
10367                 }
10368                 _pCameraPresentationModel->SetIsoLevel((CameraIsoLevel)updatedIndex);
10369         }
10370
10371         __settingIsoIndex = index;
10372         regVal = __settingIsoIndex;
10373
10374         r = _pCameraPresentationModel->SetValue(ISO_VALUE, regVal);
10375         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10376
10377         AppLogDebug("EXIT");
10378         return r;
10379
10380 CATCH:
10381         AppLogDebug("EXIT - CATCH");
10382         return r;
10383 }
10384
10385 result
10386 CameraForm::SubListPopupWhiteBalanceMode(int index)
10387 {
10388         AppLogDebug("ENTER");
10389         result r = E_SUCCESS;
10390         int regVal = 0;
10391         String strRegKey = IDS_INIT_REG_KEY;
10392         int selfPortraitEnable = 0;
10393
10394         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
10395         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
10396
10397         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10398         {
10399                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
10400         }
10401         else
10402         {
10403                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
10404         }
10405
10406         if (r == E_SUCCESS)
10407         {
10408                 r = _pCameraPresentationModel->SetWhiteBalance((CameraWhiteBalance)index);
10409         }
10410         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10411
10412         __settingWhiteBalance = index;
10413         regVal = __settingWhiteBalance;
10414
10415         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10416         {
10417                 r = _pCameraPresentationModel->SetValue(WHITE_BALANCE_TYPE_PRIMARY, regVal);
10418                 TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10419         }
10420         else
10421         {
10422                 r = _pCameraPresentationModel->SetValue(WHITE_BALANCE_TYPE_SECONDARY, regVal);
10423                 TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10424         }
10425
10426         AppLogDebug("regVal = %d",regVal);
10427
10428         AppLogDebug("EXIT");
10429         return r;
10430
10431 CATCH:
10432         AppLogDebug("EXIT - CATCH");
10433         return r;
10434 }
10435
10436 result
10437 CameraForm::SubListPopupGuidelineMode(int index)
10438 {
10439         AppLogDebug("ENTER");
10440         int value = SUBMENU_MODE_OFF;
10441         result r = E_SUCCESS;
10442         int regVal = 0;
10443         String strRegKey = IDS_INIT_REG_KEY;
10444
10445         switch (index)
10446         {
10447         case SUBMENU_MODE_OFF:
10448                 {
10449                         AppLogDebug("Setting - Guideline = off");
10450                         value = SUBMENU_MODE_OFF;
10451
10452                         r = DrawMarker(false);
10453                         TryCatch(r == E_SUCCESS, , "DrawMarker() fail[%s]", GetErrorMessage(r));
10454                 }
10455                 break;
10456
10457         case SUBMENU_MODE_ON:
10458                 {
10459                         AppLogDebug("Setting - Guideline = on");
10460                         value = SUBMENU_MODE_ON;
10461
10462                         r = DrawMarker(true);
10463                         TryCatch(r == E_SUCCESS, , "DrawMarker() fail[%s]", GetErrorMessage(r));
10464                 }
10465                 break;
10466
10467         default:
10468                 break;
10469         }
10470
10471         SetGuideLine(value);
10472         regVal = value;
10473
10474         r = _pCameraPresentationModel->SetValue(GUIDELINE_ENABLE, regVal);
10475         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10476
10477         AppLogDebug("EXIT");
10478         return r;
10479
10480 CATCH:
10481         AppLogDebug("EXIT - CATCH");
10482         return r;
10483 }
10484
10485 result
10486 CameraForm::SubListPopupOverlayHelpMode(int index)
10487 {
10488         AppLogDebug("ENTER");
10489         int value = SUBMENU_MODE_OFF;
10490         result r = E_SUCCESS;
10491         int regVal = 0;
10492         String strRegKey = IDS_INIT_REG_KEY;
10493
10494         switch (index)
10495         {
10496         case SUBMENU_MODE_OFF:
10497                 {
10498                         value = SUBMENU_MODE_OFF;
10499                 }
10500                 break;
10501
10502         case SUBMENU_MODE_ON:
10503                 {
10504                         value = SUBMENU_MODE_ON;
10505                 }
10506                 break;
10507
10508         default:
10509                 break;
10510         }
10511
10512         regVal = value;
10513
10514         r = _pCameraPresentationModel->SetValue(OVERLAY_HELP_ENABLE, regVal);
10515         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10516
10517         AppLogDebug("Setting - OVERLAY_HELP_ENABLE = %d", OVERLAY_HELP_ENABLE);
10518
10519         r = SetScreenOverlayHelpTimer();
10520         TryCatch(r == E_SUCCESS, , "SetScreenOverlayHelpTimer() [%s]", GetErrorMessage(r));
10521
10522         r = DrawScreenOverlayHelp();
10523         TryCatch(r == E_SUCCESS, , "DrawScreenOverlayHelp() [%s]", GetErrorMessage(r));
10524         
10525         AppLogDebug("EXIT");
10526         return r;
10527
10528 CATCH:
10529         AppLogDebug("EXIT - CATCH");
10530         return r;
10531 }
10532
10533 result
10534 CameraForm::SubListPopupResolutionMode(int index)
10535 {
10536         AppLogDebug("ENTER");
10537         IList* pList = _pCameraPresentationModel->GetCaptureResolutionList();
10538         int resolutionCnt = 0;
10539         BufferInfo bufferinfo;
10540         int resolutionRatio = 0;
10541         result r = E_SUCCESS;
10542         int regVal = 0;
10543         int selfPortraitEnable = 0;
10544
10545         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
10546
10547         if (pList)
10548         {
10549                 resolutionCnt = pList->GetCount() - INDEX_UNIT_ONE;
10550                 Dimension dimCaptureResolution = *(static_cast<Dimension*>(pList->GetAt(resolutionCnt - index)));
10551
10552                 AppLogDebug("SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE :: dimCaptureResolution(W:%d, H:%d)", dimCaptureResolution.width, dimCaptureResolution.height);
10553                 AppLogDebug("SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE :: __captureResolution(W:%d, H:%d)", __captureResolutionWidth, __captureResolutionHeight);
10554
10555                 if ((__captureResolutionWidth == dimCaptureResolution.width ) && (__captureResolutionHeight == dimCaptureResolution.height))
10556                 {
10557                         AppLogDebug("CAPTURE RESOLUTION Same");
10558                 }
10559                 else
10560                 {
10561                         _pCameraPresentationModel->StopPreview();
10562
10563                         _pCameraPresentationModel->SetCaptureResolution(dimCaptureResolution);
10564
10565                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10566                         {
10567                                 r = _pCameraPresentationModel->SetValue(PRIMARY_RESOLUTION_INDEX,index);
10568                                 AppLogDebug("result is %s",GetErrorMessage(r));
10569                         }
10570                         else
10571                         {
10572                                 r = _pCameraPresentationModel->SetValue(SECONDARY_RESOLUTION_INDEX,index);
10573                         }
10574
10575                         AppLogDebug("dimCaptureResolution(W:%d, H:%d)", dimCaptureResolution.width, dimCaptureResolution.height);
10576
10577                         resolutionRatio = (dimCaptureResolution.width * MULTIPLY_BY_TEN) / (dimCaptureResolution.height);
10578
10579                         AppLogDebug("resolutionRatio (W:%d)", resolutionRatio);
10580
10581                         __resolutionChange = true;
10582
10583                         __captureResolutionWidth = dimCaptureResolution.width;
10584
10585                         __captureResolutionHeight = dimCaptureResolution.height;
10586
10587                         if (resolutionRatio > NORMAL_MODE_RATIO)
10588                         {
10589                                 r = SetScreenMode(SCREEN_MODE_FULL, true);
10590                         }
10591                         else
10592                         {
10593                                 r = SetScreenMode(SCREEN_MODE_NORMAL, true);
10594                         }
10595                         TryCatch(r == E_SUCCESS, , "SetScreenMode fail[%s]", GetErrorMessage(r));
10596
10597                         AppLogDebug("__screenMode [%d]", __screenMode);
10598                 }
10599         }
10600
10601         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10602         {
10603                 __primaryCurrentResolutionIndex = index;
10604                 regVal = __primaryCurrentResolutionIndex;
10605         }
10606         else
10607         {
10608                 __secondaryCurrentResolutionIndex = index;
10609                 regVal = __secondaryCurrentResolutionIndex;
10610         }
10611         __resolutionChange = false;
10612
10613         AppLogDebug("EXIT");
10614         return r;
10615
10616 CATCH:
10617         AppLogDebug("EXIT - CATCH");
10618         return r;
10619 }
10620
10621 void
10622 CameraForm::SubListPopupStorageTypeMode(int index)
10623 {
10624         AppLogDebug("ENTER");
10625         int storage = STORAGE_TYPE_PHONE;
10626         String filePath = L"";
10627         result r = E_SUCCESS;
10628
10629         switch (index)
10630         {
10631         case SUBMENU_STORAGE_TYPE_PHONE:
10632                 {
10633                         AppLogDebug("Setting - Storage type = Phone");
10634                         storage = STORAGE_TYPE_PHONE;
10635                         SetStorageType(storage);
10636                 }
10637                 break;
10638
10639         case SUBMENU_STORAGE_TYPE_MEMORYCARD:
10640                 {
10641                         AppLogDebug("Setting - Storage type = card");
10642                         storage = STORAGE_TYPE_MEMORYCARD;
10643
10644                         if (_pCameraPresentationModel->IsStorageCardMounted() == true)
10645                         {
10646                                 SetStorageType(storage);
10647                         }
10648                         else
10649                         {
10650                                 storage = SUBMENU_STORAGE_TYPE_PHONE;
10651                                 AppLogDebug("Setting - don't draw t-flash icon");
10652                         }
10653                 }
10654                 break;
10655
10656         default:
10657                 {
10658                         AppLogDebug("Setting - Storage, Invaild element id");
10659                 }
10660                 break;
10661         }
10662
10663         _pCameraPresentationModel->UpdateThumbnail(CameraPresentationModel::CAMERA_MODE_SNAPSHOT);
10664
10665         Update();
10666
10667         _pCameraInfoPanel->SetStorageType(storage);
10668         _pCameraInfoPanel->Invalidate(true);
10669
10670         if (__pFileEventManager == null)
10671         {
10672                 __pFileEventManager = new (std::nothrow) FileEventManager();
10673                 r = __pFileEventManager->Construct(*this);
10674                 AppLogDebug("FileEventManager()::Construct() fail[%s]", GetErrorMessage(r));
10675         }
10676
10677         filePath = _pCameraPresentationModel->GetfilePath(storage);
10678         AppLogDebug("filePath %ls", filePath.GetPointer());
10679
10680
10681         if (File::IsFileExist(__pFileEventPath))
10682         {
10683                 __pFileEventManager->RemovePath(__pFileEventPath);
10684         }
10685
10686         if (File::IsFileExist(filePath))
10687         {
10688                 r = __pFileEventManager->AddPath(filePath, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
10689                 __pFileEventPath = filePath;
10690         }
10691         AppLogDebug("FileEventManager()::Construct() fail[%s]", GetErrorMessage(r));
10692         AppLogDebug("EXIT");
10693 }
10694
10695 CustomItem*
10696 CameraForm::CreateCameraTabMainMenuItem(int index, int itemWidth)
10697 {
10698         AppLogDebug("ENTER");
10699         CustomItem* pItem = null;
10700         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON, Y_SETTING_SUBMENU_RADIO_ICON,
10701                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
10702         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON, Y_SETTING_SUBMENU_ICON,
10703                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
10704         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
10705                                                                                 W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
10706         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM, Y_SETTING_SUBMENU_3TEXT_ITEM,
10707                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
10708         String tmpString;
10709         result r = E_SUCCESS;
10710         int elementId = 0;
10711         int regVal = 0;
10712         int cameraResolutionCount = 0;
10713         int storageType = STORAGE_TYPE_PHONE;
10714         String listName = L"";
10715         Rectangle rectContents = Rectangle(X_SETTING_MENU_CONTESTS -20, Y_SETTING_MENU_CONTESTS,
10716                                                                         W_SETTING_MENU_CONTESTS, H_SETTING_MENU_CONTESTS);
10717
10718         Rectangle rectContentsValue = Rectangle(X_SETTING_MENU_CONTENTS_VALUE -20, Y_SETTING_MENU_CONTENTS_VALUE,
10719                                                                                         W_SETTING_MENU_CONTENTS_VALUE, H_SETTING_MENU_CONTENTS_VALUE);
10720         int selfPortraitEnable = 0;
10721         String strTmp = L"";
10722
10723         pItem = new (std::nothrow) CustomItem();
10724         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
10725
10726         r = pItem->Construct(Dimension(itemWidth, H_SETTING_MENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
10727         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
10728
10729         elementId = (index * MENU_TWO_ELEMENT);
10730
10731         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
10732         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
10733
10734         strTmp = __pSettingMenuString[index][0];
10735         elementId++;
10736         if (strTmp.GetLength())
10737         {
10738                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
10739                 {
10740                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
10741                         {
10742                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_ISO_LEVEL);
10743
10744                                 if (r == E_SUCCESS)
10745                                 {
10746                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10747                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10748                                 }
10749                                 else
10750                                 {
10751                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10752                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10753                                 }
10754                         }
10755                         else if (index == CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE)
10756                         {
10757                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_CAPTURE_RESOLUTION);
10758
10759                                 if (r == E_SUCCESS)
10760                                 {
10761                                         if (__pCaptureResolutionList != null)
10762                                         {
10763                                                 cameraResolutionCount =  __pCaptureResolutionList->GetCount();
10764                                         }
10765
10766                                         if (cameraResolutionCount > 1)
10767                                         {
10768                                                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10769                                         }
10770                                         else
10771                                         {
10772                                                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10773                                         }
10774                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10775                                 }
10776                                 else
10777                                 {
10778                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10779                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10780                                 }
10781                         }
10782                         else
10783                         {
10784                                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10785                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10786                         }
10787                 }
10788                 else
10789                 {
10790                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
10791                         {
10792                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
10793
10794                                 if (r == E_SUCCESS && __pIsoList->GetCount()>1)
10795                                 {
10796                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10797                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10798                                 }
10799                                 else
10800                                 {
10801                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10802                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10803                                 }
10804                         }
10805                         else if (index == CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE)
10806                         {
10807                                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_CAPTURE_RESOLUTION);
10808
10809                                 if (r == E_SUCCESS)
10810                                 {
10811                                         cameraResolutionCount = 0;
10812                                         if (__pCaptureResolutionList != null)
10813                                         {
10814                                                 cameraResolutionCount = __pCaptureResolutionList->GetCount();
10815                                         }
10816
10817                                         if (cameraResolutionCount > 1)
10818                                         {
10819                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10820                                         }
10821                                         else
10822                                         {
10823                                                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10824                                         }
10825                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10826                                 }
10827                                 else
10828                                 {
10829                                         r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10830                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10831                                 }
10832                         }
10833                         else
10834                         {
10835                                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
10836                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10837                         }
10838                 }
10839         }
10840
10841         r = _pCameraPresentationModel->GetValue(STORAGE_TYPE, storageType);
10842         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
10843
10844         if (storageType == STORAGE_TYPE_MEMORYCARD && _pCameraPresentationModel->IsStorageCardMounted() == false)
10845         {
10846                 r = _pCameraPresentationModel->SetValue(STORAGE_TYPE, STORAGE_TYPE_PHONE);
10847                 TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
10848                 _pCameraPresentationModel->SetStorageCardState(CameraPresentationModel::STORAGE_CARD_STATE_UNMOUNT);
10849         }
10850
10851         if (index == CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE)
10852         {
10853                 if (__pCaptureResolutionList)
10854                 {
10855                         int idx = __pCaptureResolutionList->GetCount() - INDEX_UNIT_ONE;
10856                         if (idx >= 0)
10857                         {
10858                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10859                                 {
10860                                         AppLogDebug("CAM_SELF_PORTRAIT_MODE_PRIMARY");
10861                                         r = _pCameraPresentationModel->GetValue(PRIMARY_RESOLUTION_INDEX, __primaryCurrentResolutionIndex);
10862                                         if (idx == 0)
10863                                         {
10864                                                 if (__primaryCurrentResolutionIndex == INDEX_UNIT_ONE)
10865                                                 {
10866                                                         __primaryCurrentResolutionIndex = __primaryCurrentResolutionIndex - INDEX_UNIT_ONE;
10867                                                 }
10868                                                 strTmp = *(static_cast<String*>(__pCaptureResolutionList->GetAt(__primaryCurrentResolutionIndex)));
10869                                         }
10870                                         else
10871                                         {
10872                                                 strTmp = *(static_cast<String*>(__pCaptureResolutionList->GetAt(__primaryCurrentResolutionIndex)));
10873                                         }
10874                                 }
10875                                 else
10876                                 {
10877                                         if (idx == 0)
10878                                         {
10879                                                 AppLogDebug("CAM_SELF_PORTRAIT_MODE_SECONDARY");
10880                                                 r = _pCameraPresentationModel->GetValue(SECONDARY_RESOLUTION_INDEX, __secondaryCurrentResolutionIndex);
10881
10882                                                 if (__secondaryCurrentResolutionIndex == INDEX_UNIT_ONE)
10883                                                 {
10884                                                         __secondaryCurrentResolutionIndex = __secondaryCurrentResolutionIndex - INDEX_UNIT_ONE;
10885                                                 }
10886                                                 strTmp = *(static_cast<String*>(__pCaptureResolutionList->GetAt(__secondaryCurrentResolutionIndex)));
10887                                         }
10888                                         else
10889                                         {
10890                                                 strTmp = *(static_cast<String*>(__pCaptureResolutionList->GetAt(__secondaryCurrentResolutionIndex)));
10891                                         }
10892                                 }
10893                         }
10894                 }
10895         }
10896         else if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
10897         {
10898                 if (__pIsoList)
10899                 {
10900                         int idx = __pIsoList->GetCount() - INDEX_UNIT_ONE;
10901                         if (idx >= INDEX_UNIT_ZERO)
10902                         {
10903                                 r = _pCameraPresentationModel->GetValue(ISO_VALUE, regVal);
10904
10905                                 if (regVal == INDEX_UNIT_ZERO)
10906                                 {
10907                                         strTmp = __pSettingMenuString[index][regVal + INDEX_UNIT_ONE];
10908                                 }
10909                                 else
10910                                 {
10911                                         strTmp = *(static_cast<String*>(__pIsoList->GetAt(regVal)));
10912                                 }
10913                         }
10914                 }
10915                 else
10916                 {
10917                         strTmp = __pSettingMenuString[index][regVal + INDEX_UNIT_ONE];
10918                 }
10919         }
10920         else
10921         {
10922                 strTmp = __pSettingMenuString[index][regVal + INDEX_UNIT_ONE];
10923         }
10924
10925         elementId++;
10926
10927         if (strTmp.GetLength())
10928         {
10929                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
10930                 {
10931                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
10932                         {
10933                                 if (__pIsoList != null)
10934                                 {
10935                                         if (__pIsoList->GetCount() >1)
10936                                         {
10937                                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10938                                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10939                                         }
10940                                         else
10941                                         {
10942                                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10943                                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10944                                         }
10945                                 }
10946                                 else
10947                                 {
10948                                         r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10949                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10950                                 }
10951                         }
10952                         else
10953                         {
10954                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, true);
10955                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10956                         }
10957                 }
10958                 else
10959                 {
10960                         if (index == CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE)
10961                         {
10962                                 if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
10963                                 {
10964                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
10965                                 }
10966                                 else
10967                                 {
10968                                         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_ISO_LEVEL);
10969                                 }
10970         
10971                                 if (r == E_SUCCESS)
10972                                 {
10973                                         cameraResolutionCount = 0;
10974                                         if (__pCaptureResolutionList != null)
10975                                         {
10976                                                 cameraResolutionCount = __pCaptureResolutionList->GetCount();
10977                                         }
10978
10979                                         if (cameraResolutionCount > 1)
10980                                         {
10981                                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, true);
10982                                         }
10983                                         else
10984                                         {
10985                                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10986                                         }
10987                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10988                                 }
10989                                 else
10990                                 {
10991                                         r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
10992                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10993                                 }
10994                         }
10995                         else
10996                         {
10997                                 r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, true);
10998                                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
10999                         }
11000                 }
11001                 r = pItem->SetElementTextHorizontalAlignment(elementId, ALIGNMENT_CENTER);
11002                 TryCatch(r == E_SUCCESS, , "CustomItem::SetElementTextHorizontalAlignment() fail[%s]", GetErrorMessage(r));
11003         }
11004
11005         AppLogDebug("EXIT");
11006         return pItem;
11007
11008 CATCH:
11009         delete pItem;
11010         pItem = null;
11011
11012         AppLogDebug("pItem is null or not SettingMainMenu/FlashMenu");
11013         AppLogDebug("EXIT - CATCH");
11014         return null;
11015 }
11016
11017 CustomItem*
11018 CameraForm::CreateCameraTabSubMenuItem(int index, int itemWidth)
11019 {
11020         AppLogDebug("ENTER");
11021         CustomItem* pItem = null;
11022         Bitmap* pBitmap = null;
11023         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON + X_SETTING_SUBMENU_RADIO_ICON_MARGIN, Y_SETTING_SUBMENU_RADIO_ICON,
11024                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
11025         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON_ZERO, Y_SETTING_SUBMENU_ICON,
11026                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
11027         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
11028                                                                                 W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
11029         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM - X_SETTING_SUBMENU_3TEXT_ITEM_MARGIN, Y_SETTING_SUBMENU_3TEXT_ITEM,
11030                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
11031         AppResource* pAppResource = null;
11032         String tmpString;
11033         result r = E_SUCCESS;
11034         int elementId = 0;
11035         int regVal = 0;
11036         CameraTabSubMenuContent idx = CAMERA_TAB_SUB_MENU_CONTENT_MAX;
11037
11038         pItem = new (std::nothrow) CustomItem();
11039         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
11040
11041         r = pItem->Construct(Dimension(itemWidth, H_SETTING_SUBMENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
11042         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
11043
11044         pAppResource = Application::GetInstance()->GetAppResource();
11045         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
11046
11047         idx = GetCameraTabSettingSubMenuMode();
11048         switch (idx)
11049         {
11050         case CAMERA_TAB_SUB_MENU_CONTENT_ISO_MODE:
11051                 {
11052                         ResourceId resId = RESOURCE_ID_ISO_AUTO;
11053
11054                         switch (index)
11055                         {
11056                         case SUBMENU_ISO_AUTO:
11057                                 {
11058                                         resId = RESOURCE_ID_ISO_AUTO;
11059                                 }
11060                                 break;
11061
11062                         case SUBMENU_ISO_100:
11063                                 {
11064                                         resId = RESOURCE_ID_ISO_100;
11065                                 }
11066                                 break;
11067
11068                         case SUBMENU_ISO_200:
11069                                 {
11070                                         resId = RESOURCE_ID_ISO_200;
11071                                 }
11072                                 break;
11073
11074                         case SUBMENU_ISO_400:
11075                                 {
11076                                         resId = RESOURCE_ID_ISO_400;
11077                                 }
11078                                 break;
11079
11080                         case SUBMENU_ISO_800:
11081                                 {
11082                                         resId = RESOURCE_ID_ISO_800;
11083                                 }
11084                                 break;
11085
11086                         default:
11087                                 break;
11088                         }
11089
11090                         String arrString[] =
11091                         {
11092                                 IDS_CAM_BODY_AUTO,
11093                                 IDS_MENU_ISO_100,
11094                                 IDS_MENU_ISO_200,
11095                                 IDS_MENU_ISO_400,
11096                                 IDS_MENU_ISO_800,
11097                         };
11098
11099                         r = _pCameraPresentationModel->GetValue(ISO_VALUE, regVal);
11100                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11101
11102                         if (__pIsoList)
11103                         {
11104                                 String str = L"";
11105                                 if (__pIsoList->GetCount() > index)
11106                                 {
11107                                         if (index == regVal)
11108                                         {
11109                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11110                                         }
11111                                         else
11112                                         {
11113                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11114                                         }
11115
11116                                         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11117                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11118
11119                                         delete pBitmap;
11120                                         pBitmap = null;
11121
11122                                         AppLogDebug("ISO index return is = %d", index);
11123
11124                                         if (index == INDEX_UNIT_ZERO)
11125                                         {
11126                                                 pAppResource->GetString(arrString[index], str);
11127                                         }
11128                                         else
11129                                         {
11130                                                 str = *(static_cast<String*>(__pIsoList->GetAt(index)));
11131                                         }
11132                                         elementId++;
11133
11134                                         pBitmap = ResourceManager::GetBitmapN(resId);
11135                                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11136
11137                                         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11138                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11139
11140                                         delete pBitmap;
11141                                         pBitmap = null;
11142
11143                                         elementId++;
11144                                         r = pItem->AddElement(rectThreeTextItem, elementId, str, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11145                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11146                                 }
11147                         }
11148                 }
11149                 break;
11150
11151         case CAMERA_TAB_SUB_MENU_CONTENT_CAPTURE_RESOLUTION_MODE:
11152                 {
11153                         int selfPortraitEnable = 0;
11154
11155                         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
11156                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11157
11158
11159                         if (selfPortraitEnable  == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY )
11160                         {
11161                                 r = _pCameraPresentationModel->GetValue(PRIMARY_RESOLUTION_INDEX, __primaryCurrentResolutionIndex);
11162                                 AppLogDebug("resolution index is %d",__primaryCurrentResolutionIndex);
11163                                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11164                         }
11165                         else
11166                         {
11167                                 r = _pCameraPresentationModel->GetValue(SECONDARY_RESOLUTION_INDEX, __secondaryCurrentResolutionIndex);
11168                                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11169                         }
11170
11171                         if (__pCaptureResolutionList)
11172                         {
11173                                 String str = L"";
11174                                 if (__pCaptureResolutionList->GetCount() > index)
11175                                 {
11176                                         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_PRIMARY)
11177                                         {
11178                                                 if (index == __primaryCurrentResolutionIndex)
11179                                                 {
11180                                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11181                                                 }
11182                                                 else
11183                                                 {
11184                                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11185                                                 }
11186                                         }
11187                                         else
11188                                         {
11189                                                 if (index == __secondaryCurrentResolutionIndex)
11190                                                 {
11191                                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11192                                                 }
11193                                                 else
11194                                                 {
11195                                                         pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11196                                                 }
11197                                         }
11198
11199                                         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11200                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11201
11202                                         delete pBitmap;
11203                                         pBitmap = null;
11204
11205                                         elementId++;
11206
11207                                         str = *(static_cast<String*>(__pCaptureResolutionList->GetAt(index)));
11208                                         AppLogDebug("str = %ls", str.GetPointer());
11209                                         if (str.Equals(String(PHOTO_SIZE_3264_2488)))
11210                                         {
11211                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_6M); // 8M
11212                                         }
11213                                         else if (str.Equals(String(PHOTO_SIZE_3264_2176)))
11214                                         {
11215                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_6M); // 8M
11216                                         }
11217                                         else if (str.Equals(String(PHOTO_SIZE_3264_1836)))
11218                                         {
11219                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_6M); // 8M
11220                                         }
11221                                         else if (str.Equals(String(PHOTO_SIZE_2048_1536)))
11222                                         {
11223                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_2M); // 3.2M
11224                                         }
11225                                         else if (str.Equals(String(PHOTO_SIZE_2048_1152)))
11226                                         {
11227                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_2M); // 3.2M
11228                                         }
11229                                         else if (str.Equals(String(PHOTO_SIZE_1280_720)))
11230                                         {
11231                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_0_3M); // 0.9M
11232                                         }
11233                                         else if (str.Equals(String(PHOTO_SIZE_640_480)))
11234                                         {
11235                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_0_3M); // 0.3M
11236                                         }
11237                                         else
11238                                         {
11239                                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_PHOTO_SIZE_0_3M); // 0.3M
11240                                         }
11241                                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11242
11243                                         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11244                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11245
11246                                         delete pBitmap;
11247                                         pBitmap = null;
11248
11249                                         str = *(static_cast<String*>(__pCaptureResolutionList->GetAt(index)));
11250
11251                                         elementId++;
11252                                         r = pItem->AddElement(rectThreeTextItem, elementId, str, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11253                                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11254                                 }
11255                         }
11256                 }
11257                 break;
11258
11259         default:
11260                 break;
11261         }
11262
11263         AppLogDebug("EXIT");
11264         return pItem;
11265
11266 CATCH:
11267         delete pItem;
11268         pItem = null;
11269
11270         delete pBitmap;
11271         pBitmap = null;
11272
11273         AppLogDebug("pItem is null or not SettingMainMenu/FlashMenu");
11274         AppLogDebug("EXIT - CATCH");
11275         return null;
11276 }
11277
11278 CustomItem*
11279 CameraForm::CreateGeneralTabMainMenuItem(int index, int itemWidth)
11280 {
11281         AppLogDebug("ENTER");
11282         CustomItem* pItem = null;
11283         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON, Y_SETTING_SUBMENU_RADIO_ICON,
11284                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
11285         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON, Y_SETTING_SUBMENU_ICON,
11286                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
11287         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
11288                                                                                 W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
11289         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM - X_SETTING_SUBMENU_3TEXT_ITEM_MARGIN, Y_SETTING_SUBMENU_3TEXT_ITEM,
11290                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
11291         String tmpString;
11292         result r = E_SUCCESS;
11293         int elementId = 0;
11294         int regVal = 0;
11295         String listName = L"";
11296         Rectangle rectContents = Rectangle(X_SETTING_MENU_CONTESTS, Y_SETTING_MENU_CONTESTS,
11297                                                                         W_SETTING_MENU_CONTESTS, H_SETTING_MENU_CONTESTS);
11298
11299         Rectangle rectContentsValue = Rectangle(X_SETTING_MENU_CONTENTS_VALUE, Y_SETTING_MENU_CONTENTS_VALUE,
11300                                                                                         W_SETTING_MENU_CONTENTS_VALUE, H_SETTING_MENU_CONTENTS_VALUE);
11301         int selfPortraitEnable = 0;
11302         String strTmp = L"";
11303
11304         String arrRegStringSuppor[] =
11305         {
11306                 TIMER_INTERVAL,
11307                 GUIDELINE_ENABLE,
11308                 STORAGE_TYPE,
11309                 OVERLAY_HELP_ENABLE,
11310         };
11311
11312         pItem = new (std::nothrow) CustomItem();
11313         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
11314
11315         r = pItem->Construct(Dimension(itemWidth, H_SETTING_MENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
11316         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
11317
11318         elementId = (index * MENU_TWO_ELEMENT);
11319
11320         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
11321         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11322
11323         strTmp = __pSettingGeneralMenuString[index][0];
11324         elementId++;
11325
11326         if (strTmp.GetLength())
11327         {
11328                 r = pItem->AddElement(rectContents, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11329                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11330         }
11331
11332         if (index < (GetGeneralTabSettingMainMenuCount() - INDEX_UNIT_ONE))
11333         {
11334                 int storageType = STORAGE_TYPE_PHONE;
11335
11336                 r = _pCameraPresentationModel->GetValue(STORAGE_TYPE, storageType);
11337                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11338
11339                 if (storageType == STORAGE_TYPE_MEMORYCARD && _pCameraPresentationModel->IsStorageCardMounted() == false)
11340                 {
11341                         r = _pCameraPresentationModel->SetValue(STORAGE_TYPE, STORAGE_TYPE_PHONE);
11342                         TryCatch(r == E_SUCCESS, , "SetValue() fail[%s]", GetErrorMessage(r));
11343                         _pCameraPresentationModel->SetStorageCardState(CameraPresentationModel::STORAGE_CARD_STATE_UNMOUNT);
11344                 }
11345
11346                 r = _pCameraPresentationModel->GetValue(arrRegStringSuppor[index], regVal);
11347                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11348
11349                 AppLogDebug("Setting Main Menu");
11350                 AppLogDebug("%ls[%d]", strTmp.GetPointer(), regVal);
11351                 AppLogDebug("Err = %s", GetErrorMessage(GetLastResult()));
11352
11353                 strTmp = __pSettingGeneralMenuString[index][regVal + INDEX_UNIT_ONE];
11354
11355                 elementId++;
11356
11357                 if (strTmp.GetLength())
11358                 {
11359                         r = pItem->AddElement(rectContentsValue, elementId, strTmp, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, COLOR_SETTING_MENU_VAULE, true);
11360                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11361
11362                         r = pItem->SetElementTextHorizontalAlignment(elementId, ALIGNMENT_CENTER);
11363                         TryCatch(r == E_SUCCESS, , "CustomItem::SetElementTextHorizontalAlignment() fail[%s]", GetErrorMessage(r));
11364                 }
11365         }
11366
11367         AppLogDebug("EXIT");
11368         return pItem;
11369
11370   CATCH:
11371         delete pItem;
11372         pItem = null;
11373
11374         AppLogDebug("EXIT - CATCH");
11375         return null;
11376 }
11377
11378 CustomItem*
11379 CameraForm::CreateGeneralTabSubMenuItem(int index, int itemWidth)
11380 {
11381         AppLogDebug("ENTER");
11382         CustomItem* pItem = null;
11383         Bitmap* pBitmap = null;
11384         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON + X_SETTING_SUBMENU_RADIO_ICON_MARGIN, Y_SETTING_SUBMENU_RADIO_ICON,
11385                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
11386         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON_ZERO, Y_SETTING_SUBMENU_ICON,
11387                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
11388         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
11389                                                                                 W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
11390         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM - X_SETTING_SUBMENU_3TEXT_ITEM_MARGIN, Y_SETTING_SUBMENU_3TEXT_ITEM,
11391                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
11392         AppResource* pAppResource = null;
11393         String tmpString;
11394         result r = E_SUCCESS;
11395         int elementId = 0;
11396         int regVal = 0;
11397
11398         GeneralTabSubMenuContent idx = GENERAL_TAB_SUB_MENU_CONTENT_MAX;
11399
11400         pItem = new (std::nothrow) CustomItem();
11401         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
11402
11403         r = pItem->Construct(Dimension(itemWidth, H_SETTING_SUBMENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
11404         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
11405
11406         pAppResource = Application::GetInstance()->GetAppResource();
11407         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
11408
11409         idx = GetGeneralTabSettingSubMenuMode();
11410         switch (idx)
11411         {
11412         case GENERAL_TAB_SUB_MENU_CONTENT_TIMER_MODE:
11413                 {
11414                         ResourceId resId = RESOURCE_ID_TIMER_OFF;
11415
11416                         switch (index)
11417                         {
11418                         case SETTING_TIMER_CAPTURE_0_SEC:
11419                                 {
11420                                         resId = RESOURCE_ID_TIMER_OFF;
11421                                 }
11422                                 break;
11423
11424                         case SETTING_TIMER_CAPTURE_2_SEC:
11425                                 {
11426                                         resId = RESOURCE_ID_TIMER_2SEC;
11427                                 }
11428                                 break;
11429
11430                         case SETTING_TIMER_CAPTURE_5_SEC:
11431                                 {
11432                                         resId = RESOURCE_ID_TIMER_5SEC;
11433                                 }
11434                                 break;
11435
11436                         case SETTING_TIMER_CAPTURE_10_SEC:
11437                                 {
11438                                         resId = RESOURCE_ID_TIMER_10SEC;
11439                                 }
11440                                 break;
11441
11442                         default:
11443                                 break;
11444                         }
11445
11446                         String arrString[] =
11447                         {
11448                                 IDS_CAM_BODY_OFF,
11449                                 IDS_CAM_BODY_2_SEC,
11450                                 IDS_CAM_BODY_5_SEC,
11451                                 IDS_CAM_BODY_10_SEC,
11452                         };
11453
11454                         pAppResource->GetString(arrString[index], tmpString);
11455
11456                         r = _pCameraPresentationModel->GetValue(TIMER_INTERVAL, regVal);
11457                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11458
11459                         if (index == regVal)
11460                         {
11461                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11462                         }
11463                         else
11464                         {
11465                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11466                         }
11467                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11468
11469                         elementId = (index * MENU_TWO_ELEMENT);
11470                         elementId++;
11471                         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11472                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11473
11474                         elementId++;
11475                         pBitmap = ResourceManager::GetBitmapN(resId);
11476
11477                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11478                         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11479                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11480                         delete pBitmap;
11481                         pBitmap = null;
11482
11483                         elementId++;
11484                         r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11485                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11486                 }
11487                 break;
11488
11489         case GENERAL_TAB_SUB_MENU_CONTENT_GUIDELINE_MODE:
11490                 {
11491                         ResourceId resId = RESOURCE_ID_GUIDELINE_OFF;
11492
11493                         switch (index)
11494                         {
11495                         case SUBMENU_GUIDELINE_OFF:
11496                                 {
11497                                         resId = RESOURCE_ID_GUIDELINE_OFF;
11498                                 }
11499                                 break;
11500
11501                         case SUBMENU_GUIDELINE_ON:
11502                                 {
11503                                         resId = RESOURCE_ID_GUIDELINE_ON;
11504                                 }
11505                                 break;
11506
11507                         default:
11508                                 break;
11509                         }
11510                         String str = L"";
11511                         elementId = (index * MENU_TWO_ELEMENT);
11512
11513                         r = _pCameraPresentationModel->GetValue(GUIDELINE_ENABLE, regVal);
11514                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11515
11516                         if (index == regVal)
11517                         {
11518                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11519                         }
11520                         else
11521                         {
11522                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11523                         }
11524                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11525
11526                         if (index == SUBMENU_MODE_OFF)
11527                         {
11528                                 str = IDS_CAM_BODY_OFF;
11529                         }
11530                         else
11531                         {
11532                                 str = IDS_CAM_BODY_ON;
11533                         }
11534
11535                         pAppResource->GetString(str, tmpString);
11536
11537                         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11538                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11539
11540                         delete pBitmap;
11541                         pBitmap = null;
11542
11543                         elementId++;
11544
11545                         pBitmap = ResourceManager::GetBitmapN(resId);
11546                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11547
11548                         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11549                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11550
11551                         delete pBitmap;
11552                         pBitmap = null;
11553
11554                         elementId++;
11555                         r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11556                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11557                 }
11558                 break;
11559
11560         case GENERAL_TAB_SUB_MENU_CONTENT_STORAGE_TYPE_MODE:
11561                 {
11562                         ResourceId resId = RESOURCE_ID_STORAGE_PHONE;
11563
11564                         switch (index)
11565                         {
11566                         case SUBMENU_MODE_OFF:
11567                                 {
11568                                         resId = RESOURCE_ID_STORAGE_PHONE;
11569                                 }
11570                                 break;
11571
11572                         case SUBMENU_MODE_ON:
11573                                 {
11574                                         resId = RESOURCE_ID_STORAGE_CARD;
11575                                 }
11576                                 break;
11577
11578                         default:
11579                                 break;
11580                         }
11581                         String str = L"";
11582                         elementId = (index * MENU_TWO_ELEMENT);
11583
11584                         r = _pCameraPresentationModel->GetValue(STORAGE_TYPE, regVal);
11585                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11586
11587                         if (index == regVal)
11588                         {
11589                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11590                         }
11591                         else
11592                         {
11593                                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11594                         }
11595                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11596
11597                         if (index == STORAGE_TYPE_PHONE)
11598                         {
11599                                 str = IDS_CAM_BODY_PHONE;
11600                         }
11601                         else
11602                         {
11603                                 str = IDS_CAM_OPT_MEMORY_CARD;
11604                         }
11605
11606                         pAppResource->GetString(str, tmpString);
11607
11608                         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11609                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11610
11611                         delete pBitmap;
11612                         pBitmap = null;
11613                         elementId++;
11614
11615                         pBitmap = ResourceManager::GetBitmapN(resId);
11616                         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11617
11618                         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11619                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11620
11621                         delete pBitmap;
11622                         pBitmap = null;
11623
11624                         elementId++;
11625
11626                         if (str.Equals(String(IDS_CAM_OPT_MEMORY_CARD)))
11627                         {
11628                                 if (_pCameraPresentationModel->IsStorageCardMounted() == false)
11629                                 {
11630                                         r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
11631                                 }
11632                                 else
11633                                 {
11634                                         r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11635                                 }
11636                         }
11637                         else
11638                         {
11639                                 r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11640                         }
11641                         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11642                 }
11643                 break;
11644
11645         case GENERAL_TAB_SUB_MENU_OVERLAY_HELP_MODE:
11646                 {
11647                 }
11648                 break;
11649
11650         default:
11651                 break;
11652         }
11653
11654         AppLogDebug("EXIT");
11655         return pItem;
11656
11657 CATCH:
11658         delete pItem;
11659         pItem = null;
11660
11661         delete pBitmap;
11662         pBitmap = null;
11663
11664         AppLogDebug("EXIT - CATCH");
11665         return null;
11666 }
11667
11668 CustomItem*
11669 CameraForm::CreateFlashMainMenuItem(int index, int itemWidth)
11670 {
11671         AppLogDebug("ENTER");
11672         CustomItem* pItem = null;
11673         Bitmap* pBitmap = null;
11674         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON + X_FLASH_SETTING_SUBMENU_RADIO_ICON_MARGIN, Y_SETTING_SUBMENU_RADIO_ICON,
11675                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
11676         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON - X_SETTING_SUBMENU_ICON_MARGIN, Y_SETTING_SUBMENU_ICON,
11677                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
11678         String listName = L"";
11679         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM - X_FLASH_SETTING_SUBMENU_3TEXT_ITEM, Y_SETTING_SUBMENU_3TEXT_ITEM,
11680                                                                                         W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
11681         AppResource* pAppResource = null;
11682         String tmpString;
11683         result r = E_SUCCESS;
11684         int elementId = 0;
11685         int regVal = 0;
11686         bool value = false;
11687         int selfPortraitEnable = 0;
11688         int flashMode = 0;
11689         ResourceId resId = RESOURCE_ID_CAMERA_MODE_FLASH_ON_NOR;
11690
11691         String arrString[] =
11692         {
11693                 IDS_CAM_BODY_OFF,
11694                 IDS_CAM_BODY_ON,
11695                 IDS_CAM_BODY_AUTO,
11696         };
11697
11698         pItem = new (std::nothrow) CustomItem();
11699         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
11700
11701         r = pItem->Construct(Dimension(itemWidth, H_SETTING_SUBMENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
11702         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
11703
11704         pAppResource = Application::GetInstance()->GetAppResource();
11705         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
11706
11707         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
11708         TryCatch(r == E_SUCCESS, , "GetValue Reg Fail[%s]", GetErrorMessage(r));
11709
11710         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
11711         {
11712                 AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is not support");
11713
11714                 r = _pCameraPresentationModel->GetValue(FLASH_MODE_SECONDARY, flashMode);
11715                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11716
11717                 if (flashMode != FLASH_MODE_OFF)
11718                 {
11719                         r = _pCameraPresentationModel->SetValue(FLASH_MODE_SECONDARY, FLASH_MODE_OFF);
11720                         TryCatch(r == E_SUCCESS, , "SetValue Reg Fail[%s]", GetErrorMessage(r));
11721                 }
11722         }
11723         else
11724         {
11725                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
11726
11727                 if (value == true && r == E_SUCCESS)
11728                 {
11729                         AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is support");
11730                 }
11731                 else
11732                 {
11733                         AppLogDebug("CAMERA_PRIMARY_SUPPORT_FLASH is not support");
11734
11735                         r = _pCameraPresentationModel->GetValue(FLASH_MODE_PRIMARY, flashMode);
11736                         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11737
11738                         if (flashMode != FLASH_MODE_OFF)
11739                         {
11740                                 r = _pCameraPresentationModel->SetValue(FLASH_MODE_PRIMARY, FLASH_MODE_OFF);
11741                                 TryCatch(r == E_SUCCESS, , "SetValue Reg Fail[%s]", GetErrorMessage(r));
11742                         }
11743                 }
11744         }
11745
11746         r = _pCameraPresentationModel->GetValue(FLASH_MODE_PRIMARY, regVal);
11747         TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11748
11749         switch (index)
11750         {
11751         case SUBMENU_MODE_OFF:
11752                 {
11753                         resId = RESOURCE_ID_CAMERA_MODE_FLASH_OFF_NOR;
11754                 }
11755                 break;
11756
11757         case SUBMENU_MODE_ON:
11758                 {
11759                         resId = RESOURCE_ID_CAMERA_MODE_FLASH_ON_NOR;
11760                 }
11761                 break;
11762
11763         case SUBMENU_MODE_AUTO:
11764                 {
11765                         resId = RESOURCE_ID_CAMERA_MODE_FLASH_AUTO_NOR;
11766                 }
11767                 break;
11768
11769         default:
11770                 break;
11771         }
11772
11773         pAppResource->GetString(arrString[index], tmpString);
11774
11775         if (index == regVal)
11776         {
11777                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11778         }
11779         else
11780         {
11781                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11782         }
11783         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11784
11785         elementId = (index * MENU_TWO_ELEMENT);
11786         elementId++;
11787         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11788         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11789
11790         delete pBitmap;
11791         pBitmap = null;
11792
11793         elementId++;
11794         pBitmap = ResourceManager::GetBitmapN(resId);
11795         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11796
11797         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11798         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11799
11800         delete pBitmap;
11801         pBitmap = null;
11802
11803         elementId++;
11804
11805         r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_SUPPORT_FLASH, value);
11806
11807         if (value == true && r == E_SUCCESS)
11808         {
11809                 r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11810                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11811         }
11812         else
11813         {
11814                 r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_MENU_ITEM, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, COLOR_SETTING_MENU_VALUE_DISABLE, true);
11815                 TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11816         }
11817
11818         AppLogDebug("EXIT");
11819         return pItem;
11820
11821 CATCH:
11822         delete pItem;
11823         pItem = null;
11824
11825         delete pBitmap;
11826         pBitmap = null;
11827
11828         AppLogDebug("EXIT - CATCH");
11829         return null;
11830 }
11831
11832 CustomItem*
11833 CameraForm::CreateWhiteBalanceItem(int index, int itemWidth)
11834 {
11835         AppLogDebug("ENTER");
11836         CustomItem* pItem = null;
11837         Bitmap* pBitmap = null;
11838         Rectangle rectRadioIcon = Rectangle(X_SETTING_SUBMENU_RADIO_ICON + X_WHITE_BALANCE_RADIO_ICON_MARGIN, Y_SETTING_SUBMENU_RADIO_ICON,
11839                                                                                 W_SETTING_SUBMENU_RADIO_ICON, H_SETTING_SUBMENU_RADIO_ICON);
11840         Rectangle rectIcon = Rectangle(X_SETTING_SUBMENU_ICON - X_SETTING_SUBMENU_ICON_MARGIN, Y_SETTING_SUBMENU_ICON,
11841                                                                 W_SETTING_SUBMENU_ICON, H_SETTING_SUBMENU_ICON);
11842         String listName = L"";
11843         Rectangle rectContents = Rectangle(X_SETTING_MENU_CONTESTS, Y_SETTING_MENU_CONTESTS,
11844                                                                         W_SETTING_MENU_CONTESTS, H_SETTING_MENU_CONTESTS);
11845
11846         Rectangle rectContentsValue = Rectangle(X_SETTING_MENU_CONTENTS_VALUE, Y_SETTING_MENU_CONTENTS_VALUE,
11847                                                                                         W_SETTING_MENU_CONTENTS_VALUE, H_SETTING_MENU_CONTENTS_VALUE);
11848
11849         Rectangle rectTwoTextItem = Rectangle(X_SETTING_SUBMENU_2TEXT_ITEM, Y_SETTING_SUBMENU_2TEXT_ITEM,
11850                                                                                         W_SETTING_SUBMENU_2TEXT_ITEM, H_SETTING_SUBMENU_2TEXT_ITEM);
11851         Rectangle rectThreeTextItem = Rectangle(X_SETTING_SUBMENU_3TEXT_ITEM - X_FLASH_SETTING_SUBMENU_3TEXT_ITEM, Y_SETTING_SUBMENU_3TEXT_ITEM,
11852                                                                                                 W_SETTING_SUBMENU_3TEXT_ITEM, H_SETTING_SUBMENU_3TEXT_ITEM);
11853         AppResource* pAppResource = null;
11854         String tmpString;
11855         result r = E_SUCCESS;
11856         int elementId = 0;
11857         int regVal = 0;
11858         int selfPortraitEnable = 0;
11859         ResourceId resId = RESOURCE_ID_WB_AWB;
11860
11861         String arrString[] =
11862         {
11863                 IDS_CAM_BODY_AUTO,
11864                 IDS_CAM_BODY_WHITEBALANCE_INCANDESCENT,
11865                 IDS_CAM_BODY_FLUORESCENT,
11866                 IDS_CAM_BODY_DAYLIGHT,
11867                 IDS_CAM_BODY_CLOUDY,
11868         };
11869
11870         pItem = new (std::nothrow) CustomItem();
11871         TryCatch(pItem != null, , "Failed to allocate memory for CustomItem");
11872
11873         r = pItem->Construct(Dimension(itemWidth, H_SETTING_SUBMENU_ITEM), LIST_ANNEX_STYLE_NORMAL);
11874         TryCatch(r == E_SUCCESS, , "Failed to construct CustomItem");
11875
11876         pAppResource = Application::GetInstance()->GetAppResource();
11877         TryCatch(pAppResource != null, , "Failed to allocate memory for pAppResource");
11878
11879         r = _pCameraPresentationModel->GetValue(SELF_PORTRAIT_ENABLE, selfPortraitEnable);
11880         TryCatch(r == E_SUCCESS, , "GetValue Reg Fail[%s]", GetErrorMessage(r));
11881
11882         if (selfPortraitEnable == CameraPresentationModel::CAM_SELF_PORTRAIT_MODE_SECONDARY)
11883         {
11884                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_SECONDARY_WHITE_BALANCE);
11885                 if (r != E_SUCCESS)
11886                 {
11887                         r =_pCameraPresentationModel->SetValue(WHITE_BALANCE_TYPE_SECONDARY, REG_DEFAULT_VAULE_ZERO);
11888                 }
11889                 r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_SECONDARY, regVal);
11890                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11891         }
11892         else
11893         {
11894                 r = _pCameraPresentationModel->GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
11895                 if (r != E_SUCCESS)
11896                 {
11897                         r =_pCameraPresentationModel->SetValue(WHITE_BALANCE_TYPE_PRIMARY, REG_DEFAULT_VAULE_ZERO);
11898                 }
11899                 r = _pCameraPresentationModel->GetValue(WHITE_BALANCE_TYPE_PRIMARY, regVal);
11900                 TryCatch(r == E_SUCCESS, , "GetValue() fail[%s]", GetErrorMessage(r));
11901         }
11902
11903         AppLogDebug("regVal = %d", regVal);
11904
11905         switch (index)
11906         {
11907         case MODE_AUTO:
11908                 {
11909                         resId = RESOURCE_ID_WB_AWB;
11910                 }
11911                 break;
11912
11913         case MODE_WHITEBALANCE_INCANDESCENT:
11914                 {
11915                         resId = RESOURCE_ID_WB_DAYLIGHT;
11916                 }
11917                 break;
11918
11919         case MODE_FLUORESCENT:
11920                 {
11921                         resId = RESOURCE_ID_WB_CLOUDY;
11922                 }
11923                 break;
11924
11925         case MODE_DAYLIGHT:
11926                 {
11927                         resId = RESOURCE_ID_WB_FLUORESCENT_H;
11928                 }
11929                 break;
11930
11931         case MODE_CLOUDY:
11932                 {
11933                         resId = RESOURCE_ID_WB_FLUORESCENT_L;
11934                 }
11935                 break;
11936
11937         default:
11938                 break;
11939         }
11940
11941         pAppResource->GetString(arrString[index], tmpString);
11942
11943         if (index == regVal)
11944         {
11945                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_ON);
11946         }
11947         else
11948         {
11949                 pBitmap = ResourceManager::GetBitmapN(RESOURCE_ID_CAMERA_RADIO_BTN_OFF);
11950         }
11951         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11952
11953         elementId = (index * MENU_THREE_ELEMENT);
11954         elementId++;
11955         r = pItem->AddElement(rectRadioIcon, elementId, *pBitmap, null, null);
11956         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11957
11958         delete pBitmap;
11959         pBitmap = null;
11960
11961         elementId++;
11962         pBitmap = ResourceManager::GetBitmapN(resId);
11963         TryCatch(pBitmap != null, r = E_SYSTEM, "pBitmap is null");
11964
11965         r = pItem->AddElement(rectIcon, elementId, *pBitmap, null, null);
11966         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11967
11968         delete pBitmap;
11969         pBitmap = null;
11970
11971         elementId++;
11972         r = pItem->AddElement(rectThreeTextItem, elementId, tmpString, FONT_SIZE_SETTING_SUB_MENU_ITEM, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, COLOR_SETTING_MENU_TITLE, true);
11973         TryCatch(r == E_SUCCESS, , "CustomItem::AddElement() fail[%s]", GetErrorMessage(r));
11974
11975         AppLogDebug("EXIT");
11976         return pItem;
11977
11978 CATCH:
11979         delete pItem;
11980         pItem = null;
11981
11982         delete pBitmap;
11983         pBitmap = null;
11984
11985         AppLogDebug("EXIT - CATCH");
11986         return null;
11987 }
11988
11989 void
11990 CameraForm::UpdatePopUp(void)
11991 {
11992         bool doHidePopup = false;
11993         MakeSettingPopupTab(false);
11994
11995         doHidePopup = OnTouchDoHidePopup();
11996         AppLogDebug("doHidePopup = %d", doHidePopup);
11997         if (doHidePopup)
11998         {
11999                 HidePopup();
12000         }
12001 }
12002
12003 void
12004 CameraForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
12005 {
12006         AppLogDebug("ENTER");
12007         if (!__isTimerRunning)
12008         {
12009                 BackButtonPerformed();
12010         }
12011         AppLogDebug("Exit");
12012 }
12013
12014 void
12015 CameraForm::OnKeyLongPressed (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode)
12016 {
12017         //Empty Implementation
12018 }
12019
12020 void
12021 CameraForm::OnKeyPressed(const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode)
12022 {
12023         //Empty Implementation
12024 }
12025
12026 void
12027 CameraForm::OnKeyReleased (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode)
12028 {
12029         AppLogDebug("Enter");
12030         switch (keyCode)
12031         {
12032         case KEY_RIGHT:
12033                 if ((source.GetName().Equals(String(IDS_ACTION_UI_CAMERA_MODE))))
12034                 {
12035                         OnTouchModeSwitch();
12036                 }
12037                 break;
12038
12039         default:
12040                 break;
12041         }
12042         AppLogDebug("Exit");
12043 }
12044
12045 void
12046 CameraForm::OnAccessibilityActionPerformed (const Control &control, const AccessibilityElement &element)
12047 {
12048         AppLogDebug("Enter");
12049
12050         if ((control.GetName().Equals(String(IDS_ACTION_UI_CAMERA_MODE))))
12051         {
12052                 OnTouchModeSwitch();
12053         }
12054         AppLogDebug("Exit");
12055 }
12056
12057 void
12058 CameraForm::OnAccessibilityFocusIn (const Control &control, const AccessibilityElement &element)
12059 {
12060         AppLogDebug("Enter");
12061         AppLogDebug("Exit");
12062 }
12063
12064 void
12065 CameraForm::OnAccessibilityFocusOut (const Control &control, const AccessibilityElement &element)
12066 {
12067         AppLogDebug("Enter");
12068         AppLogDebug("Exit");
12069 }
12070
12071 void
12072 CameraForm::OnAccessibilityScreenReaderStatusChanged (const Control &control, const AccessibilityElement &element, AccessibilityScreenReaderStatus status)
12073 {
12074         AppLogDebug("Enter");
12075         AppLogDebug("Exit");
12076 }