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