|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Container class for still image and video post-capture views* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikmenub.h> |
|
21 #include <aknview.h> |
|
22 #include <avkon.hrh> |
|
23 #include <gulutil.h> |
|
24 #include <AknUtils.h> |
|
25 #include <AknsFrameBackgroundControlContext.h> |
|
26 #include <AknsDrawUtils.h> |
|
27 #include <cameraapp.rsg> |
|
28 #include <vgacamsettings.rsg> |
|
29 #include <aknlayoutscalable_apps.cdl.h> |
|
30 #include <layoutmetadata.cdl.h> |
|
31 #include <cameraapp.mbg> |
|
32 |
|
33 #include <touchfeedback.h> |
|
34 |
|
35 #include "CamPanic.h" |
|
36 #include "CamAppUi.h" |
|
37 #include "CamPostCaptureContainer.h" |
|
38 #include "CamAppController.h" |
|
39 #include "CamLogger.h" |
|
40 #include "CamUtility.h" |
|
41 #include "CamNaviCounterControl.h" |
|
42 #include "CamNaviProgressBarControl.h" |
|
43 #include "OstTraceDefinitions.h" |
|
44 #ifdef OST_TRACE_COMPILER_IN_USE |
|
45 #include "CamPostCaptureContainerTraces.h" |
|
46 #endif |
|
47 |
|
48 |
|
49 |
|
50 // CONSTANTS |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ======================= |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CCamPostCaptureContainer::NewL |
|
56 // Symbian OS two-phased constructor |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CCamPostCaptureContainer* CCamPostCaptureContainer::NewL( |
|
60 CCamAppController& aController, |
|
61 CAknView& aView, |
|
62 const TRect& aRect ) |
|
63 { |
|
64 CCamPostCaptureContainer* self = new( ELeave ) CCamPostCaptureContainer( |
|
65 aController, aView ); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL( aRect ); |
|
68 CleanupStack::Pop( self ); |
|
69 // return newly created CCamPostCaptureContainer instance |
|
70 return self; |
|
71 } |
|
72 |
|
73 // Destructor |
|
74 CCamPostCaptureContainer::~CCamPostCaptureContainer() |
|
75 { |
|
76 PRINT( _L("Camera => ~CCamPostCaptureContainer" )) |
|
77 |
|
78 iController.RemoveControllerObserver( this ); |
|
79 delete iBatteryPaneController; |
|
80 if(iPlayIcon) |
|
81 { |
|
82 delete iPlayIcon; |
|
83 iPlayIcon = NULL; |
|
84 } |
|
85 if(iPlayIconMask) |
|
86 { |
|
87 delete iPlayIconMask; |
|
88 iPlayIconMask = NULL; |
|
89 } |
|
90 if(iPlayIconBg) |
|
91 { |
|
92 delete iPlayIconBg; |
|
93 iPlayIconBg = NULL; |
|
94 } |
|
95 if(iPlayIconBgMask) |
|
96 { |
|
97 delete iPlayIconBgMask; |
|
98 iPlayIconBgMask = NULL; |
|
99 } |
|
100 if(iPlayIconBgPressed) |
|
101 { |
|
102 delete iPlayIconBgPressed; |
|
103 iPlayIconBgPressed = NULL; |
|
104 } |
|
105 if(iPlayIconBgPressedMask) |
|
106 { |
|
107 delete iPlayIconBgPressedMask; |
|
108 iPlayIconBgPressedMask = NULL; |
|
109 } |
|
110 PRINT( _L("Camera <= ~CCamPostCaptureContainer" )) |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------- |
|
114 // CCamPostCaptureContainer::ConstructL |
|
115 // Symbian OS 2nd phase constructor |
|
116 // --------------------------------------------------------- |
|
117 // |
|
118 void CCamPostCaptureContainer::ConstructL( const TRect& aRect ) |
|
119 { |
|
120 CCamContainerBase::BaseConstructL( aRect ); |
|
121 iController.AddControllerObserverL( this ); |
|
122 |
|
123 AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, iScreenSize ); |
|
124 CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi()); |
|
125 // Do not construct battery pane controller, if secondary camera is in use |
|
126 if ( iController.ActiveCamera() != ECamActiveCameraSecondary || |
|
127 appUi->IsQwerty2ndCamera() ) |
|
128 { |
|
129 iBatteryPaneController = CCamBatteryPaneController::NewL( *this, ETrue); |
|
130 } |
|
131 |
|
132 if( ECamControllerImage == iController.CurrentMode() ) |
|
133 { |
|
134 // Still mode - processing text needed |
|
135 PrepareProcessingTextL( ETrue ); |
|
136 } |
|
137 if ( iView.Id().iUid == ECamViewIdVideoPostCapture ) |
|
138 { |
|
139 _LIT(KResName, "z:\\resource\\apps\\cameraapp.mif"); |
|
140 TSize playIconSize( 140, 92); |
|
141 AknIconUtils::CreateIconL( |
|
142 iPlayIcon, |
|
143 iPlayIconMask, |
|
144 KResName(), |
|
145 EMbmCameraappQgn_indi_media_fullscreen_play, |
|
146 EMbmCameraappQgn_indi_media_fullscreen_play_mask); |
|
147 AknIconUtils::SetSize(iPlayIcon,playIconSize,EAspectRatioPreserved); |
|
148 AknIconUtils::SetSize(iPlayIconMask,playIconSize,EAspectRatioPreserved); |
|
149 |
|
150 //!!Please don't remove this commented section |
|
151 /*TSize playIconSize(40,40); |
|
152 AknIconUtils::CreateIconL( |
|
153 iPlayIcon, |
|
154 iPlayIconMask, |
|
155 KResName(), |
|
156 EMbmCameraappQgn_indi_cam4_tb_play, |
|
157 EMbmCameraappQgn_indi_cam4_tb_play_mask); |
|
158 AknIconUtils::SetSize(iPlayIcon,playIconSize,EAspectRatioPreserved); |
|
159 AknIconUtils::SetSize(iPlayIconMask,playIconSize,EAspectRatioPreserved); |
|
160 |
|
161 TSize playIconBgSize(140,92); |
|
162 AknIconUtils::CreateIconL( |
|
163 iPlayIconBg, |
|
164 iPlayIconBgMask, |
|
165 KResName(), |
|
166 EMbmCameraappQgn_bg_lcam_vid_postcap_play, |
|
167 EMbmCameraappQgn_bg_lcam_vid_postcap_play_mask); |
|
168 AknIconUtils::SetSize(iPlayIconBg,playIconBgSize,EAspectRatioPreserved); |
|
169 AknIconUtils::SetSize(iPlayIconBgMask,playIconBgSize,EAspectRatioPreserved); |
|
170 AknIconUtils::CreateIconL( |
|
171 iPlayIconBgPressed, |
|
172 iPlayIconBgPressedMask, |
|
173 KResName(), |
|
174 EMbmCameraappQgn_bg_lcam_vid_postcap_play_pressed, |
|
175 EMbmCameraappQgn_bg_lcam_vid_postcap_play_pressed_mask); |
|
176 AknIconUtils::SetSize(iPlayIconBgPressed,playIconBgSize,EAspectRatioPreserved); |
|
177 AknIconUtils::SetSize(iPlayIconBgPressedMask,playIconBgSize,EAspectRatioPreserved);*/ |
|
178 } |
|
179 |
|
180 // Make sure fixed toolbar is on top of this window |
|
181 DrawableWindow()->SetOrdinalPosition( KCamPostCaptureWindowOrdinalPos ); |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // CCamPostCaptureContainer::CCamPostCaptureContainer |
|
186 // C++ constructor |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 CCamPostCaptureContainer::CCamPostCaptureContainer( |
|
190 CCamAppController& aController, |
|
191 CAknView& aView ) |
|
192 : CCamContainerBase( aController, aView ), |
|
193 iCheckForFileNameChange( EFalse ) |
|
194 { |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------- |
|
198 // CCamViewFinderContainer::CountComponentControls |
|
199 // Returns the number of controls owned |
|
200 // --------------------------------------------------------- |
|
201 // |
|
202 TInt CCamPostCaptureContainer::CountComponentControls() const |
|
203 { |
|
204 TInt count = CCamContainerBase::CountComponentControls(); |
|
205 if( ( iPaneInUse == ECamPaneCounter ) || ( iPaneInUse == ECamPaneProgress ) ) |
|
206 { |
|
207 count++; |
|
208 } |
|
209 |
|
210 if ( !iController.IsTouchScreenSupported() ) |
|
211 { |
|
212 if(iActivePalette && iActivePalette->CoeControl()->IsVisible()) |
|
213 { |
|
214 count++; //Active Palette |
|
215 } |
|
216 } |
|
217 |
|
218 return count; |
|
219 } |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CCamPostCaptureContainer::ComponentControl |
|
223 // Return specified control owned by this control |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 CCoeControl* CCamPostCaptureContainer::ComponentControl( TInt aIndex ) const |
|
227 { |
|
228 CCoeControl* con = CCamContainerBase::ComponentControl( aIndex ); |
|
229 if( con ) |
|
230 return con; |
|
231 switch( aIndex ) |
|
232 { |
|
233 case ECamPostCaptureSubControlNaviPane: |
|
234 { |
|
235 switch( iPaneInUse ) |
|
236 { |
|
237 case ECamPaneCounter: |
|
238 { |
|
239 con = iNaviCounterControl; |
|
240 break; |
|
241 } |
|
242 case ECamPaneProgress: |
|
243 { |
|
244 con = iNaviCounterControl; |
|
245 break; |
|
246 } |
|
247 case ECamPaneUndefined: |
|
248 { |
|
249 break; |
|
250 } |
|
251 } |
|
252 break; |
|
253 } |
|
254 case ECamPostCaptureActivePalette: |
|
255 { |
|
256 if(iActivePalette && iActivePalette->CoeControl()->IsVisible()) |
|
257 { |
|
258 con = iActivePalette->CoeControl(); |
|
259 } |
|
260 break; |
|
261 } |
|
262 |
|
263 default: |
|
264 break; |
|
265 } |
|
266 return con; |
|
267 |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------- |
|
271 // CCamPostCaptureContainer::Draw |
|
272 // Draw control |
|
273 // --------------------------------------------------------- |
|
274 // |
|
275 void CCamPostCaptureContainer::Draw( const TRect& /*aRect*/ ) const |
|
276 { |
|
277 CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi()); |
|
278 |
|
279 if ( appUi && appUi->Embedding() && !appUi->ReadyToDraw() && |
|
280 iController.ActiveCamera() == ECamActiveCameraPrimary ) |
|
281 { |
|
282 // Flickering can be reduced if view is not drawn due to 'wrong' |
|
283 // orientation change. False redraw events may come if device |
|
284 // orientation is changed - even if camera app is in the background. |
|
285 // |
|
286 // Primary camera does not support other than landscape mode, thus we |
|
287 // must always return to it when embedded application is closed. |
|
288 return; |
|
289 } |
|
290 |
|
291 if ( appUi && iCheckForFileNameChange ) |
|
292 { |
|
293 // whenever we come back from Properties view |
|
294 // we check if the file name has changed already |
|
295 appUi->StartFileNameCheck(); |
|
296 } |
|
297 // Draw the current image - snapshot or thumbnail |
|
298 CWindowGc& gc = SystemGc(); |
|
299 const CFbsBitmap* snapshot = iController.SnapshotImage(); |
|
300 TRect containerRect = Rect(); |
|
301 |
|
302 TBool lateOperation = ( ECamCapturing == iController.CurrentOperation() |
|
303 || ECamCompleting == iController.CurrentOperation() ); |
|
304 |
|
305 if ( iView.Id().iUid != ECamViewIdVideoPostCapture && |
|
306 ( iController.ActiveCamera() != ECamActiveCameraSecondary || |
|
307 lateOperation ) ) |
|
308 { |
|
309 gc.SetFaded( EFalse ); |
|
310 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
311 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
312 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
313 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
314 gc.Clear( iProcessingTextLayout.TextRect() ); |
|
315 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
316 } |
|
317 |
|
318 // If snapshot contains a bitmap |
|
319 if ( snapshot ) |
|
320 { |
|
321 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMPOSTCAPTURECONTAINER_DRAW, "e_CAM_APP_SNAPSHOT_DRAW 1" ); //CCORAPP_SNAPSHOT_DRAW_START |
|
322 |
|
323 TSize snapshotSize = snapshot->SizeInPixels(); |
|
324 TRect bmCropRect( snapshotSize ); |
|
325 |
|
326 // Get the required snapshot layout rect |
|
327 TRect vfRect( ViewFinderFrameRect() ); |
|
328 |
|
329 |
|
330 // Standard CIF size snapshot, this could be either a video or |
|
331 // still image snapshot. Get the size to display and |
|
332 // crop the bitmap if necessary. |
|
333 |
|
334 if ( iView.Id().iUid == ECamViewIdVideoPostCapture ) |
|
335 { |
|
336 // This is a video snapshot - work out if it needs cropping |
|
337 |
|
338 TInt res = iController.GetCurrentVideoResolution(); |
|
339 |
|
340 if ( res != ECamVideoResolutionNHD ) |
|
341 { |
|
342 // Work out the rectangle of the viewfinder bitmap to draw |
|
343 TInt borderX = ( snapshotSize.iWidth - vfRect.Width() ) / 2; |
|
344 TInt borderY = ( snapshotSize.iHeight - vfRect.Height() ) / 2; |
|
345 bmCropRect.SetRect( borderX, |
|
346 borderY, |
|
347 snapshotSize.iWidth - borderX, |
|
348 snapshotSize.iHeight - borderY ); |
|
349 } |
|
350 } |
|
351 |
|
352 gc.BitBlt( vfRect.iTl, snapshot, bmCropRect ); |
|
353 |
|
354 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMPOSTCAPTURECONTAINER_DRAW, "e_CAM_APP_SNAPSHOT_DRAW 0" ); //CCORAPP_SNAPSHOT_DRAW_END |
|
355 } |
|
356 |
|
357 if( iProcessingText && //iProcessingBg && |
|
358 iController.ActiveCamera() != ECamActiveCameraSecondary && |
|
359 lateOperation ) |
|
360 { |
|
361 PRINT( _L("Camera <> CCamPostCaptureContainer: draw processing text..") ); |
|
362 // When iProcessingText exists (and we are in correct state), the processing |
|
363 // image text needs to be drawn. |
|
364 //iProcessingBg->Draw( gc, Rect() ); |
|
365 |
|
366 gc.SetBrushColor( KRgbWhite ); |
|
367 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
368 iProcessingTextLayout.DrawText( gc, *iProcessingText, ETrue, KRgbBlack ); |
|
369 } |
|
370 |
|
371 if( iBatteryPaneController ) |
|
372 { |
|
373 if( iPaneInUse == ECamPaneCounter ) |
|
374 { |
|
375 iNaviCounterControl->DrawNaviCtr( gc ); |
|
376 } |
|
377 // Draw the battery pane |
|
378 iBatteryPaneController->Draw( gc ); |
|
379 } |
|
380 |
|
381 if ( iController.ActiveCamera() == ECamActiveCameraSecondary ) |
|
382 { |
|
383 if( iPaneInUse == ECamPaneCounter ) |
|
384 { |
|
385 iNaviCounterControl->DrawNaviCtr( gc ); |
|
386 } |
|
387 } |
|
388 |
|
389 if ( iView.Id().iUid == ECamViewIdVideoPostCapture ) |
|
390 { |
|
391 TSize playIconSize(140,92); |
|
392 TRect playIconRect(containerRect.Center() - TPoint(70,46),playIconSize); |
|
393 TRect playIconSourceRect(0,0,140,92); |
|
394 |
|
395 //!!Please don't remove this commented section |
|
396 /*TSize playIconSize(40,40); |
|
397 TRect playIconRect(containerRect.Center() - TPoint(20,20),playIconSize); |
|
398 TRect playIconSourceRect(0,0,40,40); |
|
399 |
|
400 TSize playIconBgSize(140,92); |
|
401 TRect playIconBgRect(containerRect.Center() - TPoint(70,46),playIconBgSize); |
|
402 TRect playIconBgSourceRect(0,0,140,92); |
|
403 |
|
404 if(iPlayIconPressed) |
|
405 { |
|
406 gc.BitBltMasked(playIconBgRect.iTl,iPlayIconBgPressed,playIconBgSourceRect,iPlayIconBgPressedMask,EFalse); |
|
407 } |
|
408 else |
|
409 { |
|
410 gc.BitBltMasked(playIconBgRect.iTl,iPlayIconBg,playIconBgSourceRect,iPlayIconBgMask,EFalse); |
|
411 }*/ |
|
412 |
|
413 gc.BitBltMasked(playIconRect.iTl,iPlayIcon,playIconSourceRect,iPlayIconMask,EFalse); |
|
414 |
|
415 } |
|
416 } |
|
417 |
|
418 // ---------------------------------------------------- |
|
419 // CCamPostCaptureContainer::CheckForFileName |
|
420 // |
|
421 // ---------------------------------------------------- |
|
422 // |
|
423 void CCamPostCaptureContainer::CheckForFileName( TBool aDoCheck ) |
|
424 { |
|
425 iCheckForFileNameChange = aDoCheck; |
|
426 } |
|
427 |
|
428 // ---------------------------------------------------- |
|
429 // CCamPostCaptureContainer::OfferKeyEventL |
|
430 // Handles this application view's command keys. Forwards other |
|
431 // keys to child control(s). |
|
432 // ---------------------------------------------------- |
|
433 // |
|
434 TKeyResponse CCamPostCaptureContainer::OfferKeyEventL( |
|
435 const TKeyEvent& aKeyEvent, |
|
436 TEventCode aType ) |
|
437 { |
|
438 CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi()); |
|
439 TBool embedded = appUi->IsEmbedded(); |
|
440 |
|
441 if ( appUi && appUi->CheckCourtesyKeyEventL(aKeyEvent, aType, EFalse) == EKeyWasConsumed ) |
|
442 { |
|
443 return EKeyWasConsumed; |
|
444 } |
|
445 |
|
446 // only handle the shutter key if not in embedded mode |
|
447 if ( !embedded ) |
|
448 { |
|
449 if( aType == EEventKeyUp ) |
|
450 { |
|
451 iController.SetDemandKeyRelease( EFalse ); |
|
452 } |
|
453 |
|
454 TBool captureKey = IsCaptureKeyL( aKeyEvent, aType ); |
|
455 |
|
456 // consume the ECameraKey and exit post capture |
|
457 if ( iView.IsForeground() && |
|
458 ( ( captureKey ) || |
|
459 ( IsShutterKeyL( aKeyEvent, aType ) && |
|
460 ( appUi->CamOrientation() == ECamOrientationCamcorder || |
|
461 appUi->CamOrientation() == ECamOrientationCamcorderLeft ) ) ) |
|
462 ) |
|
463 { |
|
464 if ( aType == EEventKeyDown ) |
|
465 { |
|
466 TInt command = ECamCmdNewPhoto; |
|
467 |
|
468 if ( iView.Id().iUid == ECamViewIdVideoPostCapture ) |
|
469 { |
|
470 command = ECamCmdNewVideo; |
|
471 } |
|
472 iView.HandleCommandL( command ); |
|
473 // Demand to relese capture key in pre capture view |
|
474 iController.SetDemandKeyRelease( ETrue ); |
|
475 } |
|
476 return EKeyWasConsumed; |
|
477 } |
|
478 } |
|
479 |
|
480 if ( aType == EEventKey ) |
|
481 { |
|
482 TKeyResponse keyResponse = EKeyWasNotConsumed; |
|
483 // Check for 'C' key, to be taken as a delete event |
|
484 if ( aKeyEvent.iScanCode == EStdKeyBackspace ) |
|
485 { |
|
486 iView.HandleCommandL( ECamCmdDelete ); |
|
487 keyResponse = EKeyWasConsumed; |
|
488 } |
|
489 |
|
490 else if ( aKeyEvent.iScanCode == EStdKeyYes ) |
|
491 { |
|
492 // Only perform the quick send functionality if *not* in |
|
493 // embedded mode. If we are embedded, we are technically |
|
494 // already in the process of sending. |
|
495 // |
|
496 // In touch UI, the send key launches the dialler application. |
|
497 if ( !embedded && !AknLayoutUtils::PenEnabled() ) |
|
498 { |
|
499 iView.HandleCommandL( ECamCmdQuickSend ); |
|
500 } |
|
501 |
|
502 keyResponse = EKeyWasConsumed; |
|
503 } |
|
504 else |
|
505 { |
|
506 // do nothing |
|
507 } |
|
508 |
|
509 if ( !iController.IsTouchScreenSupported() ) |
|
510 { |
|
511 if(iActivePalette && iActivePalette->CoeControl()->OfferKeyEventL(aKeyEvent,aType)==EKeyWasConsumed) |
|
512 { |
|
513 keyResponse = EKeyWasConsumed; |
|
514 } |
|
515 } |
|
516 |
|
517 if ( keyResponse == EKeyWasConsumed ) |
|
518 { |
|
519 return keyResponse; |
|
520 } |
|
521 } |
|
522 return CCamContainerBase::OfferKeyEventL( aKeyEvent, aType ); |
|
523 } |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // CCamPostCaptureContainer::HandleControllerEventL |
|
527 // Handle user menu selections |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 void CCamPostCaptureContainer::HandleControllerEventL( TCamControllerEvent aEvent, |
|
531 TInt /*aError*/ ) |
|
532 { |
|
533 PRINT( _L("Camera => CCamPostCaptureContainer::HandleControllerEventL") ); |
|
534 // If this is a capture complete event, or snapshot needs to be drawn |
|
535 if ( aEvent == ECamEventCaptureComplete || |
|
536 aEvent == ECamEventSnapshotReady || |
|
537 aEvent == ECamEventSnapshotRotated ) |
|
538 { |
|
539 DrawNow(); |
|
540 } |
|
541 PRINT( _L("Camera <= CCamPostCaptureContainer::HandleControllerEventL") ); |
|
542 } |
|
543 |
|
544 // --------------------------------------------------------------------------- |
|
545 // CCamContainerBase::ShowZoomPaneWithTimer |
|
546 // Makes Zoom Pane visible for the period of the pane timer. |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 void CCamPostCaptureContainer::ShowZoomPaneWithTimer() |
|
550 { |
|
551 // No implementation: only meaningful in pre-capture modes |
|
552 PRINT(_L("Camera => CCamPostCaptureContainer::ShowZoomPaneWithTimer() - No implementation!")); |
|
553 } |
|
554 |
|
555 // ----------------------------------------------------------------------------- |
|
556 // CCamPostCaptureContainer::Redraw |
|
557 // ----------------------------------------------------------------------------- |
|
558 void CCamPostCaptureContainer::Redraw(const TRect& aArea) |
|
559 { |
|
560 PRINT( _L("Camera => CCamPostCaptureContainer::Redraw") ); |
|
561 CWindowGc& gc = SystemGc(); |
|
562 |
|
563 const CFbsBitmap* snapshot = iController.SnapshotImage(); |
|
564 |
|
565 if( iBatteryPaneController ) |
|
566 { |
|
567 if( iPaneInUse == ECamPaneCounter ) |
|
568 { |
|
569 iNaviCounterControl->DrawNaviCtr( gc ); |
|
570 } |
|
571 } |
|
572 |
|
573 // If snapshot contains a bitmap |
|
574 if ( snapshot ) |
|
575 { |
|
576 TRect ssRect( ViewFinderFrameRect() ); |
|
577 TRect outdatedArea( aArea ); |
|
578 TSize snapshotSize = snapshot->SizeInPixels(); |
|
579 // If necessary, the outdated area (aArea) is moved according to the |
|
580 // cropped bitmap. |
|
581 if ( iView.Id().iUid == ECamViewIdVideoPostCapture && |
|
582 iController.GetCurrentVideoResolution() != |
|
583 ECamVideoResolutionNHD ) |
|
584 { |
|
585 // Get the required snapshot layout |
|
586 // Work out the rectangle of the viewfinder bitmap to draw |
|
587 TInt borderX = |
|
588 ( snapshotSize.iWidth - ssRect.Width() ) / 2; |
|
589 TInt borderY = |
|
590 ( snapshotSize.iHeight - ssRect.Height() ) / 2; |
|
591 |
|
592 if ( borderX < 0 ) //the display zone is reduced |
|
593 { |
|
594 if ( iActivePalette && iActivePalette->CoeControl()->IsVisible() ) //active palette is exist |
|
595 { |
|
596 gc.SetBrushColor( KRgbBlack ); |
|
597 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
598 gc.Clear( outdatedArea ); //Clear the initial whole zone |
|
599 } |
|
600 } |
|
601 |
|
602 outdatedArea.Move( borderX, borderY ); //new zone |
|
603 } |
|
604 |
|
605 if ( iController.ActiveCamera() == ECamActiveCameraSecondary ) |
|
606 { |
|
607 // Secondary camera snapshot image doesn't fill whole screen. |
|
608 // Black stripes are handled here. |
|
609 outdatedArea.Move( 0, -ssRect.iTl.iY ); |
|
610 } |
|
611 |
|
612 if ( outdatedArea.iBr.iX > snapshotSize.iWidth ) |
|
613 { |
|
614 // Draw black background for the tooltip. |
|
615 // Mirrored layout is not supported. |
|
616 TRect blackRect = outdatedArea; |
|
617 blackRect.iTl.iX += snapshotSize.iWidth - outdatedArea.iTl.iX; |
|
618 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
619 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
620 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
621 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
622 gc.DrawRect( blackRect ); |
|
623 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
624 } |
|
625 |
|
626 if ( ssRect.Contains( outdatedArea.iTl ) || !iController.IsTouchScreenSupported() ) |
|
627 { |
|
628 PRINT( _L("Camera <> CCamPostCaptureContainer::Redraw snapshot") ); |
|
629 gc.BitBlt( aArea.iTl, snapshot, outdatedArea); |
|
630 } |
|
631 } |
|
632 |
|
633 if( iBatteryPaneController ) |
|
634 { |
|
635 iBatteryPaneController->Draw( gc ); |
|
636 } |
|
637 PRINT( _L("Camera <= CCamPostCaptureContainer::Redraw") ); |
|
638 } |
|
639 |
|
640 // ----------------------------------------------------------------------------- |
|
641 // CCamPostCaptureContainer::BatteryPaneUpdated |
|
642 // |
|
643 // Called by CCamBatteryPaneController when battery pane content has been updated. |
|
644 // Re-draws background under the battery pane and the battery pane itself. |
|
645 // ----------------------------------------------------------------------------- |
|
646 // |
|
647 void CCamPostCaptureContainer::BatteryPaneUpdated() |
|
648 { |
|
649 CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi()); |
|
650 |
|
651 // during sequence capture the battery icon is drawn by precapture container |
|
652 // in sequence postcapture there is not battery icon, so there is no need |
|
653 // to redraw battery or processing text here while sequence mode is enabled |
|
654 if ( iBatteryPaneController && appUi && !appUi->IsBurstEnabled() ) |
|
655 { |
|
656 // Get the battery pane rectangle |
|
657 TRect rect = iBatteryPaneController->Rect(); |
|
658 |
|
659 // Activate Gc |
|
660 ActivateGc(); |
|
661 |
|
662 // Invalidate the battery pane area |
|
663 RWindow window = Window(); |
|
664 window.Invalidate( rect ); |
|
665 window.BeginRedraw( rect ); |
|
666 |
|
667 // Redraw the background in that area |
|
668 iUpdatingBatteryPane = ETrue; |
|
669 Redraw( rect ); |
|
670 iUpdatingBatteryPane = EFalse; |
|
671 |
|
672 // Draw the battery pane |
|
673 CWindowGc& gc = SystemGc(); |
|
674 |
|
675 |
|
676 //Redraw the prosessing text before battery icon |
|
677 if ( iProcessingText && appUi && |
|
678 iController.ActiveCamera() != ECamActiveCameraSecondary && |
|
679 ( ECamCapturing == iController.CurrentOperation() || |
|
680 ECamCompleting == iController.CurrentOperation() ) ) |
|
681 { |
|
682 // When iProcessingText exists (and we are in correct state), the processing |
|
683 // image text needs to be drawn. |
|
684 gc.SetBrushColor( KRgbWhite ); |
|
685 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
686 iProcessingTextLayout.DrawText( gc, *iProcessingText, ETrue, KRgbBlack ); |
|
687 } |
|
688 |
|
689 |
|
690 //iBatteryPaneController->Draw( gc ); |
|
691 |
|
692 // Tell the window redraw is finished and deactivate Gc |
|
693 window.EndRedraw(); |
|
694 DeactivateGc(); |
|
695 } |
|
696 |
|
697 } |
|
698 |
|
699 // ----------------------------------------------------------------------------- |
|
700 // CCamPostCaptureContainer::HandleResourceChange |
|
701 // |
|
702 // Passes resource changes to battery pane controller |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 void |
|
706 CCamPostCaptureContainer::HandleResourceChange( TInt aType ) |
|
707 { |
|
708 if( iBatteryPaneController ) |
|
709 { |
|
710 // Inform battery pane of the resource change |
|
711 iBatteryPaneController->HandleResourceChange( aType ); |
|
712 } |
|
713 |
|
714 CCamContainerBase::HandleResourceChange( aType ); |
|
715 } |
|
716 |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // HandleAppEvent <<virtual>> |
|
720 // |
|
721 // --------------------------------------------------------------------------- |
|
722 // |
|
723 void |
|
724 CCamPostCaptureContainer::HandleAppEvent( const TCamAppEvent& aEvent ) |
|
725 { |
|
726 PRINT( _L("Camera => CCamPostCaptureContainer::HandleAppEvent") ); |
|
727 |
|
728 switch( aEvent ) |
|
729 { |
|
730 case ECamAppEventFocusGained: |
|
731 { |
|
732 iCheckForFileNameChange = ETrue; |
|
733 if( iBatteryPaneController ) |
|
734 iBatteryPaneController->Pause( EFalse ); |
|
735 break; |
|
736 } |
|
737 case ECamAppEventFocusLost: |
|
738 { |
|
739 if( iBatteryPaneController ) |
|
740 iBatteryPaneController->Pause( ETrue ); |
|
741 break; |
|
742 } |
|
743 default: |
|
744 { |
|
745 break; |
|
746 } |
|
747 } |
|
748 |
|
749 PRINT( _L("Camera <= CCamPostCaptureContainer::HandleAppEvent") ); |
|
750 } |
|
751 |
|
752 // ----------------------------------------------------------------------------- |
|
753 // CCamPostCaptureContainer::HandlePointerEventL |
|
754 // |
|
755 // Handles pointer events; From CCoeControl |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 void CCamPostCaptureContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
759 { |
|
760 if ( iView.Id().iUid == ECamViewIdVideoPostCapture ) |
|
761 { |
|
762 TRect containerRect = Rect(); |
|
763 TRect playIconRect(containerRect.Center() - TPoint(35,23), TSize(70,46)); |
|
764 if( playIconRect.Contains(aPointerEvent.iPosition) ) |
|
765 { |
|
766 if ( aPointerEvent.iType == TPointerEvent::EButton1Down || aPointerEvent.iType == TPointerEvent::EDrag) |
|
767 { |
|
768 if(!iDraggedInAlready) |
|
769 { |
|
770 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
771 if ( feedback ) |
|
772 { |
|
773 feedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
774 } |
|
775 iDraggedInAlready = ETrue; |
|
776 iPlayIconPressed = ETrue; |
|
777 DrawNow(); |
|
778 } |
|
779 } |
|
780 else if(aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
781 { |
|
782 iPlayIconPressed = EFalse; |
|
783 iDraggedInAlready = EFalse; |
|
784 //feedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
785 iView.HandleCommandL(ECamCmdPlay); |
|
786 } |
|
787 } |
|
788 else |
|
789 { |
|
790 iDraggedInAlready = EFalse; |
|
791 iPlayIconPressed = EFalse; |
|
792 DrawNow(); |
|
793 } |
|
794 } |
|
795 } |
|
796 |
|
797 // End of File |