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