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