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