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