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