1 /* |
|
2 * Copyright (c) 2007-2010 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 base class for pre-capture views* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikmenub.h> |
|
21 #include <aknview.h> |
|
22 #include <w32std.h> |
|
23 #include <gulutil.h> |
|
24 #include <AknIconUtils.h> |
|
25 #include <barsread.h> // resource reader |
|
26 #include <AknsFrameBackgroundControlContext.h> |
|
27 #include <AknsDrawUtils.h> |
|
28 #include <eikenv.h> |
|
29 #include <eikappui.h> // For CCoeAppUiBase |
|
30 #include <eikapp.h> // For CEikApplication |
|
31 #include <layoutmetadata.cdl.h> |
|
32 #include <aknlayoutscalable_apps.cdl.h> |
|
33 |
|
34 #include <cameraapp.mbg> |
|
35 #include <cameraapp.rsg> |
|
36 #include <vgacamsettings.rsg> |
|
37 #include <touchfeedback.h> |
|
38 #include <akntoolbar.h> |
|
39 #include <akntoolbarextension.h> |
|
40 |
|
41 #include "CamAppUiBase.h" |
|
42 #include "CamPreCaptureContainerBase.h" |
|
43 #include "CamLogger.h" |
|
44 #include "CamSidePane.h" |
|
45 #include "CamUtility.h" |
|
46 #include "CamPanic.h" |
|
47 #include "Cam.hrh" |
|
48 #include "CamAppUi.h" |
|
49 #include "CamIndicator.h" |
|
50 #include "CamIndicatorResourceReader.h" |
|
51 #include "CamIndicatorData.h" |
|
52 #include "CamSelfTimer.h" |
|
53 #include "CamPreCaptureViewBase.h" |
|
54 #include "CamStillPreCaptureView.h" |
|
55 #include "CamSettings.hrh" |
|
56 #include "CamNaviCounterControl.h" |
|
57 #include "CamNaviProgressBarControl.h" |
|
58 #include "camuiconstants.h" // KCamDirectColorVal |
|
59 #include "camactivepalettehandler.h" |
|
60 #include "OstTraceDefinitions.h" |
|
61 #ifdef OST_TRACE_COMPILER_IN_USE |
|
62 #include "CamPreCaptureContainerBaseTraces.h" |
|
63 #endif |
|
64 #include "camconfiguration.h" |
|
65 #include "CameraUiConfigManager.h" |
|
66 #include "camstartuplogo.h" |
|
67 #include "camvfgridinterface.h" |
|
68 #include "camlinevfgriddrawer.h" |
|
69 #include "camcapturebuttoncontainer.h" |
|
70 |
|
71 // CONSTANTS |
|
72 const TInt KZoomPanelTimeout = 4000000; // 4s |
|
73 const TInt KReticuleFlashTimeout = 250000; // Quarter of a second (in microseconds). |
|
74 const TInt KAFIconCorners = 4; // Hip to be square |
|
75 |
|
76 const TInt KIndicatorBlinkDelay = 250 * 1000; |
|
77 const TInt KNumberOfBlinks = 3; |
|
78 const TInt KNumberOfBlinksVideo = 8; |
|
79 |
|
80 const TSize KCaptureButtonSize( 50, 50 ); |
|
81 const TSize KAdditionalArea( 25, 11 ); |
|
82 const TInt32 KCaptureButtonYDelta( 10 ); |
|
83 |
|
84 // Snapshot data is needed in timelapse mode |
|
85 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl |
|
86 | ECamCameraEventClassVfData |
|
87 | ECamCameraEventClassSsData |
|
88 ); |
|
89 |
|
90 |
|
91 |
|
92 // ================= MEMBER FUNCTIONS ======================= |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CCamPreCaptureContainerBase::~CCamPreCaptureContainerBase |
|
96 // Destructor |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CCamPreCaptureContainerBase::~CCamPreCaptureContainerBase() |
|
100 { |
|
101 PRINT( _L("Camera => ~CCamPreCaptureContainerBase" )) |
|
102 |
|
103 if( iCaptureButtonContainer ) |
|
104 { |
|
105 delete iCaptureButtonContainer; |
|
106 } |
|
107 |
|
108 iController.ViewfinderWindowDeleted( &Window() ); |
|
109 |
|
110 iController.RemoveSettingsObserver ( this ); |
|
111 iController.RemoveCameraObserver ( this ); |
|
112 iController.RemoveControllerObserver( this ); |
|
113 |
|
114 if ( iZoomTimer && iZoomTimer->IsActive() ) |
|
115 { |
|
116 iZoomTimer->Cancel(); |
|
117 } |
|
118 delete iZoomTimer; |
|
119 delete iVfGridDrawer; |
|
120 |
|
121 delete iStartupLogo; |
|
122 |
|
123 if ( iController.UiConfigManagerPtr() && |
|
124 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
125 { |
|
126 iAfIcons.ResetAndDestroy(); |
|
127 iLayouts.Close(); |
|
128 if ( iReticuleTimer && iReticuleTimer->IsActive() ) |
|
129 { |
|
130 iReticuleTimer->Cancel(); |
|
131 } |
|
132 delete iReticuleTimer; |
|
133 } |
|
134 |
|
135 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
136 |
|
137 iResolutionIndicators.ResetAndDestroy(); |
|
138 iResolutionIndicators.Close(); |
|
139 if ( iController.UiConfigManagerPtr() && |
|
140 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
141 { |
|
142 PRINT( _L("Camera => ~CCamPreCaptureContainerBase - delete iLocationIconController" )) |
|
143 delete iLocationIconController; |
|
144 } |
|
145 |
|
146 delete iOffScreenBitmap; |
|
147 delete iBitmapDevice; |
|
148 delete iBitmapGc; |
|
149 |
|
150 // if shutting down, observers are removed automatically |
|
151 if ( |
|
152 iController.IsAppUiAvailable() && |
|
153 appUi && !iController.IsInShutdownMode() ) |
|
154 { |
|
155 // Deregister as burst mode observer |
|
156 appUi->RemoveBurstModeObserver( this ); |
|
157 } |
|
158 |
|
159 delete iBatteryPaneController; |
|
160 |
|
161 delete iViewFinderBackup; |
|
162 iViewFinderBackup = NULL; |
|
163 iReceivedVfFrame = EFalse; |
|
164 if( iIndBlinkTimer ) |
|
165 { |
|
166 if( iIndBlinkTimer->IsActive() ) |
|
167 { |
|
168 iIndBlinkTimer->Cancel(); |
|
169 } |
|
170 delete iIndBlinkTimer; |
|
171 iIndBlinkTimer = NULL; |
|
172 } |
|
173 PRINT( _L("Camera <= ~CCamPreCaptureContainerBase" )) |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------- |
|
177 // CCamPreCaptureContainerBase::BaseConstructL |
|
178 // Symbian OS 2nd phase constructor |
|
179 // --------------------------------------------------------- |
|
180 // |
|
181 void CCamPreCaptureContainerBase::BaseConstructL( const TRect& aRect ) |
|
182 { |
|
183 PRINT( _L("Camera => CCamPreCaptureContainerBase::BaseConstructL ") ); |
|
184 |
|
185 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
186 iZoomPane = appUi->ZoomPane(); |
|
187 |
|
188 CCamContainerBase::BaseConstructL( aRect ); |
|
189 |
|
190 iViewFinderBackup = NULL; |
|
191 iReceivedVfFrame = EFalse; |
|
192 |
|
193 // Check whether zoom & side pane will be on the left or the right of the screen |
|
194 TInt handedInt; |
|
195 User::LeaveIfError( CamUtility::GetPsiInt( ECamPsiSidePanePosition, handedInt ) ); |
|
196 iHandedness = static_cast< TCamHandedness >( handedInt ); |
|
197 |
|
198 TResourceReader reader; |
|
199 iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_ZOOM_PANE_WIDTH_ID)); |
|
200 iZoomPaneWidth = reader.ReadInt16(); |
|
201 CleanupStack::PopAndDestroy(); // reader |
|
202 |
|
203 // Create Zoom Pane based on Rect passed in on creation |
|
204 TRect paneRect( Rect() ); |
|
205 |
|
206 // if the side pane is on the left |
|
207 if ( iHandedness == ECamHandLeft ) |
|
208 { |
|
209 paneRect.iBr.iX = iZoomPaneWidth; |
|
210 } |
|
211 else // the side pane is on the right |
|
212 { |
|
213 paneRect.iTl.iX = paneRect.iBr.iX - iZoomPaneWidth; |
|
214 } |
|
215 |
|
216 User::LeaveIfError( CamUtility::GetPsiInt( ECamPsiOverLaySidePane, iOverlayViewFinder ) ); |
|
217 |
|
218 iController.AddControllerObserverL( this ); // For zoom state changes |
|
219 iController.AddCameraObserverL( this, KCameraEventInterest ); |
|
220 iController.AddSettingsObserverL( this ); |
|
221 |
|
222 iZoomPane->MakeVisible( EFalse, EFalse ); // On app startup, it's invisible |
|
223 |
|
224 if ( !appUi->IsSecondCameraEnabled() ) |
|
225 { |
|
226 iZoomPane->SetZoomKeys( iPrimaryZoomInKeys, iPrimaryZoomOutKeys ); |
|
227 } |
|
228 else |
|
229 { |
|
230 iZoomPane->SetZoomKeys( iSecondaryZoomInKeys, iSecondaryZoomOutKeys ); |
|
231 } |
|
232 |
|
233 iZoomTimer = CPeriodic::NewL( CActive::EPriorityUserInput ); |
|
234 |
|
235 if ( iController.UiConfigManagerPtr() && |
|
236 iController.UiConfigManagerPtr()->IsAutoFocusSupported() && |
|
237 !iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
238 { |
|
239 iReticuleTimer = CPeriodic::NewL( CActive::EPriorityUserInput ); |
|
240 |
|
241 // Layout the reticule. |
|
242 iAfReadyIcon = CreateAfIconL( KRgbWhite ); |
|
243 iAfFocusIcon = CreateAfIconL( KRgbGreen ); |
|
244 iAfErrIcon = CreateAfIconL( KRgbRed ); |
|
245 } |
|
246 |
|
247 iSidePane = appUi->SidePane(); |
|
248 iSidePane->SetRect( paneRect ); |
|
249 |
|
250 // Register as burst mode observer |
|
251 appUi->AddBurstModeObserverL( this ); |
|
252 |
|
253 CreateResolutionIndicatorL(); |
|
254 |
|
255 if ( iController.UiConfigManagerPtr() && |
|
256 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
257 { |
|
258 TRect Locrect = Rect(); |
|
259 PRINT( _L("Camera => CCamPreCaptureContainerBase::BaseConstructL - create iLocationIconController") ) |
|
260 iLocationIconController = CCamLocationIconController::NewL( iController, *this, ETrue, Locrect ); |
|
261 SetLocationIndicatorVisibility(); |
|
262 } |
|
263 |
|
264 TBool dsaAlways( EFalse ); // Offscreen bitmap is needed with the emulator |
|
265 #ifndef __WINS__ |
|
266 dsaAlways = iController.IsDirectScreenVFSupported( ETrue ) && |
|
267 iController.IsDirectScreenVFSupported( EFalse ); |
|
268 #endif |
|
269 |
|
270 if ( !dsaAlways ) |
|
271 { |
|
272 // If bitmap VF is not possible in this configuration, |
|
273 // offscreen bitmap is not needed |
|
274 TInt color; |
|
275 TInt gray; |
|
276 |
|
277 TDisplayMode displaymode = |
|
278 CEikonEnv::Static()->WsSession().GetDefModeMaxNumColors( color, gray ); |
|
279 |
|
280 // set up the offscreen bitmap |
|
281 iOffScreenBitmap = new ( ELeave ) CFbsBitmap(); |
|
282 |
|
283 User::LeaveIfError( iOffScreenBitmap->Create( Rect().Size(), EColor16MU/*displaymode*/ ) ); |
|
284 |
|
285 PRINT1( _L("Camera => CCamPreCaptureContainerBase::BaseConstructL disp mode (%d)"), displaymode ) |
|
286 iBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBitmap ); |
|
287 User::LeaveIfError( iBitmapDevice->CreateContext( iBitmapGc ) ); |
|
288 } |
|
289 |
|
290 iRect = ViewFinderFrameRect(); |
|
291 // if using direct viewfinding pass Rect to control |
|
292 |
|
293 |
|
294 if ( iController.UiConfigManagerPtr() && |
|
295 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
296 { |
|
297 // Check whether we should be showing the reticule. |
|
298 // NOTE: This will only be showed in still, not video views |
|
299 iPhotoSceneUsesReticule = !iController.CurrentSceneHasForcedFocus(); |
|
300 } |
|
301 |
|
302 // Setup viewfinder grid |
|
303 InitVfGridL( iRect ); |
|
304 |
|
305 // Do not construct battery pane controller, if secondary camera is in use |
|
306 if ( iController.ActiveCamera() != ECamActiveCameraSecondary || |
|
307 appUi->IsQwerty2ndCamera() ) |
|
308 { |
|
309 iBatteryPaneController = CCamBatteryPaneController::NewL( |
|
310 *this, ETrue); |
|
311 } |
|
312 // Make sure fixed toolbar is on top of this window |
|
313 DrawableWindow()->SetOrdinalPosition( KCamPreCaptureWindowOrdinalPos ); |
|
314 |
|
315 iController.SetViewfinderWindowHandle( &Window() ); |
|
316 appUi->SetViewFinderInTransit(EFalse); |
|
317 iController.StartIdleTimer(); |
|
318 |
|
319 if (appUi->StartupLogoController()) |
|
320 { |
|
321 TRAP_IGNORE(iStartupLogo = CCamStartupLogo::NewL(*appUi->StartupLogoController(), aRect)); |
|
322 } |
|
323 |
|
324 // Capture button container |
|
325 if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() && |
|
326 iController.IsTouchScreenSupported() ) |
|
327 { |
|
328 TRect rect = Rect(); |
|
329 TPoint center( rect.Center() ); |
|
330 TRect captureRect; |
|
331 captureRect.SetRect( center.iX - KCaptureButtonSize.iWidth/2, |
|
332 rect.iBr.iY - KCaptureButtonSize.iHeight - KCaptureButtonYDelta, |
|
333 center.iX + KCaptureButtonSize.iWidth/2, |
|
334 rect.iBr.iY - KCaptureButtonYDelta ); |
|
335 captureRect.Grow( KAdditionalArea ); |
|
336 |
|
337 TCamCameraMode mode = ECamControllerImage; |
|
338 if ( iView.Id() == TUid::Uid( ECamViewIdVideoPreCapture ) ) |
|
339 { |
|
340 mode = ECamControllerVideo; |
|
341 } |
|
342 iCaptureButtonContainer = CCamCaptureButtonContainer::NewL( iController, iView, |
|
343 *this, captureRect, |
|
344 mode ); |
|
345 } |
|
346 |
|
347 PRINT( _L("Camera <= CCamPreCaptureContainerBase::BaseConstructL ") ); |
|
348 } |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CCamPreCaptureContainerBase::CCamPreCaptureContainerBase |
|
352 // C++ constructor |
|
353 // --------------------------------------------------------------------------- |
|
354 // |
|
355 CCamPreCaptureContainerBase::CCamPreCaptureContainerBase( |
|
356 CCamAppController& aController, |
|
357 CAknView& aView ) |
|
358 : CCamContainerBase( aController, aView ), |
|
359 iDisableRedraws( EFalse ) |
|
360 { |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 // CCamPreCaptureContainerBase::ZoomTimerCallback |
|
365 // Callback for Zoom Pane timer |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 TInt CCamPreCaptureContainerBase::ZoomTimerCallback( TAny* aObject ) |
|
369 { |
|
370 CCamPreCaptureContainerBase* cont = static_cast< CCamPreCaptureContainerBase* >( aObject ); |
|
371 cont->ZoomTimerTick(); |
|
372 return KErrNone; |
|
373 } |
|
374 |
|
375 // --------------------------------------------------------------------------- |
|
376 // CCamPreCaptureContainerBase::ReticuleTimerCallback |
|
377 // Callback for flashing of the focus reticule |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 TInt CCamPreCaptureContainerBase::ReticuleTimerCallback( TAny* aObject ) |
|
381 { |
|
382 CCamPreCaptureContainerBase* cont = static_cast< CCamPreCaptureContainerBase* >( aObject ); |
|
383 cont->iReticuleFlashOn = !cont->iReticuleFlashOn; |
|
384 |
|
385 // This is where we force a redraw of the reticule, if we are using |
|
386 // Direct Viewfinding. However, if we are in burst mode, we must |
|
387 // use Bitmap Viewfinding, so only draw reticule if NOT in burst mode |
|
388 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
389 if ( appUi && appUi-> IsDirectViewfinderActive() ) |
|
390 { |
|
391 cont->DrawDeferred(); |
|
392 } |
|
393 return KErrNone; |
|
394 } |
|
395 |
|
396 |
|
397 // --------------------------------------------------------------------------- |
|
398 // CCamPreCaptureContainerBase::ShowZoomPaneWithTimer |
|
399 // Makes Zoom Pane visible for the period of the pane timer. |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 void CCamPreCaptureContainerBase::ShowZoomPaneWithTimer() |
|
403 { |
|
404 __ASSERT_DEBUG( iZoomTimer, CamPanic( ECamPanicNullPointer ) ); |
|
405 __ASSERT_DEBUG( iZoomPane, CamPanic( ECamPanicNullPointer ) ); |
|
406 __ASSERT_DEBUG( iSidePane, CamPanic( ECamPanicNullPointer ) ); |
|
407 |
|
408 PRINT(_L("Camera => CCamPreCaptureContainerBase::ShowZoomPaneWithTimer")); |
|
409 |
|
410 // If already active, cancel the timer |
|
411 if ( iZoomTimer->IsActive() ) |
|
412 { |
|
413 iZoomTimer->Cancel(); |
|
414 } |
|
415 |
|
416 iZoomTimer->Start( KZoomPanelTimeout, KZoomPanelTimeout, TCallBack( ZoomTimerCallback , this) ); |
|
417 |
|
418 iZoomPane->MakeVisible( ETrue, ETrue ); |
|
419 |
|
420 PRINT(_L("Camera <= CCamPreCaptureContainerBase::ShowZoomPaneWithTimer")); |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------------------------- |
|
424 // CCamPreCaptureContainerBase::ZoomTimerTick |
|
425 // Called as a result of the Zoom Pane timer expiring, switches side panes |
|
426 // to hide the Zoom pane. |
|
427 // --------------------------------------------------------------------------- |
|
428 // |
|
429 void CCamPreCaptureContainerBase::ZoomTimerTick() |
|
430 { |
|
431 PRINT(_L("Camera => CCamPreCaptureContainerBase::ZoomTimerTick")); |
|
432 // Cancel the (potentially) recurring timer |
|
433 iZoomTimer->Cancel(); |
|
434 |
|
435 // If zooming is still in progress (this happens if the zoom key has |
|
436 // been held down longer than the zoom pane timer), keep the pane |
|
437 // visible |
|
438 if ( iZoomPane->IsCurrentlyZooming() ) |
|
439 { |
|
440 iZoomTimer->Start( KZoomPanelTimeout, |
|
441 KZoomPanelTimeout, |
|
442 TCallBack( ZoomTimerCallback , this) ); |
|
443 } |
|
444 else |
|
445 { |
|
446 // Make Indicator Pane visible again and hide the ZoomPane |
|
447 iZoomPane->MakeVisible( EFalse, ETrue ); |
|
448 |
|
449 // background needs redrawing behind zoom pane |
|
450 iRedrawPaneBackground = ETrue; |
|
451 } |
|
452 PRINT(_L("Camera <= CCamPreCaptureContainerBase::ZoomTimerTick")); |
|
453 } |
|
454 |
|
455 // ---------------------------------------------------- |
|
456 // CCamPreCaptureContainerBase::OfferKeyEventL |
|
457 // Handles this application view's command keys. Forwards other |
|
458 // keys to child control(s). |
|
459 // ---------------------------------------------------- |
|
460 // |
|
461 TKeyResponse |
|
462 CCamPreCaptureContainerBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
463 TEventCode aType ) |
|
464 { |
|
465 PRINT2( _L("Camera => CCamPreCaptureContainerBase::OfferKeyEventL type %d) scan code (%d)"), aType, aKeyEvent.iScanCode ) |
|
466 |
|
467 #ifdef CAMERAAPP_PERFORMANCE_MEASUREMENT |
|
468 // Log event only if this is the first capture key press and we are in correct state |
|
469 TCamCaptureOperation operation = iController.CurrentOperation(); |
|
470 |
|
471 TBool isCaptureKeyForUs = (IsCaptureKeyL( aKeyEvent, aType ) |
|
472 && ( EEventKeyDown == aType && 0 == aKeyEvent.iRepeats ) ); |
|
473 |
|
474 TBool isOperationStateOk = (ECamNoOperation == operation); |
|
475 if( isCaptureKeyForUs && isOperationStateOk ) |
|
476 { |
|
477 PERF_EVENT_START_L1( EPerfEventKeyToCapture ); |
|
478 } |
|
479 #endif |
|
480 |
|
481 TBool isCaptureKeyForSymbTrace = (IsCaptureKeyL( aKeyEvent, aType ) |
|
482 && ( EEventKeyDown == aType && 0 == aKeyEvent.iRepeats ) ); |
|
483 if( isCaptureKeyForSymbTrace ) |
|
484 { |
|
485 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL Symbian Traces Active") ); |
|
486 OstTrace0( CAMERAAPP_PERFORMANCE, DUP7_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_PRI_SHUTTER_RELEASE_LAG 1" ); |
|
487 OstTrace0( CAMERAAPP_PERFORMANCE, DUP5_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_APP_CAPTURE_START 1" ); //CCORAPP_CAPTURE_START_START |
|
488 if ( iFocusState != EFocusStateFocusing ) |
|
489 { |
|
490 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_APP_SHOT_TO_SNAPSHOT 1" ); //CCORAPP_SHOT_TO_SNAPSHOT_START |
|
491 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_PRI_SHOT_TO_SNAPSHOT 1" ); //CCORAPP_PRI_SHOT_TO_SNAPSHOT_START |
|
492 OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_PRI_SHOT_TO_SAVE 1" ); //CCORAPP_PRI_SHOT_TO_SAVE_START |
|
493 OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_PRI_SHOT_TO_SHOT 1" ); //CCORAPP_PRI_SHOT_TO_SHOT_START |
|
494 OstTrace0( CAMERAAPP_PERFORMANCE, DUP4_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_APP_SHOT_TO_STILL 1" ); //CCORAPP_SHOT_TO_STILL_START |
|
495 OstTrace0( CAMERAAPP_PERFORMANCE, DUP6_CCAMPRECAPTURECONTAINERBASE_OFFERKEYEVENTL, "e_CAM_PRI_SERIAL_SHOOTING 1" ); //CCORAPP_PRI_SERIAL_SHOOTING_START |
|
496 } |
|
497 } |
|
498 |
|
499 iController.StartIdleTimer(); |
|
500 if( aType == EEventKeyUp ) |
|
501 { |
|
502 iController.SetDemandKeyRelease( EFalse ); |
|
503 } |
|
504 |
|
505 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
506 __ASSERT_DEBUG(appUi, CamPanic(ECamPanicNullPointer) ); |
|
507 if ( appUi->CheckCourtesyKeyEventL( aKeyEvent, aType, ETrue ) == EKeyWasConsumed ) |
|
508 { |
|
509 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL courtesy key") ); |
|
510 return EKeyWasConsumed; |
|
511 } |
|
512 |
|
513 // If a control has the focus, give it the first opportunity to |
|
514 // process the key event |
|
515 |
|
516 if( iActivePalette |
|
517 && iActivePalette->CoeControl() |
|
518 && iActivePalette->CoeControl()->OfferKeyEventL(aKeyEvent,aType) == EKeyWasConsumed ) |
|
519 { |
|
520 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL AP consumed") ); |
|
521 return EKeyWasConsumed; |
|
522 } |
|
523 |
|
524 // The key press has not been handled by a visible control |
|
525 // so will be processed by the container. |
|
526 |
|
527 // Handle Zoom in key if we are not saving video |
|
528 // and if toolbar extension is not visible |
|
529 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL B") ) |
|
530 if ( IsZoomKeyL( aKeyEvent, aType ) |
|
531 && ECamCompleting != iController.CurrentOperation() |
|
532 && !iController.CurrentlySavingVideo() |
|
533 && !appUi->IsSecondCameraEnabled() |
|
534 && !appUi->IsToolBarExtensionVisible() ) |
|
535 { |
|
536 // Offer the key event to the zoom pane/model |
|
537 TKeyResponse resp = iZoomPane->OfferKeyEventL( aKeyEvent, aType ); |
|
538 |
|
539 // If it was consumed, we need to keep the zoom pane visible |
|
540 if ( resp == EKeyWasConsumed ) |
|
541 { |
|
542 ShowZoomPaneWithTimer(); |
|
543 } |
|
544 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL Zoom key") ); |
|
545 return resp; |
|
546 } |
|
547 |
|
548 else if ( EEventKey == aType |
|
549 && EKeyOK == aKeyEvent.iCode |
|
550 && 0 == aKeyEvent.iRepeats ) |
|
551 { |
|
552 TBool MSKCapture(EFalse); |
|
553 if ( !appUi->IsToolBarVisible() && aKeyEvent.iScanCode == EStdKeyDevice3 ) |
|
554 { |
|
555 MSKCapture = ETrue; |
|
556 } |
|
557 if( appUi->ActiveCamera() == ECamActiveCameraPrimary |
|
558 && !MSKCapture ) |
|
559 { |
|
560 // AP needs to handle this |
|
561 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL Ok key") ); |
|
562 return EKeyWasNotConsumed; |
|
563 } |
|
564 } |
|
565 |
|
566 // Handle right and left navi keys. |
|
567 // Each product defines the behaviour that is mapped to these keys. |
|
568 else if ( EEventKey == aType |
|
569 && ( EStdKeyRightArrow == aKeyEvent.iScanCode |
|
570 || EStdKeyLeftArrow == aKeyEvent.iScanCode ) ) |
|
571 { |
|
572 if ( HandleLeftRightNaviKeyL( aKeyEvent, aType ) == EKeyWasConsumed ) |
|
573 { |
|
574 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL left/right navi") ); |
|
575 return EKeyWasConsumed; |
|
576 } |
|
577 } |
|
578 |
|
579 else |
|
580 { |
|
581 // empty else statement to remove LINT error |
|
582 } |
|
583 |
|
584 TBool captureKey = IsCaptureKeyL( aKeyEvent, aType ); |
|
585 |
|
586 // Stop any zooming activity if capture key detected |
|
587 if ( captureKey ) |
|
588 { |
|
589 PrepareForCapture(); |
|
590 } |
|
591 TBool viewFinderRunning = iReceivedVfFrame; |
|
592 if ( iController.UiConfigManagerPtr() && |
|
593 ( iController.UiConfigManagerPtr()-> |
|
594 IsDSAViewFinderSupported( ETrue ) && |
|
595 !appUi->IsSecondCameraEnabled() ) || |
|
596 ( iController.UiConfigManagerPtr()-> |
|
597 IsDSAViewFinderSupported( EFalse ) && |
|
598 appUi->IsSecondCameraEnabled() ) ) |
|
599 { |
|
600 viewFinderRunning = appUi->IsDirectViewfinderActive(); |
|
601 } |
|
602 |
|
603 TBool shutterKey = IsShutterKeyL( aKeyEvent, aType ); |
|
604 TBool interruptKey = captureKey; |
|
605 if ( !appUi->IsSecondCameraEnabled() && |
|
606 iController.UiConfigManagerPtr() && |
|
607 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
608 { |
|
609 interruptKey = shutterKey; |
|
610 } |
|
611 |
|
612 if(iController.IsProcessingCapture() |
|
613 // && appUi->CurrentCaptureMode() == ECamCaptureModeStill |
|
614 && ECamControllerImage == iController.CurrentMode() |
|
615 && EEventKeyDown == aType |
|
616 && interruptKey |
|
617 && appUi->ShowPostCaptureView() |
|
618 && !appUi->IsBurstEnabled() |
|
619 && !appUi->SelfTimerEnabled()) |
|
620 { |
|
621 iController.SetCaptureKeyPressedWhileImageSaving(ETrue); |
|
622 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL 2nd press of capturekey") ) |
|
623 return EKeyWasConsumed; |
|
624 |
|
625 } |
|
626 // Check if the key is a shutter key and... |
|
627 if ( shutterKey && viewFinderRunning ) |
|
628 { |
|
629 if ( EKeyWasConsumed == HandleShutterKeyEventL( aKeyEvent, aType ) ) |
|
630 { |
|
631 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL shutter key") ); |
|
632 return EKeyWasConsumed; |
|
633 } |
|
634 } |
|
635 else if ( captureKey // Capture key event... |
|
636 && EEventKeyDown == aType // ...it's a key down event and |
|
637 && viewFinderRunning // ...the viewfinder is running |
|
638 && !iController.Busy() // CamCameraController is not busy. |
|
639 && !iController.IsDemandKeyRelease() ) // ...and no need to wait key up |
|
640 { |
|
641 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL .. [KEYS] capture key down") ) |
|
642 if ( HandleCaptureKeyEventL( aKeyEvent ) == EKeyWasConsumed ) |
|
643 { |
|
644 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL capture key handled") ) |
|
645 return EKeyWasConsumed; |
|
646 } |
|
647 } |
|
648 else if ( captureKey && aType == EEventKeyUp ) |
|
649 { |
|
650 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL .. [KEYS] capture key up") ) |
|
651 if ( iController.SequenceCaptureInProgress() // actively capturing or |
|
652 || appUi->IsBurstEnabled() // burst is enabled (for if focusing) |
|
653 ) |
|
654 { |
|
655 if ( appUi->CurrentBurstMode() == ECamImageCaptureTimeLapse ) |
|
656 { |
|
657 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL .. timelapse mode, update CBA") ) |
|
658 // if this is a timelapse capture then set the softkeys to blank/cancel. |
|
659 // The next shutter press will stop the capture. |
|
660 TRAP_IGNORE( static_cast<CCamPreCaptureViewBase*>( &iView )->UpdateCbaL() ); |
|
661 } |
|
662 else |
|
663 { |
|
664 if ( !appUi->SelfTimerEnabled() ) |
|
665 { |
|
666 |
|
667 if ( !iController.AllSnapshotsReceived() && (iController.CurrentCapturedCount() >= 1) ) |
|
668 { |
|
669 PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL .. burst mode, soft stop burst..") ) |
|
670 // burst ongoing, still receiving snapshots, end it as soon as possible. |
|
671 iController.SetKeyUp( ETrue ); |
|
672 iController.SoftStopBurstL(); |
|
673 } |
|
674 else |
|
675 { |
|
676 // ignore keypress, all snapshot received and processing image data |
|
677 // processing only stopped from softkey |
|
678 } |
|
679 } |
|
680 } |
|
681 |
|
682 PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL .. capture key up handled") ) |
|
683 return EKeyWasConsumed; |
|
684 } |
|
685 else |
|
686 { |
|
687 UpdateCaptureButton(); |
|
688 } |
|
689 iController.HandlePendingHdmiEvent(); |
|
690 } |
|
691 else |
|
692 { |
|
693 // remove Lint warning |
|
694 } |
|
695 |
|
696 TKeyResponse response = CCamContainerBase::OfferKeyEventL( aKeyEvent, aType ); |
|
697 |
|
698 PRINT1( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL, return %d"), response ) |
|
699 return response; |
|
700 } |
|
701 |
|
702 |
|
703 // --------------------------------------------------------- |
|
704 // CCamPreCaptureContainerBase::HandleControllerEventL |
|
705 // Handles zoom events from the Controller |
|
706 // --------------------------------------------------------- |
|
707 // |
|
708 void |
|
709 CCamPreCaptureContainerBase |
|
710 ::HandleControllerEventL( TCamControllerEvent aEvent, |
|
711 TInt /*aError*/ ) |
|
712 { |
|
713 PRINT1(_L("Camera => CCamPreCaptureContainerBase::HandleControllerEventL(%d)"), aEvent ); |
|
714 |
|
715 __ASSERT_DEBUG( iZoomPane, CamPanic( ECamPanicNullPointer ) ); |
|
716 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
717 |
|
718 switch( aEvent ) |
|
719 { |
|
720 // --------------------------------------------------- |
|
721 case ECamEventSaveCancelled: |
|
722 { |
|
723 // clear the side pane after saving images dialog is dismissed |
|
724 ForceSideZoomPaneDraw(); |
|
725 break; |
|
726 } |
|
727 // --------------------------------------------------- |
|
728 case ECamEventCameraChanged: |
|
729 { |
|
730 SetResolutionIndicator(); |
|
731 break; |
|
732 } |
|
733 |
|
734 // --------------------------------------------------- |
|
735 case ECamEventCounterUpdated: |
|
736 { |
|
737 if ( iController.UiConfigManagerPtr() && |
|
738 iController.UiConfigManagerPtr()->IsDSAViewFinderSupported() ) |
|
739 { |
|
740 if( iPaneInUse == ECamPaneProgress && appUi && appUi->IsDirectViewfinderActive() ) |
|
741 { |
|
742 ActivateGc(); |
|
743 CWindowGc& gc = SystemGc(); |
|
744 iNaviProgressBarControl->DrawProgressBar( gc ); |
|
745 DeactivateGc(); |
|
746 } |
|
747 else if ( iPaneInUse == ECamPaneCounter && iController.SequenceCaptureInProgress() ) |
|
748 { |
|
749 DrawDeferred(); |
|
750 } |
|
751 else |
|
752 { |
|
753 // Lint |
|
754 } |
|
755 } |
|
756 break; |
|
757 } |
|
758 // --------------------------------------------------- |
|
759 case ECamEventOperationStateChanged: |
|
760 { |
|
761 UpdateCaptureButton(); |
|
762 |
|
763 if( iController.IsAppUiAvailable() && iController.UiConfigManagerPtr() |
|
764 && iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
765 { |
|
766 // ReCheck if we have to draw the reticule. |
|
767 if ( ECamControllerImage == iController.CurrentMode() ) |
|
768 { |
|
769 iPhotoSceneUsesReticule = !iController.CurrentSceneHasForcedFocus(); |
|
770 HandleOperationStateChangeEventL(); |
|
771 } |
|
772 } |
|
773 break; |
|
774 } |
|
775 // --------------------------------------------------- |
|
776 case ECamEventEngineStateChanged: |
|
777 { |
|
778 UpdateCaptureButton(); |
|
779 |
|
780 PRINT1( _L("Camera <> Start mode indi blinking, op:%d"), iController.CurrentOperation() ); |
|
781 |
|
782 if ( !iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() |
|
783 && !iController.EngineRequestsPending() |
|
784 && iController.TargetMode() == iController.CurrentMode() |
|
785 && iController.CurrentOperation() == ECamNoOperation |
|
786 && !iBlinkResolutionIndicator ) |
|
787 { |
|
788 PRINT( _L("Camera <> mode indi blinking - starting timers") ); |
|
789 if ( !iIndBlinkTimer ) |
|
790 { |
|
791 iIndBlinkTimer = CPeriodic::NewL( EPriorityLess ); |
|
792 } |
|
793 else |
|
794 { |
|
795 iIndBlinkTimer->Cancel(); |
|
796 } |
|
797 |
|
798 iToggleCountdown = 2 * KNumberOfBlinks; |
|
799 iBlinkModeIndicator = ETrue; |
|
800 iIndBlinkTimer->Start( KIndicatorBlinkDelay, |
|
801 KIndicatorBlinkDelay, |
|
802 TCallBack( IndicatorVisible, this) ); |
|
803 |
|
804 iDrawIndicator = ETrue; |
|
805 } |
|
806 break; |
|
807 } |
|
808 // --------------------------------------------------- |
|
809 case ECamEventExitRequested: |
|
810 { |
|
811 iShuttingDown = ETrue; |
|
812 break; |
|
813 } |
|
814 // --------------------------------------------------- |
|
815 case ECamEventRecordComplete: |
|
816 { |
|
817 iResolutionIndicators[iCurrentIndicator]->CancelOverridePosition(); |
|
818 break; |
|
819 } |
|
820 // --------------------------------------------------- |
|
821 // Scene has changed |
|
822 case ECamEventSceneStateChanged: |
|
823 { |
|
824 PRINT(_L("Camera <> CCamPreCaptureContainerBase::HandleControllerEventL ECamEventSceneStateChanged")); |
|
825 if ( iController.UiConfigManagerPtr() && |
|
826 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
827 { |
|
828 // Scene state has changed, re-check whether we should |
|
829 // be showing the reticule |
|
830 iPhotoSceneUsesReticule = !iController.CurrentSceneHasForcedFocus(); |
|
831 } |
|
832 ResetVFGridVisibility(); |
|
833 appUi->APHandler()->UpdateActivePaletteL(); |
|
834 break; |
|
835 } |
|
836 // --------------------------------------------------- |
|
837 case ECamEventImageData: |
|
838 { |
|
839 UpdateBurstProcessingTextL( iController.CapturedImages(), iController.CurrentCapturedCount() ); |
|
840 break; |
|
841 } |
|
842 // --------------------------------------------------- |
|
843 case ECamEventSliderClosed: |
|
844 { |
|
845 //Do nothing |
|
846 } |
|
847 break; |
|
848 // --------------------------------------------------- |
|
849 case ECamEventCaptureComplete: |
|
850 { |
|
851 if ( !appUi->IsSecondCameraEnabled() |
|
852 && iController.CurrentMode() == ECamControllerImage ) |
|
853 { |
|
854 DrawNow(); |
|
855 } |
|
856 break; |
|
857 } |
|
858 // --------------------------------------------------- |
|
859 case ECamEventFaceTrackingStateChanged: |
|
860 { |
|
861 if( iController.UiConfigManagerPtr() |
|
862 && iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
863 { |
|
864 // ReCheck if we have to draw the reticule. |
|
865 if ( ECamControllerImage == iController.CurrentMode() ) |
|
866 { |
|
867 iPhotoSceneUsesReticule = |
|
868 !iController.CurrentSceneHasForcedFocus(); |
|
869 } |
|
870 } |
|
871 } |
|
872 // --------------------------------------------------- |
|
873 case ECamEventImageQualityChanged: |
|
874 case ECamEventVideoQualityChanged: |
|
875 if ( iBlinkResolutionIndicator ) |
|
876 { |
|
877 iBlinkModeIndicator = EFalse; |
|
878 |
|
879 // Force the first blink to occur right away |
|
880 iDrawIndicator = EFalse; |
|
881 DrawResolutionIndicator(); |
|
882 |
|
883 // Update the resolution indicator icon to be used. |
|
884 SetResolutionIndicator(); |
|
885 |
|
886 // Start the blinking timer |
|
887 if ( !iIndBlinkTimer ) |
|
888 { |
|
889 iIndBlinkTimer = CPeriodic::NewL( EPriorityLess ); |
|
890 } |
|
891 else |
|
892 { |
|
893 iIndBlinkTimer->Cancel(); |
|
894 } |
|
895 |
|
896 iToggleCountdown = 2 * KNumberOfBlinks; |
|
897 if ( ECamEventVideoQualityChanged == aEvent ) |
|
898 { |
|
899 iToggleCountdown = 2 * KNumberOfBlinksVideo; |
|
900 } |
|
901 PRINT( _L("Camera <> start timer to blink indicator") ); |
|
902 iIndBlinkTimer->Start( KIndicatorBlinkDelay, |
|
903 KIndicatorBlinkDelay, |
|
904 TCallBack( IndicatorVisible, this) ); |
|
905 |
|
906 // Force the first blink to occur right away |
|
907 iDrawIndicator = ETrue; |
|
908 DrawResolutionIndicator(); |
|
909 |
|
910 // Quality level has changed through pinch gesture |
|
911 // Reinitialise the viewfinder grid |
|
912 if ( iVfGridDrawer ) |
|
913 { |
|
914 delete iVfGridDrawer; |
|
915 iVfGridDrawer = NULL; |
|
916 |
|
917 TRect rect = ViewFinderFrameRect(); |
|
918 InitVfGridL( rect ); |
|
919 } |
|
920 } |
|
921 else |
|
922 { |
|
923 if ( iIndBlinkTimer ) |
|
924 iIndBlinkTimer->Cancel(); |
|
925 } |
|
926 break; |
|
927 // --------------------------------------------------- |
|
928 default: |
|
929 { |
|
930 // Other events => no action. |
|
931 break; |
|
932 } |
|
933 // --------------------------------------------------- |
|
934 } |
|
935 PRINT(_L("Camera <= CCamPreCaptureContainerBase::HandleControllerEventL")); |
|
936 } |
|
937 |
|
938 // --------------------------------------------------------- |
|
939 // CCamPreCaptureContainerBase::HandleForegroundEvent |
|
940 // Handles change of app foreground state |
|
941 // --------------------------------------------------------- |
|
942 // |
|
943 void CCamPreCaptureContainerBase::HandleForegroundEventL( TBool aForeground ) |
|
944 { |
|
945 PRINT1( _L( "Camera => CCamPreCaptureContainerBase::HandleForegroundEventL %d" ), aForeground ); |
|
946 if ( aForeground ) |
|
947 { |
|
948 /*#ifndef __WINS__ |
|
949 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
950 if( appUi->IsInCallSend() ) |
|
951 { |
|
952 // force side pane to update |
|
953 appUi->SidePane()->SetInitialState(); |
|
954 } |
|
955 #endif*/ |
|
956 // Check if we are on a non-standard zoom level. Also checks if previous |
|
957 // view was PostCapture or settings, if so, we dont want to show the zoom |
|
958 // pane either |
|
959 if ( iZoomPane->ZoomValue() != 0 && |
|
960 !iZoomPane->IsResetPending() && |
|
961 iPrevViewId != ECamViewIdStillPostCapture && |
|
962 iPrevViewId != ECamViewIdVideoPostCapture && |
|
963 iPrevViewId != ECamViewIdPhotoSettings && |
|
964 iPrevViewId != ECamViewIdVideoSettings ) |
|
965 { |
|
966 // If we have moved to the foreground and need to show the zoom level. |
|
967 ShowZoomPaneWithTimer(); |
|
968 } |
|
969 |
|
970 ResetVFGridVisibility(); |
|
971 } |
|
972 else |
|
973 { // Background |
|
974 if ( iIndBlinkTimer ) |
|
975 { |
|
976 iIndBlinkTimer->Cancel(); |
|
977 iDrawIndicator = ETrue; |
|
978 } |
|
979 iReceivedVfFrame = EFalse; |
|
980 |
|
981 // Cancel timer if we're losing focus |
|
982 iZoomTimer->Cancel(); |
|
983 |
|
984 if ( iController.IsAppUiAvailable() && !iShuttingDown ) |
|
985 { |
|
986 iSidePane->MakeVisible( ETrue ); |
|
987 iZoomPane->MakeVisible( EFalse, EFalse ); |
|
988 |
|
989 // Will stop any ongoing zoom |
|
990 iZoomPane->HandleForegroundEvent( aForeground ); |
|
991 } |
|
992 |
|
993 // Update the view ID for when we come back. |
|
994 TCamAppViewIds viewId = static_cast<TCamAppViewIds>( iView.Id().iUid ); |
|
995 SetPreviousViewId( viewId ); |
|
996 } |
|
997 PRINT( _L( "Camera <= CCamPreCaptureContainerBase::HandleForegroundEventL" ) ); |
|
998 } |
|
999 |
|
1000 |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 // HandleAppEvent <<virtual>> |
|
1003 // |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // |
|
1006 void |
|
1007 CCamPreCaptureContainerBase::HandleAppEvent( const TCamAppEvent& aEvent ) |
|
1008 { |
|
1009 PRINT( _L("Camera => CCamPreCaptureContainerBase::HandleAppEvent") ); |
|
1010 |
|
1011 switch( aEvent ) |
|
1012 { |
|
1013 case ECamAppEventFocusGained: |
|
1014 { |
|
1015 // Clear non-fading flag. It may have been set when showing a note |
|
1016 // in CCamAppUi::ShowErrorNoteL(). |
|
1017 |
|
1018 CEikMenuBar* menuBar = iView.MenuBar(); |
|
1019 TBool menuOpened( EFalse ); |
|
1020 if ( menuBar ) |
|
1021 { |
|
1022 menuOpened = menuBar->IsDisplayed(); |
|
1023 } |
|
1024 |
|
1025 RDrawableWindow* window = DrawableWindow(); |
|
1026 if ( window && !menuOpened ) |
|
1027 { |
|
1028 window->SetNonFading( EFalse ); |
|
1029 } |
|
1030 |
|
1031 if( iBatteryPaneController ) |
|
1032 iBatteryPaneController->Pause( EFalse ); |
|
1033 break; |
|
1034 } |
|
1035 case ECamAppEventFocusLost: |
|
1036 { |
|
1037 if( iBatteryPaneController ) |
|
1038 iBatteryPaneController->Pause( ETrue ); |
|
1039 |
|
1040 if ( iIndBlinkTimer ) |
|
1041 { |
|
1042 iIndBlinkTimer->Cancel(); |
|
1043 iDrawIndicator = ETrue; |
|
1044 } |
|
1045 |
|
1046 break; |
|
1047 } |
|
1048 default: |
|
1049 { |
|
1050 break; |
|
1051 } |
|
1052 } |
|
1053 |
|
1054 PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandleAppEvent") ); |
|
1055 } |
|
1056 |
|
1057 |
|
1058 // ---------------------------------------------------- |
|
1059 // CCamPreCaptureContainerBase::MakeVisible |
|
1060 // Handles a change to the controls visibility |
|
1061 // ---------------------------------------------------- |
|
1062 // |
|
1063 void CCamPreCaptureContainerBase::MakeVisible( TBool aVisible ) |
|
1064 { |
|
1065 PRINT1( _L("Camera => CCamPreCaptureContainerBase::MakeVisible, visible:%d"), aVisible ); |
|
1066 |
|
1067 CCamContainerBase::MakeVisible( aVisible ); |
|
1068 |
|
1069 PRINT ( _L("Camera <= CCamPreCaptureContainerBase::MakeVisible") ); |
|
1070 } |
|
1071 |
|
1072 // --------------------------------------------------------- |
|
1073 // CCamPreCaptureContainerBase::Draw |
|
1074 // Draw control |
|
1075 // --------------------------------------------------------- |
|
1076 // |
|
1077 void |
|
1078 CCamPreCaptureContainerBase::Draw( const TRect& /*aRect*/ ) const |
|
1079 { |
|
1080 PRINT( _L( "Camera => CCamPreCaptureContainerBase::Draw" ) ); |
|
1081 |
|
1082 CWindowGc& gc = SystemGc(); |
|
1083 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1084 |
|
1085 // Is direct viewfinding active |
|
1086 TBool directVf = appUi ? appUi->IsDirectViewfinderActive() : EFalse; |
|
1087 |
|
1088 // Using bitmap viewfinding and a frame is available |
|
1089 TBool bitmapFrame = !directVf && iReceivedVfFrame && iViewFinderBackup; |
|
1090 |
|
1091 if( iCamOrientation != ECamOrientationCamcorder && |
|
1092 iCamOrientation != ECamOrientationCamcorderLeft && |
|
1093 !( iController.UiConfigManagerPtr() && |
|
1094 iController.IsDirectScreenVFSupported( EFalse ) && |
|
1095 iCamOrientation == ECamOrientationPortrait ) ) |
|
1096 { |
|
1097 // Using secondary camera |
|
1098 } |
|
1099 else if( !bitmapFrame ) |
|
1100 { |
|
1101 // Using primary camera and direct viewfinding is active, there's no bitmap |
|
1102 // viewfinder frame available, or the frame doesn't cover whole screen |
|
1103 // => Paint the background with background color / color key |
|
1104 |
|
1105 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
1106 |
|
1107 if( iController.UiConfigManagerPtr() && directVf ) |
|
1108 { |
|
1109 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
1110 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
1111 } |
|
1112 else |
|
1113 { |
|
1114 // Use the background color |
|
1115 gc.SetBrushColor( TRgb( KCamPrecaptureBgColor ) ); |
|
1116 } |
|
1117 |
|
1118 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1119 gc.DrawRect( Rect() ); |
|
1120 } |
|
1121 else |
|
1122 { |
|
1123 } |
|
1124 if ( bitmapFrame ) |
|
1125 { |
|
1126 // Draw the current bitmap viewfinder frame |
|
1127 DrawFrameNow( gc, iViewFinderBackup ); |
|
1128 } |
|
1129 |
|
1130 gc.Reset(); |
|
1131 if( directVf |
|
1132 && !iController.IsViewFinding() ) |
|
1133 { |
|
1134 return; |
|
1135 } |
|
1136 else |
|
1137 { |
|
1138 //Do nothing |
|
1139 } |
|
1140 DrawScreenFurniture( gc ); |
|
1141 DrawNaviControls( gc ); |
|
1142 |
|
1143 PRINT( _L( "Camera <= CCamPreCaptureContainerBase::Draw" ) ); |
|
1144 } |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 // <CAMERAAPP_CAPI_V2_MIGRATION> |
|
1152 // =========================================================================== |
|
1153 // From MCamCameraObserver |
|
1154 |
|
1155 // --------------------------------------------------------------------------- |
|
1156 // virtual HandleCameraEventL |
|
1157 // --------------------------------------------------------------------------- |
|
1158 // |
|
1159 void |
|
1160 CCamPreCaptureContainerBase |
|
1161 ::HandleCameraEventL( TInt aStatus, |
|
1162 TCamCameraEventId aEventId, |
|
1163 TAny* aEventData /*= NULL*/ ) |
|
1164 { |
|
1165 switch( aEventId ) |
|
1166 { |
|
1167 // ----------------------------------------------------- |
|
1168 case ECamCameraEventVfStop: |
|
1169 case ECamCameraEventVfRelease: |
|
1170 // old vf frame being shown when returning from background. |
|
1171 if ( ECamActiveCameraSecondary == iController.ActiveCamera() ) |
|
1172 { |
|
1173 ActivateGc(); |
|
1174 CWindowGc& gc = SystemGc(); |
|
1175 gc.SetBrushColor( KRgbBlack ); |
|
1176 gc.Clear( Rect() ); |
|
1177 DeactivateGc(); |
|
1178 } |
|
1179 iReceivedVfFrame = EFalse; |
|
1180 break; |
|
1181 // ----------------------------------------------------- |
|
1182 case ECamCameraEventVfFrameReady: |
|
1183 { |
|
1184 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::HandleCameraEventL: case ECamCameraEventVfFrameReady") ); |
|
1185 if( KErrNone == aStatus ) |
|
1186 { |
|
1187 // Mark first frame arrived. |
|
1188 iReceivedVfFrame = ETrue; |
|
1189 |
|
1190 // If status is ok, we should always receive a bitmap. |
|
1191 CFbsBitmap* frame = static_cast<CFbsBitmap*>( aEventData ); |
|
1192 __ASSERT_ALWAYS( frame, CamPanic( ECamPanicNullPointer ) ); |
|
1193 |
|
1194 // Make a duplicate copy of the vfFrame in order to show |
|
1195 // it later on where needed. |
|
1196 if ( iViewFinderBackup ) |
|
1197 { |
|
1198 iViewFinderBackup->Reset(); |
|
1199 } |
|
1200 else |
|
1201 { |
|
1202 TRAP_IGNORE ( iViewFinderBackup = new (ELeave) CFbsBitmap() ); |
|
1203 } |
|
1204 |
|
1205 if ( iViewFinderBackup ) |
|
1206 { |
|
1207 TInt dupeError = iViewFinderBackup->Duplicate(frame->Handle()); |
|
1208 if ( dupeError ) |
|
1209 { |
|
1210 iViewFinderBackup->Reset(); |
|
1211 delete iViewFinderBackup; |
|
1212 iViewFinderBackup = NULL; |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 // Do a redraw. |
|
1217 ActivateGc(); |
|
1218 CWindowGc& gc = SystemGc(); |
|
1219 |
|
1220 PRINT_FRQ4( _L("ECamCameraEventVfFrameReady - rect is %d,%d - %d,%d"), Rect().iTl.iX, Rect().iTl.iY, Rect().iBr.iX, Rect().iBr.iY ) |
|
1221 |
|
1222 if( ECamCapturing == iController.CurrentVideoOperation() ) |
|
1223 { |
|
1224 // ----------------------------------------- |
|
1225 // Draw all content directly to system gc |
|
1226 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase::ShowViewFinderFrame without offscreen bitmap") ) |
|
1227 RWindow window = Window(); |
|
1228 window.Invalidate( Rect() ); |
|
1229 window.BeginRedraw( Rect() ); |
|
1230 DrawToContext(gc, frame); |
|
1231 window.EndRedraw(); |
|
1232 // ----------------------------------------- |
|
1233 } |
|
1234 else |
|
1235 { |
|
1236 if( iBitmapGc ) |
|
1237 { |
|
1238 // ----------------------------------------- |
|
1239 // Draw all content to the offscreen bitmap |
|
1240 DrawToContext( *iBitmapGc, frame ); |
|
1241 |
|
1242 // ----------------------------------------- |
|
1243 // Draw the offscreen bitmap to screen |
|
1244 RWindow window = Window(); |
|
1245 window.Invalidate( Rect() ); |
|
1246 window.BeginRedraw( Rect() ); |
|
1247 gc.BitBlt( TPoint( 0,0 ), iOffScreenBitmap ); |
|
1248 window.EndRedraw(); |
|
1249 // ----------------------------------------- |
|
1250 } |
|
1251 else |
|
1252 { |
|
1253 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase: iBitmapGc == NULL")); |
|
1254 //in DSA case draw snapshot already here if available |
|
1255 const CFbsBitmap* snapshot = iController.SnapshotImage(); |
|
1256 if (snapshot) |
|
1257 { |
|
1258 TSize snapshotSize = snapshot->SizeInPixels(); |
|
1259 TRect bmCropRect( snapshotSize ); |
|
1260 |
|
1261 // Get the required snapshot layout rect |
|
1262 TRect vfRect( ViewFinderFrameRect() ); |
|
1263 |
|
1264 RWindow window = Window(); |
|
1265 window.Invalidate( Rect() ); |
|
1266 window.BeginRedraw( Rect() ); |
|
1267 gc.BitBlt( vfRect.iTl, snapshot, bmCropRect ); |
|
1268 |
|
1269 TBool lateOperation = ( ECamCapturing == iController.CurrentOperation() |
|
1270 || ECamCompleting == iController.CurrentOperation() ); |
|
1271 |
|
1272 if( iProcessingText && |
|
1273 iController.ActiveCamera() != ECamActiveCameraSecondary && |
|
1274 lateOperation ) |
|
1275 { |
|
1276 gc.SetBrushColor( KRgbWhite ); |
|
1277 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
1278 iProcessingTextLayout.DrawText( gc, *iProcessingText, ETrue, KRgbBlack ); |
|
1279 } |
|
1280 |
|
1281 if( iBatteryPaneController ) |
|
1282 { |
|
1283 iBatteryPaneController->Draw( gc ); |
|
1284 } |
|
1285 window.EndRedraw(); |
|
1286 } |
|
1287 } |
|
1288 } |
|
1289 DeactivateGc(); |
|
1290 PRINT_FRQ( _L("Camera <= CCamPreCaptureContainerBase::HandleCameraEventL") ); |
|
1291 } |
|
1292 break; |
|
1293 } |
|
1294 // ----------------------------------------------------- |
|
1295 case ECamCameraEventSsReady: |
|
1296 { |
|
1297 PRINT( _L( "Camera => CCamPreCaptureContainerBase::HandleCameraEventL: case ECamCameraEventSsReady" ) ); |
|
1298 |
|
1299 CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi()); |
|
1300 |
|
1301 if( KErrNone == aStatus |
|
1302 && ( ECamImageCaptureTimeLapse == appUi->CurrentBurstMode() || |
|
1303 ECamImageCaptureBurst == appUi->CurrentBurstMode() ) ) |
|
1304 { |
|
1305 // In timelapse mode, convert snapshot event to vf frame event |
|
1306 PRINT( _L( "In timelapse mode, converting event to ECamCameraEventVfFrameReady" ) ); |
|
1307 HandleCameraEventL( aStatus, ECamCameraEventVfFrameReady, aEventData ); |
|
1308 } |
|
1309 else if( KErrNone == aStatus && |
|
1310 ECamControllerImage == iController.CurrentMode() && |
|
1311 appUi->ShowPostCaptureView() ) |
|
1312 { |
|
1313 // use mask mode to draw battery pane when showing snapshot |
|
1314 // and hide side pane altogether ( as there is no feasible way to draw |
|
1315 // it properly on top of the snapshot because of the current CCamIndicator implementation) |
|
1316 iSidePane->MakeVisible( EFalse ); |
|
1317 // also hide zoom pane at the same time |
|
1318 iZoomPane->MakeVisible( EFalse, EFalse ); |
|
1319 |
|
1320 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMPRECAPTURECONTAINERBASE_HANDLECAMERAEVENTL, "e_CAM_PRI_SHOT_TO_SNAPSHOT 0" ); //CCORAPP_PRI_SHOT_TO_SNAPSHOT_END |
|
1321 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMPRECAPTURECONTAINERBASE_HANDLECAMERAEVENTL, "e_CAM_APP_SNAPSHOT_DRAW 1" ); //CCORAPP_SNAPSHOT_DRAW_START |
|
1322 HandleCameraEventL( aStatus, ECamCameraEventVfFrameReady, aEventData ); |
|
1323 OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMPRECAPTURECONTAINERBASE_HANDLECAMERAEVENTL, "e_CAM_APP_SNAPSHOT_DRAW 0" ); //CCORAPP_SNAPSHOT_DRAW_END |
|
1324 } |
|
1325 |
|
1326 PRINT( _L( "Camera <= CCamPreCaptureContainerBase::HandleCameraEventL" ) ); |
|
1327 break; |
|
1328 } |
|
1329 // ----------------------------------------------------- |
|
1330 default: |
|
1331 { |
|
1332 break; |
|
1333 } |
|
1334 // ----------------------------------------------------- |
|
1335 } |
|
1336 } |
|
1337 |
|
1338 |
|
1339 // --------------------------------------------------------- |
|
1340 // CCamPreCaptureContainerBase::DrawToContext |
|
1341 // Draws Screen content to graphics context |
|
1342 // --------------------------------------------------------- |
|
1343 // |
|
1344 void |
|
1345 CCamPreCaptureContainerBase::DrawToContext( CBitmapContext& aGc, |
|
1346 const CFbsBitmap* aFrame ) |
|
1347 { |
|
1348 PRINT( _L( "Camera => CCamPreCaptureContainerBase::DrawToContext" ) ); |
|
1349 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
1350 if ( !appUi->IsWaitDialog() || !appUi->IsQwerty2ndCamera() ) |
|
1351 { |
|
1352 aGc.SetBrushColor( TRgb( KCamPrecaptureBgColor ) ); |
|
1353 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1354 aGc.SetPenColor( TRgb( KCamPrecaptureBgColor ) ); |
|
1355 aGc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
1356 aGc.DrawRect( Rect() ); |
|
1357 |
|
1358 |
|
1359 DrawFrameNow( aGc, aFrame ); |
|
1360 aGc.SetBrushStyle(CGraphicsContext::ENullBrush ); |
|
1361 DrawScreenFurniture( aGc ); |
|
1362 DrawActivePalette( aGc ); |
|
1363 DrawNaviControls( aGc ); |
|
1364 } |
|
1365 PRINT( _L( "Camera <= CCamPreCaptureContainerBase::DrawToContext" ) ); |
|
1366 } |
|
1367 |
|
1368 // =========================================================================== |
|
1369 // From MCamCameraObserver |
|
1370 |
|
1371 // --------------------------------------------------------------------------- |
|
1372 // IntSettingChangedL <<virtual>> |
|
1373 // --------------------------------------------------------------------------- |
|
1374 // |
|
1375 void |
|
1376 CCamPreCaptureContainerBase::IntSettingChangedL( |
|
1377 TCamSettingItemIds aSettingItem, |
|
1378 TInt aSettingValue ) |
|
1379 { |
|
1380 switch( aSettingItem ) |
|
1381 { |
|
1382 // ----------------------------------------------------- |
|
1383 case ECamSettingItemViewfinderGrid: |
|
1384 { |
|
1385 PRINT( _L("Camera <> CCamPreCaptureContainerBase::IntSettingChangedL: ECamSettingItemViewfinderGrid") ); |
|
1386 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1387 |
|
1388 if( iVfGridDrawer ) |
|
1389 { |
|
1390 iVfGridDrawer->SetVisible( ECamViewfinderGridOn == aSettingValue ); |
|
1391 if( appUi && appUi->APHandler() ) |
|
1392 { |
|
1393 // Disable the redrawing requested by AP as we do full redraw right after. |
|
1394 // Avoids some unwanted blinking in AP area. |
|
1395 iDisableRedraws = ETrue; |
|
1396 // Not critical if fails. |
|
1397 // Tooltip and icon shown wrong then until next update. |
|
1398 // Cannot leave here, as redraws need to be enabled again. |
|
1399 TRAP_IGNORE( appUi->APHandler()->UpdateActivePaletteL() ); |
|
1400 iDisableRedraws = EFalse; |
|
1401 } |
|
1402 DrawNow(); |
|
1403 } |
|
1404 break; |
|
1405 } |
|
1406 // ----------------------------------------------------- |
|
1407 case ECamSettingItemFaceTracking: |
|
1408 { |
|
1409 PRINT( _L("Camera <> CCamPreCaptureContainerBase::IntSettingChangedL: ECamSettingItemFaceTracking") ); |
|
1410 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1411 if( appUi && appUi->APHandler() ) |
|
1412 { |
|
1413 // Disable the redrawing requested by AP as we do full redraw right after. |
|
1414 // Avoids some unwanted blinking in AP area. |
|
1415 iDisableRedraws = ETrue; |
|
1416 // Not critical if fails. |
|
1417 // Tooltip and icon shown wrong then until next update. |
|
1418 // Cannot leave here, as redraws need to be enabled again. |
|
1419 TRAP_IGNORE( appUi->APHandler()->UpdateActivePaletteL() ); |
|
1420 iDisableRedraws = EFalse; |
|
1421 } |
|
1422 DrawNow(); |
|
1423 break; |
|
1424 } |
|
1425 // ----------------------------------------------------- |
|
1426 default: |
|
1427 break; |
|
1428 // ----------------------------------------------------- |
|
1429 } |
|
1430 } |
|
1431 |
|
1432 // --------------------------------------------------------------------------- |
|
1433 // TextSettingChangedL <<virtual>> |
|
1434 // --------------------------------------------------------------------------- |
|
1435 // |
|
1436 void |
|
1437 CCamPreCaptureContainerBase |
|
1438 ::TextSettingChangedL( TCamSettingItemIds /*aSettingItem */, |
|
1439 const TDesC& /*aSettingValue*/ ) |
|
1440 { |
|
1441 /* |
|
1442 switch( aSettingItem ) |
|
1443 { |
|
1444 default: |
|
1445 break; |
|
1446 } |
|
1447 */ |
|
1448 } |
|
1449 |
|
1450 |
|
1451 // =========================================================================== |
|
1452 // </CAMERAAPP_CAPI_V2_MIGRATION> |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 // --------------------------------------------------------- |
|
1458 // CCamPreCaptureContainerBase::DrawFrameNow |
|
1459 // Blit the bitmap |
|
1460 // --------------------------------------------------------- |
|
1461 // |
|
1462 void |
|
1463 CCamPreCaptureContainerBase |
|
1464 ::DrawFrameNow( CBitmapContext& aGc, |
|
1465 const CFbsBitmap* aFrame ) const |
|
1466 { |
|
1467 // PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawFrameNow")) |
|
1468 TRect frameRect = ViewFinderFrameRect(); |
|
1469 TSize fsize = aFrame->SizeInPixels(); |
|
1470 |
|
1471 // If the viewfinder bitmap is LARGER than the masked bitmap |
|
1472 // and we should be masked |
|
1473 if ( fsize.iWidth > frameRect.Width() |
|
1474 || fsize.iHeight > frameRect.Height() ) |
|
1475 { |
|
1476 // Work out the rectangle of the viewfinder bitmap to draw |
|
1477 TInt borderX = ( fsize.iWidth - frameRect.Width() ) / 2; |
|
1478 TInt borderY = ( fsize.iHeight - frameRect.Height() ) / 2; |
|
1479 TRect bmCropRect( borderX, borderY, fsize.iWidth - borderX, fsize.iHeight - borderY ); |
|
1480 |
|
1481 // Draw the "crop rect" area of the viewfinder in the cropped frame |
|
1482 aGc.BitBlt( frameRect.iTl, aFrame, bmCropRect ); |
|
1483 } |
|
1484 else if( fsize.iWidth > Rect().Width() |
|
1485 || fsize.iHeight > Rect().Height() ) |
|
1486 { |
|
1487 // Work out the rectangle of the viewfinder bitmap to draw |
|
1488 TInt borderX = ( fsize.iWidth - Rect().Width() ) / 2; |
|
1489 TInt borderY = ( fsize.iHeight - Rect().Height() ) / 2; |
|
1490 TRect bmCropRect( borderX, borderY, fsize.iWidth - borderX, fsize.iHeight - borderY ); |
|
1491 |
|
1492 // Draw the "crop rect" area of the viewfinder in the cropped frame |
|
1493 aGc.BitBlt( frameRect.iTl, aFrame, bmCropRect ); |
|
1494 } |
|
1495 else |
|
1496 { |
|
1497 // Just draw the viewfinder frame in the frame rectangle |
|
1498 aGc.BitBlt( frameRect.iTl, aFrame ); |
|
1499 } |
|
1500 // PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawFrameNow")) |
|
1501 } |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 // --------------------------------------------------------- |
|
1507 // CCamPreCaptureContainerBase::DrawReticule |
|
1508 // Draw the reticule |
|
1509 // --------------------------------------------------------- |
|
1510 // |
|
1511 void CCamPreCaptureContainerBase::DrawReticule( CBitmapContext& aGc ) const |
|
1512 { |
|
1513 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::DrawReticule")) |
|
1514 if ( iController.UiConfigManagerPtr() && |
|
1515 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
1516 { |
|
1517 ReDrawReticule( iReticuleRect, aGc ); |
|
1518 } |
|
1519 PRINT_FRQ( _L("Camera <= CCamPreCaptureContainerBase::DrawReticule")) |
|
1520 } |
|
1521 |
|
1522 // --------------------------------------------------------- |
|
1523 // ReDrawReticule |
|
1524 // |
|
1525 // Handle partial redraw of reticule. |
|
1526 // NOTE: Could be better optimized for partial redraws. |
|
1527 // --------------------------------------------------------- |
|
1528 // |
|
1529 void |
|
1530 CCamPreCaptureContainerBase |
|
1531 ::ReDrawReticule( const TRect& aRect, |
|
1532 CBitmapContext& aGc ) const |
|
1533 { |
|
1534 if( iShowReticule |
|
1535 && iPhotoSceneUsesReticule |
|
1536 && iReticuleRect.Intersects( aRect ) |
|
1537 && iController.IsViewFinding() |
|
1538 && iController.UiConfigManagerPtr() |
|
1539 && iController.UiConfigManagerPtr()->IsAutoFocusSupported() |
|
1540 && !iController.UiConfigManagerPtr()->IsFaceTrackingSupported() |
|
1541 ) |
|
1542 { |
|
1543 aGc.SetClippingRect( aRect ); |
|
1544 |
|
1545 // Overlay reticule (though which bitmap used depends on focus state) |
|
1546 switch ( iFocusState ) |
|
1547 { |
|
1548 case EFocusStateFocusFailed: |
|
1549 DrawAf( aGc, iAfErrIcon ); |
|
1550 break; |
|
1551 case EFocusStateFocusAchieved: |
|
1552 DrawAf( aGc, iAfFocusIcon ); |
|
1553 break; |
|
1554 } |
|
1555 |
|
1556 aGc.CancelClippingRect(); |
|
1557 } |
|
1558 else |
|
1559 { |
|
1560 // Nothing needs to be done. |
|
1561 } |
|
1562 } |
|
1563 |
|
1564 |
|
1565 |
|
1566 // --------------------------------------------------------- |
|
1567 // CCamPreCaptureContainerBase::ForceSideZoomPaneDraw |
|
1568 // Force the side-pane or zoom-pane to redraw. |
|
1569 // --------------------------------------------------------- |
|
1570 // |
|
1571 void CCamPreCaptureContainerBase::ForceSideZoomPaneDraw() const |
|
1572 { |
|
1573 if( iSidePane->IsVisible() ) |
|
1574 { |
|
1575 ActivateGc(); |
|
1576 iSidePane->Draw( SystemGc() ); |
|
1577 DeactivateGc(); |
|
1578 } |
|
1579 else |
|
1580 { |
|
1581 ActivateGc(); |
|
1582 iZoomPane->Draw( SystemGc() ); |
|
1583 DeactivateGc(); |
|
1584 } |
|
1585 |
|
1586 } |
|
1587 |
|
1588 // --------------------------------------------------------- |
|
1589 // CCamPreCaptureContainerBase::CreateResolutionIndicatorL |
|
1590 // Create the resolution indicator |
|
1591 // --------------------------------------------------------- |
|
1592 // |
|
1593 void CCamPreCaptureContainerBase::CreateResolutionIndicatorL() |
|
1594 { |
|
1595 RArray<TInt> icons; |
|
1596 CleanupClosePushL( icons ); |
|
1597 |
|
1598 iController.Configuration()->GetPsiIntArrayL( ResolutionIndicatorIconPsiKey(), icons ); |
|
1599 TInt count = icons.Count(); |
|
1600 |
|
1601 // Get the icon rect from the derived class |
|
1602 TRect iconRect = ResolutionIndicatorRect(); |
|
1603 |
|
1604 CCamIndicator* indicator; |
|
1605 for( TInt i = 0; i < count; i+=2 ) |
|
1606 { |
|
1607 indicator = CCamIndicator::NewL( iconRect ); |
|
1608 CleanupStack::PushL( indicator ); |
|
1609 indicator->AddIconL( icons[i], icons[i+1] ); // Bitmap & mask. |
|
1610 indicator->SetRect( iconRect ); |
|
1611 User::LeaveIfError( iResolutionIndicators.Append( indicator ) ); |
|
1612 CleanupStack::Pop( indicator ); |
|
1613 } |
|
1614 |
|
1615 CleanupStack::PopAndDestroy( &icons ); |
|
1616 |
|
1617 // initialise the indicator |
|
1618 SetResolutionIndicator(); |
|
1619 } |
|
1620 |
|
1621 // ---------------------------------------------------- |
|
1622 // CCamPreCaptureContainerBase::BurstModeActiveL |
|
1623 // Notification that the burst mode has been activated/deactivated |
|
1624 // ---------------------------------------------------- |
|
1625 // |
|
1626 void CCamPreCaptureContainerBase::BurstModeActiveL( TBool /*aActive*/, TBool /*aStillModeActive*/ ) |
|
1627 { |
|
1628 SetResolutionIndicator(); |
|
1629 if ( !iController.IsTouchScreenSupported() ) |
|
1630 { |
|
1631 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1632 if( appUi && appUi->APHandler() ) |
|
1633 { |
|
1634 // Disable the redrawing requested by AP as we do full redraw right after. |
|
1635 // Avoids some unwanted blinking in AP area. |
|
1636 iDisableRedraws = ETrue; |
|
1637 // Not critical if fails. |
|
1638 // Tooltip and icon shown wrong then until next update. |
|
1639 // Cannot leave here, as redraws need to be enabled again. |
|
1640 TRAP_IGNORE( appUi->APHandler()->UpdateActivePaletteL() ); |
|
1641 iDisableRedraws = EFalse; |
|
1642 } |
|
1643 DrawNow(); |
|
1644 } |
|
1645 } |
|
1646 |
|
1647 // ---------------------------------------------------- |
|
1648 // CCamPreCaptureContainerBase::IncreaseFlashSettingL |
|
1649 // Move up through the flash settings |
|
1650 // ---------------------------------------------------- |
|
1651 // |
|
1652 void CCamPreCaptureContainerBase::IncreaseFlashSettingL() |
|
1653 { |
|
1654 // intentionally doing nothing |
|
1655 } |
|
1656 |
|
1657 // ---------------------------------------------------- |
|
1658 // CCamPreCaptureContainerBase::DecreaseFlashSettingL |
|
1659 // Move down through the flash settings |
|
1660 // ---------------------------------------------------- |
|
1661 // |
|
1662 void CCamPreCaptureContainerBase::DecreaseFlashSettingL() |
|
1663 { |
|
1664 // intentionally doing nothing |
|
1665 } |
|
1666 |
|
1667 // ---------------------------------------------------- |
|
1668 // CCamPreCaptureContainerBase::HandleLeftRightNaviKeyL |
|
1669 // Initiate behaviour in response to a navi key left/right |
|
1670 // arrow press |
|
1671 // ---------------------------------------------------- |
|
1672 // |
|
1673 TKeyResponse CCamPreCaptureContainerBase::HandleLeftRightNaviKeyL( |
|
1674 const TKeyEvent& aKeyEvent, |
|
1675 |
|
1676 TEventCode /*aType*/ ) |
|
1677 { |
|
1678 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() ); |
|
1679 // Find out which behaviour is mapped to the key |
|
1680 TCamPsiKey queryValue = ECamPsiLeftNaviKey; |
|
1681 if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
1682 { |
|
1683 queryValue = ECamPsiRightNaviKey; |
|
1684 } |
|
1685 else if ( appUi->IsSecondCameraEnabled() ) |
|
1686 { |
|
1687 queryValue = ECamPsiLeftNaviKeyCam2; |
|
1688 } |
|
1689 else |
|
1690 { |
|
1691 // remove lint warning |
|
1692 } |
|
1693 |
|
1694 TInt keyFunction; |
|
1695 User::LeaveIfError( CamUtility::GetPsiInt( queryValue, keyFunction ) ); |
|
1696 |
|
1697 // Handle the key |
|
1698 switch ( keyFunction ) |
|
1699 { |
|
1700 case ECamNaviKeyIncreaseFlashSetting: |
|
1701 { |
|
1702 IncreaseFlashSettingL(); |
|
1703 return EKeyWasConsumed; |
|
1704 } |
|
1705 // No break as unreachable |
|
1706 case ECamNaviKeyDecreaseFlashSetting: |
|
1707 { |
|
1708 DecreaseFlashSettingL(); |
|
1709 return EKeyWasConsumed; |
|
1710 } |
|
1711 // No break as unreachable |
|
1712 |
|
1713 default: |
|
1714 break; |
|
1715 } |
|
1716 return EKeyWasNotConsumed; |
|
1717 } |
|
1718 |
|
1719 // ---------------------------------------------------- |
|
1720 // CCamPreCaptureContainerBase::CountComponentControls |
|
1721 // Return number of child controls owned by this control |
|
1722 // ---------------------------------------------------- |
|
1723 // |
|
1724 TInt CCamPreCaptureContainerBase::CountComponentControls() const |
|
1725 { |
|
1726 TInt count = CCamContainerBase::CountComponentControls(); |
|
1727 if(iActivePalette && iActivePalette->CoeControl()->IsVisible()) |
|
1728 { |
|
1729 count++; //Active Palette |
|
1730 } |
|
1731 |
|
1732 if( iCaptureButtonContainer ) // Capture button container |
|
1733 { |
|
1734 count++; |
|
1735 } |
|
1736 PRINT1( _L("Camera <> CCamPreCaptureContainerBase::CountComponentControls %d"), count ); |
|
1737 return count; |
|
1738 } |
|
1739 |
|
1740 // ---------------------------------------------------- |
|
1741 // CCamPreCaptureContainerBase::ComponentControl |
|
1742 // Return requested control |
|
1743 // ---------------------------------------------------- |
|
1744 // |
|
1745 CCoeControl* CCamPreCaptureContainerBase::ComponentControl( TInt aIndex ) const |
|
1746 { |
|
1747 PRINT1( _L("Camera <> CCamPreCaptureContainerBase::ComponentControl index:%d"), aIndex ); |
|
1748 CCoeControl* con = CCamContainerBase::ComponentControl( aIndex ); |
|
1749 if( con ) |
|
1750 return con; |
|
1751 |
|
1752 switch ( aIndex ) |
|
1753 { |
|
1754 /* |
|
1755 case ECamTimeLapseControl: |
|
1756 { |
|
1757 |
|
1758 if ( iTimeLapseSlider && static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() )->TimeLapseEnabled() ) |
|
1759 { |
|
1760 con = iTimeLapseSlider; |
|
1761 } |
|
1762 else |
|
1763 |
|
1764 { |
|
1765 con = iNaviCounterControl; |
|
1766 } |
|
1767 break; |
|
1768 } |
|
1769 */ |
|
1770 |
|
1771 case ECamActivePalette: |
|
1772 { |
|
1773 if(iActivePalette && iActivePalette->CoeControl()->IsVisible()) |
|
1774 { |
|
1775 con = iActivePalette->CoeControl(); |
|
1776 } |
|
1777 else if( iCaptureButtonContainer ) |
|
1778 { |
|
1779 PRINT( _L("Camera <> capture button container A") ); |
|
1780 con = iCaptureButtonContainer; |
|
1781 } |
|
1782 else |
|
1783 { |
|
1784 |
|
1785 } |
|
1786 break; |
|
1787 } |
|
1788 case ECamCaptureButton: |
|
1789 { |
|
1790 if( iCaptureButtonContainer ) |
|
1791 { |
|
1792 PRINT( _L("Camera <> capture button container A") ); |
|
1793 con = iCaptureButtonContainer; |
|
1794 } |
|
1795 } |
|
1796 default: |
|
1797 break; |
|
1798 } |
|
1799 return con; |
|
1800 } |
|
1801 |
|
1802 |
|
1803 // ---------------------------------------------------- |
|
1804 // CCamPreCaptureContainerBase::HandleCommand |
|
1805 // Handle CBA key and options menu events for SetupPane |
|
1806 // ---------------------------------------------------- |
|
1807 // |
|
1808 |
|
1809 void CCamPreCaptureContainerBase::HandleCommand( TInt /* aCommand */ ) |
|
1810 { |
|
1811 |
|
1812 } |
|
1813 |
|
1814 |
|
1815 // --------------------------------------------------------- |
|
1816 // CCamPreCaptureContainerBase::GetAutoFocusDelay |
|
1817 // |
|
1818 // --------------------------------------------------------------------------- |
|
1819 // CCamPreCaptureContainerBase::DrawScreenFurniture |
|
1820 // Draw reticule, side or zoom pane and softkeys |
|
1821 // --------------------------------------------------------------------------- |
|
1822 // |
|
1823 void |
|
1824 CCamPreCaptureContainerBase |
|
1825 ::DrawScreenFurniture( CBitmapContext& aGc ) const |
|
1826 { |
|
1827 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::DrawScreenFurniture" )) |
|
1828 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1829 |
|
1830 |
|
1831 TCamOrientation orientation = appUi->CamOrientation(); |
|
1832 if ( iController.ActiveCamera() == ECamActiveCameraPrimary && |
|
1833 ( orientation == ECamOrientationCamcorder || orientation == ECamOrientationCamcorderLeft ) ) |
|
1834 { |
|
1835 // ------------------------------- |
|
1836 // Viewfinder grid |
|
1837 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase: drawing VF grid" ) ); |
|
1838 DrawVfGrid( aGc ); |
|
1839 // ------------------------------- |
|
1840 // Reticule |
|
1841 if ( iController.UiConfigManagerPtr() && |
|
1842 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
1843 { |
|
1844 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase: drawing reticule" ) ); |
|
1845 DrawReticule( aGc ); |
|
1846 } |
|
1847 } |
|
1848 else |
|
1849 { |
|
1850 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase: No reticule / grid (as secondary/none camera)") ); |
|
1851 } |
|
1852 |
|
1853 // ------------------------------------------------------- |
|
1854 // Zoom pane |
|
1855 // PRINT( _L("Camera <> CCamPreCaptureContainerBase: condition zoom pane" )) |
|
1856 if ( iZoomPane->IsVisible() && |
|
1857 !iController.SequenceCaptureInProgress() && |
|
1858 iController.ActiveCamera() == ECamActiveCameraPrimary ) |
|
1859 { |
|
1860 PRINT_FRQ( _L("Camera <> CCamPreCaptureContainerBase: drawing zoom pane" )) |
|
1861 iZoomPane->Draw( aGc ); |
|
1862 } |
|
1863 |
|
1864 |
|
1865 // ------------------------------------------------------- |
|
1866 // Side pane indicators |
|
1867 if ( iSidePane->IsVisible() ) |
|
1868 { |
|
1869 // PRINT( _L("Camera <> CCamPreCaptureContainerBase: drawing side pane" )) |
|
1870 iSidePane->Draw( aGc ); |
|
1871 } |
|
1872 |
|
1873 // PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawScreenFurniture" )) |
|
1874 } |
|
1875 |
|
1876 // --------------------------------------------------------------------------- |
|
1877 // CCamPreCaptureContainerBase::DrawNaviControls |
|
1878 // Draws the navi pane items |
|
1879 // --------------------------------------------------------------------------- |
|
1880 // |
|
1881 void |
|
1882 CCamPreCaptureContainerBase::DrawNaviControls( CBitmapContext& aGc ) const |
|
1883 { |
|
1884 // PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawNaviControls" )) |
|
1885 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
1886 |
|
1887 if( appUi ) |
|
1888 { |
|
1889 TCamCameraMode mode = iController.CurrentMode(); |
|
1890 TCamImageCaptureMode imageMode = iController.CurrentImageModeSetup(); |
|
1891 TBool seqCapturing = iController.SequenceCaptureInProgress(); |
|
1892 TBool precaptureUiOn = appUi->DrawPreCaptureCourtesyUI(); |
|
1893 TBool paneVisible = EFalse; |
|
1894 |
|
1895 if( iProcessingText && //iProcessingBg && |
|
1896 iController.ActiveCamera() != ECamActiveCameraSecondary && |
|
1897 // ECamCaptureModeStill == appUi->CurrentCaptureMode() && |
|
1898 ECamControllerImage == iController.CurrentMode() && |
|
1899 // ECamOperationCaptureInProgress == iController.OperationState() |
|
1900 ECamImageCaptureNone == appUi->CurrentBurstMode() && // No text for sequence |
|
1901 ( ECamCapturing == iController.CurrentOperation() || |
|
1902 ECamCompleting == iController.CurrentOperation() ) |
|
1903 ) |
|
1904 { |
|
1905 // When iProcessingText exists (and we are in correct state), the processing |
|
1906 // image text needs to be drawn. |
|
1907 PRINT( _L("Camera <> CCamPreCaptureContainerBase: draw processing text.." ) ); |
|
1908 //iProcessingBg->Draw( aGc, Rect() ); |
|
1909 aGc.SetBrushColor( KRgbWhite ); |
|
1910 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
1911 iProcessingTextLayout.DrawText( aGc, *iProcessingText, ETrue, KRgbBlack ); |
|
1912 } |
|
1913 else if( iBurstProcessingText && |
|
1914 iController.ActiveCamera() != ECamActiveCameraSecondary && |
|
1915 ECamControllerImage == iController.CurrentMode() && |
|
1916 ( ECamImageCaptureBurst == appUi->CurrentBurstMode() && |
|
1917 ( ECamCapturing == iController.CurrentOperation() || |
|
1918 ECamCompleting == iController.CurrentOperation() ) && |
|
1919 iController.AllSnapshotsReceived() ) ) |
|
1920 { |
|
1921 PRINT( _L("Camera <> CCamPreCaptureContainerBase: draw burst processing text.." ) ); |
|
1922 aGc.SetBrushColor( KRgbWhite ); |
|
1923 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
1924 // localizing numbers in burst processing string |
|
1925 TPtr pointer = iBurstProcessingText->Des(); |
|
1926 AknTextUtils::LanguageSpecificNumberConversion( pointer ); |
|
1927 iBurstProcessingTextLayout.DrawText( aGc, *iBurstProcessingText, ETrue, KRgbBlack ); |
|
1928 } |
|
1929 else if( ECamPaneCounter == iPaneInUse ) |
|
1930 { |
|
1931 TBool showCounter = precaptureUiOn || seqCapturing; |
|
1932 TBool focusStateOk = ETrue; |
|
1933 if ( iController.UiConfigManagerPtr() && |
|
1934 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
1935 { |
|
1936 |
|
1937 focusStateOk = |
|
1938 ( EFocusStateNormal == iFocusState && |
|
1939 !iController.SequenceCaptureInProgress() ) || |
|
1940 ( imageMode == ECamImageCaptureBurst && |
|
1941 ( iController.CurrentOperation() == ECamCapturing || |
|
1942 ( iController.CurrentOperation() == ECamCompleting |
|
1943 && !iController.AllSnapshotsReceived() ) ) ); |
|
1944 |
|
1945 } |
|
1946 |
|
1947 if( focusStateOk || |
|
1948 ( showCounter && appUi->IsSecondCameraEnabled() ) ) |
|
1949 { |
|
1950 paneVisible = ETrue; |
|
1951 iNaviCounterControl->DrawNaviCtr( aGc ); |
|
1952 } |
|
1953 } |
|
1954 else if( ECamPaneProgress == iPaneInUse ) |
|
1955 { |
|
1956 paneVisible = ETrue; |
|
1957 iNaviProgressBarControl->DrawProgressBar( aGc ); |
|
1958 iNaviCounterControl->DrawNaviCtr( aGc ); |
|
1959 } |
|
1960 else |
|
1961 { |
|
1962 // Navi pane is not shown |
|
1963 paneVisible = EFalse; |
|
1964 } |
|
1965 |
|
1966 // Do not show if saving / focusing |
|
1967 TCamCaptureOperation operation = iController.CurrentOperation(); |
|
1968 TCamCaptureOperation videoOperation = iController.CurrentVideoOperation(); |
|
1969 |
|
1970 TBool operationOk = ( ECamNoOperation == operation |
|
1971 || ECamCompleting != videoOperation ); |
|
1972 |
|
1973 // In video mode, icon would show without panes when stopping |
|
1974 // if viev state is not checked. |
|
1975 if( appUi->CurrentViewState() == ECamViewStatePreCapture |
|
1976 && precaptureUiOn |
|
1977 && paneVisible |
|
1978 && operationOk |
|
1979 && !seqCapturing |
|
1980 ) |
|
1981 { |
|
1982 // Draw the resolution indicator |
|
1983 if ( appUi->ActiveCamera() == ECamActiveCameraPrimary |
|
1984 && ( CamUtility::IsNhdDevice() |
|
1985 || videoOperation == ECamNoOperation ) ) |
|
1986 { |
|
1987 iResolutionIndicators[iCurrentIndicator]->Draw( aGc ); |
|
1988 } |
|
1989 |
|
1990 DrawAdditionalIcons( aGc ); |
|
1991 |
|
1992 if ( iController.UiConfigManagerPtr() && |
|
1993 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
1994 { |
|
1995 if ( iLocationIndicatorVisible ) |
|
1996 { |
|
1997 // Draw the location indicator |
|
1998 iLocationIconController->Draw( aGc ); |
|
1999 } |
|
2000 } |
|
2001 } |
|
2002 |
|
2003 if( iBatteryPaneController ) |
|
2004 { |
|
2005 iBatteryPaneController->Draw( aGc ); |
|
2006 } |
|
2007 |
|
2008 } |
|
2009 |
|
2010 // PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawNaviControls" )) |
|
2011 } |
|
2012 |
|
2013 |
|
2014 // --------------------------------------------------------------------------- |
|
2015 // CCamPreCaptureContainerBase::DrawActivePalette |
|
2016 // Draws the active palette |
|
2017 // --------------------------------------------------------------------------- |
|
2018 // |
|
2019 void |
|
2020 CCamPreCaptureContainerBase::DrawActivePalette() const |
|
2021 { |
|
2022 |
|
2023 PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawActivePalette") ); |
|
2024 if ( !iController.IsTouchScreenSupported() ) |
|
2025 { |
|
2026 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2027 |
|
2028 // draw the active palette if needed |
|
2029 if( iActivePalette && appUi->DrawPreCaptureCourtesyUI() ) |
|
2030 { |
|
2031 PRINT( _L("Camera <> drawing active palette") ); |
|
2032 iActivePalette->RenderActivePalette( Rect() ); |
|
2033 } |
|
2034 } |
|
2035 |
|
2036 PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawActivePalette") ); |
|
2037 } |
|
2038 |
|
2039 // --------------------------------------------------------------------------- |
|
2040 // CCamPreCaptureContainerBase::DrawActivePalette |
|
2041 // Draws the active palette |
|
2042 // --------------------------------------------------------------------------- |
|
2043 // |
|
2044 void |
|
2045 CCamPreCaptureContainerBase::DrawActivePalette( CBitmapContext& aGc ) const |
|
2046 { |
|
2047 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::DrawActivePalette( aGc )") ); |
|
2048 if ( !iController.IsTouchScreenSupported() ) |
|
2049 { |
|
2050 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2051 |
|
2052 // draw the active palette if needed |
|
2053 if( iActivePalette && appUi->DrawPreCaptureCourtesyUI() ) |
|
2054 { |
|
2055 PRINT_FRQ( _L("Camera <> drawing active palette..") ); |
|
2056 iActivePalette->SetGc( &aGc ); |
|
2057 iActivePalette->RenderActivePalette( Rect() ); |
|
2058 iActivePalette->SetGc(); |
|
2059 } |
|
2060 } |
|
2061 PRINT_FRQ( _L("Camera <= CCamPreCaptureContainerBase::DrawActivePalette") ); |
|
2062 } |
|
2063 |
|
2064 |
|
2065 // ----------------------------------------------------------------------------- |
|
2066 // virtual CCamPreCaptureContainerBase::DrawVfGrid |
|
2067 // ----------------------------------------------------------------------------- |
|
2068 // |
|
2069 void |
|
2070 CCamPreCaptureContainerBase::DrawVfGrid( CBitmapContext& aGc ) const |
|
2071 { |
|
2072 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::DrawVfGrid") ); |
|
2073 // Draws nothing if not set visible. |
|
2074 if( iVfGridDrawer ) |
|
2075 { |
|
2076 iVfGridDrawer->Draw( iRect, aGc ); |
|
2077 } |
|
2078 PRINT_FRQ( _L("Camera <= CCamPreCaptureContainerBase::DrawVfGrid") ); |
|
2079 } |
|
2080 |
|
2081 // ----------------------------------------------------------------------------- |
|
2082 // virtual CCamPreCaptureContainerBase::ReDrawVfGrid |
|
2083 // ----------------------------------------------------------------------------- |
|
2084 // |
|
2085 void |
|
2086 CCamPreCaptureContainerBase::ReDrawVfGrid( const TRect& aRect, |
|
2087 CBitmapContext& aGc ) const |
|
2088 { |
|
2089 PRINT_FRQ( _L("Camera => CCamPreCaptureContainerBase::ReDrawVfGrid") ); |
|
2090 // Draws nothing if not set visible. |
|
2091 if( iVfGridDrawer |
|
2092 && iVfGridRect.Intersects( aRect ) |
|
2093 ) |
|
2094 { |
|
2095 iVfGridDrawer->Draw( aRect, aGc ); |
|
2096 } |
|
2097 PRINT_FRQ( _L("Camera <= CCamPreCaptureContainerBase::ReDrawVfGrid") ); |
|
2098 } |
|
2099 |
|
2100 // ----------------------------------------------------------------------------- |
|
2101 // virtual GetVFGridVisibilitySetting |
|
2102 // |
|
2103 // ----------------------------------------------------------------------------- |
|
2104 // |
|
2105 TBool |
|
2106 CCamPreCaptureContainerBase::GetVFGridVisibilitySetting() const |
|
2107 { |
|
2108 TInt value = iController.IntegerSettingValue( ECamSettingItemViewfinderGrid ); |
|
2109 return (ECamViewfinderGridOn == value); |
|
2110 } |
|
2111 |
|
2112 |
|
2113 // ----------------------------------------------------------------------------- |
|
2114 // virtual ResetVFGridVisibility |
|
2115 // |
|
2116 // ----------------------------------------------------------------------------- |
|
2117 // |
|
2118 void |
|
2119 CCamPreCaptureContainerBase::ResetVFGridVisibility() |
|
2120 { |
|
2121 if( iVfGridDrawer ) |
|
2122 { |
|
2123 iVfGridDrawer->SetVisible( GetVFGridVisibilitySetting() ); |
|
2124 } |
|
2125 } |
|
2126 |
|
2127 |
|
2128 // ----------------------------------------------------------------------------- |
|
2129 // CCamPreCaptureContainerBase::Redraw |
|
2130 // |
|
2131 // Redraw only part of screen. |
|
2132 // Active Palette animations need this to update its background. |
|
2133 // ----------------------------------------------------------------------------- |
|
2134 void CCamPreCaptureContainerBase::Redraw( const TRect& aArea ) |
|
2135 { |
|
2136 PRINT( _L("Camera => CCamPreCaptureContainerBase::Redraw") ); |
|
2137 |
|
2138 if( iDisableRedraws ) |
|
2139 { |
|
2140 PRINT( _L("Camera <= CCamPreCaptureContainerBase: redraw skipped") ); |
|
2141 return; |
|
2142 } |
|
2143 |
|
2144 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2145 |
|
2146 if( appUi && appUi->IsDirectViewfinderActive() ) |
|
2147 { |
|
2148 CWindowGc& gc = SystemGc(); |
|
2149 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
2150 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2151 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
2152 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
2153 gc.DrawRect( aArea ); |
|
2154 |
|
2155 // Viewfinder grid and reticule overlap with tooltips |
|
2156 // or Active Palette moving in/out the screen. |
|
2157 ReDrawVfGrid( aArea, gc ); |
|
2158 |
|
2159 if( iController.ActiveCamera() != ECamActiveCameraSecondary |
|
2160 && iController.UiConfigManagerPtr() |
|
2161 && iController.UiConfigManagerPtr()->IsAutoFocusSupported() |
|
2162 && !iTimeLapseVisible ) |
|
2163 { |
|
2164 ReDrawReticule( aArea, gc ); |
|
2165 } |
|
2166 } |
|
2167 else |
|
2168 { |
|
2169 if ( iBitmapGc ) |
|
2170 { |
|
2171 if ( iReceivedVfFrame && iViewFinderBackup ) |
|
2172 { |
|
2173 iBitmapGc->BitBlt( aArea.iTl, iViewFinderBackup, aArea ); |
|
2174 } |
|
2175 else |
|
2176 { |
|
2177 iBitmapGc->SetBrushColor( TRgb( KCamPrecaptureBgColor ) ); |
|
2178 iBitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
2179 iBitmapGc->DrawRect( aArea ); |
|
2180 iBitmapGc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
2181 } |
|
2182 ReDrawVfGrid( aArea, *iBitmapGc ); |
|
2183 |
|
2184 if ( iController.UiConfigManagerPtr() && |
|
2185 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2186 { |
|
2187 ReDrawReticule( aArea, *iBitmapGc ); |
|
2188 } |
|
2189 } |
|
2190 } |
|
2191 PRINT( _L("Camera <= CCamPreCaptureContainerBase::Redraw") ); |
|
2192 } |
|
2193 |
|
2194 |
|
2195 |
|
2196 // ----------------------------------------------------------------------------- |
|
2197 // HandleOperationStateChangeEventL |
|
2198 // |
|
2199 // Helper method to handle case ECamEventOperationStateChanged in |
|
2200 // HandleControllerEventL. |
|
2201 // ----------------------------------------------------------------------------- |
|
2202 // |
|
2203 void |
|
2204 CCamPreCaptureContainerBase::HandleOperationStateChangeEventL() |
|
2205 { |
|
2206 PRINT( _L("Camera => CCamPreCaptureContainerBase::HandleFocusStateChangeEventL") ); |
|
2207 |
|
2208 if ( iController.UiConfigManagerPtr() && |
|
2209 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2210 { |
|
2211 if( iPhotoSceneUsesReticule ) |
|
2212 { |
|
2213 TBool ftSupported = iController.UiConfigManagerPtr()->IsFaceTrackingSupported(); |
|
2214 switch ( iController.CurrentOperation() ) |
|
2215 { |
|
2216 // --------------------------------------------------- |
|
2217 case ECamFocusing: |
|
2218 { |
|
2219 PRINT(_L("Camera <> CCamPreCaptureContainerBase: FOCUSING")); |
|
2220 // set focusing icon - flashing |
|
2221 iFocusState = EFocusStateFocusing; |
|
2222 if ( !ftSupported ) |
|
2223 { |
|
2224 iReticuleFlashOn = ETrue; |
|
2225 |
|
2226 // Start reticule flashing timer |
|
2227 if ( iReticuleTimer->IsActive() ) |
|
2228 { |
|
2229 iReticuleTimer->Cancel(); |
|
2230 } |
|
2231 iReticuleTimer->Start( KReticuleFlashTimeout, |
|
2232 KReticuleFlashTimeout, |
|
2233 TCallBack(ReticuleTimerCallback , this) ); |
|
2234 } |
|
2235 // Hide the navi counter |
|
2236 iNaviCounterControl->MakeVisible( EFalse ); |
|
2237 |
|
2238 DrawDeferred(); |
|
2239 break; |
|
2240 } |
|
2241 // --------------------------------------------------- |
|
2242 case ECamFocused: |
|
2243 { |
|
2244 PRINT(_L("Camera <> CCamPreCaptureContainerBase: FOCUSED")); |
|
2245 // set focus achieved icon |
|
2246 iFocusState = EFocusStateFocusAchieved; |
|
2247 if ( !ftSupported ) |
|
2248 { |
|
2249 iReticuleTimer->Cancel(); |
|
2250 iReticuleFlashOn = ETrue; |
|
2251 } |
|
2252 |
|
2253 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_OVERLAY_UPD 0" ); //CCORAPP_OVERLAY_UPD_END |
|
2254 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_AF 0" ); //CCORAPP_AF_END |
|
2255 |
|
2256 DrawDeferred(); |
|
2257 OstTrace0( CAMERAAPP_PERFORMANCE, DUP6_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_PRI_AF_LOCK 0" ); |
|
2258 break; |
|
2259 } |
|
2260 // --------------------------------------------------- |
|
2261 case ECamFocusFailed: |
|
2262 { |
|
2263 PRINT(_L("Camera <> CCamPreCaptureContainerBase: FOCUS FAILED")); |
|
2264 // set focus failed icon |
|
2265 iFocusState = EFocusStateFocusFailed; |
|
2266 if ( !ftSupported ) |
|
2267 { |
|
2268 iReticuleTimer->Cancel(); |
|
2269 iReticuleFlashOn = ETrue; |
|
2270 } |
|
2271 OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_OVERLAY_UPD 0" ); |
|
2272 OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_AF 0" ); |
|
2273 |
|
2274 DrawDeferred(); |
|
2275 OstTrace0( CAMERAAPP_PERFORMANCE, DUP7_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_PRI_AF_LOCK 0" ); |
|
2276 break; |
|
2277 } |
|
2278 // --------------------------------------------------- |
|
2279 case ECamCapturing: |
|
2280 { |
|
2281 PRINT(_L("Camera <> CCamPreCaptureContainerBase: Capturing")); |
|
2282 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2283 if( appUi ) |
|
2284 { |
|
2285 // If in burst mode show the navi counter again |
|
2286 if( ECamImageCaptureBurst == appUi->CurrentBurstMode() ) |
|
2287 { |
|
2288 iNaviCounterControl->MakeVisible( ETrue ); |
|
2289 DrawDeferred(); |
|
2290 } |
|
2291 } |
|
2292 break; |
|
2293 } |
|
2294 // --------------------------------------------------- |
|
2295 case ECamNoOperation: |
|
2296 { |
|
2297 PRINT( _L("Camera <> CCamPreCaptureContainerBase:ECamNone")); |
|
2298 // Show the navi counter again |
|
2299 if ( iPaneInUse == ECamPaneCounter |
|
2300 && iController.IsAppUiAvailable() |
|
2301 ) |
|
2302 { |
|
2303 iNaviCounterControl->MakeVisible( ETrue ); |
|
2304 } |
|
2305 } |
|
2306 // lint -fallthrough |
|
2307 // Captured and saving or.. |
|
2308 case ECamCompleting: |
|
2309 { |
|
2310 PRINT1( _L("Camera <> CCamPreCaptureContainerBase: NOT FOCUSED ANY MORE, iFocusState=%d"), iFocusState ); |
|
2311 if ( iFocusState == EFocusStateFocusing ) |
|
2312 { |
|
2313 OstTrace0( CAMERAAPP_PERFORMANCE, DUP4_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_OVERLAY_UPD 0" ); |
|
2314 OstTrace0( CAMERAAPP_PERFORMANCE, DUP5_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_APP_AF 0" ); |
|
2315 OstTrace0( CAMERAAPP_PERFORMANCE, DUP8_CCAMPRECAPTURECONTAINERBASE_HANDLEOPERATIONSTATECHANGEEVENTL, "e_CAM_PRI_AF_LOCK 0" ); |
|
2316 } |
|
2317 |
|
2318 // clear focus indicator |
|
2319 iFocusState = EFocusStateNormal; |
|
2320 if ( !ftSupported ) |
|
2321 { |
|
2322 iReticuleTimer->Cancel(); |
|
2323 iReticuleFlashOn = ETrue; |
|
2324 } |
|
2325 iSidePane->MakeVisible(ETrue); |
|
2326 DrawDeferred(); |
|
2327 break; |
|
2328 } |
|
2329 // --------------------------------------------------- |
|
2330 default: |
|
2331 break; |
|
2332 } // switch |
|
2333 } // if |
|
2334 } |
|
2335 |
|
2336 PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandleFocusStateChangeEventL") ); |
|
2337 } |
|
2338 |
|
2339 |
|
2340 |
|
2341 // ----------------------------------------------------------------------------- |
|
2342 // SetupActivePaletteL |
|
2343 // |
|
2344 // (Re)Initializes Active Palette. This includes: |
|
2345 // 1) Creating Active Palette if needed |
|
2346 // 2) Clearing Active Palette existing items if needed |
|
2347 // - 1+2 done in CCamContainerBase::CreateActivePaletteL() |
|
2348 // 3) Setting Active Palette items from resource |
|
2349 // - resource is selected in GetAPResourceId which is |
|
2350 // implemented in inheriting classes. |
|
2351 // 4) Registering the view for AP |
|
2352 // 5) Setting the focus to the default AP item |
|
2353 // ----------------------------------------------------------------------------- |
|
2354 // |
|
2355 void |
|
2356 CCamPreCaptureContainerBase::SetupActivePaletteL( CCamViewBase* aView ) |
|
2357 { |
|
2358 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMPRECAPTURECONTAINERBASE_SETUPACTIVEPALETTEL, "e_CAM_APP_ACTIVEPALETTE_INIT 1" ); |
|
2359 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2360 |
|
2361 if ( !iController.IsTouchScreenSupported() |
|
2362 && ( !appUi->IsSecondCameraEnabled() |
|
2363 || ( !appUi->IsEmbedded() && appUi->IsSecondCameraEnabled() ) ) ) |
|
2364 { |
|
2365 // Creates active palette if needed. |
|
2366 // Clears items if active palette already exists. |
|
2367 CCamContainerBase::CreateActivePaletteL(); |
|
2368 |
|
2369 // Video and still precapture containers implement this method. |
|
2370 TInt resId = GetAPResourceId(); |
|
2371 |
|
2372 CCamActivePaletteHandler* apHandler = |
|
2373 static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->APHandler(); |
|
2374 |
|
2375 apHandler->InstallAPItemsL( resId ); |
|
2376 apHandler->SetView( aView ); |
|
2377 |
|
2378 if ( appUi->IsEmbedded() ) |
|
2379 { |
|
2380 /*#ifndef __WINS__ |
|
2381 if ( !appUi->IsInCallSend() ) |
|
2382 #endif*/ |
|
2383 { |
|
2384 // disable still/video mode switching in normal embedded mode |
|
2385 apHandler->SetItemVisible( ECamCmdNewVideo, EFalse ); |
|
2386 apHandler->SetItemVisible( ECamCmdNewPhoto, EFalse ); |
|
2387 } |
|
2388 } |
|
2389 |
|
2390 apHandler->ResetToDefaultItem(); |
|
2391 } |
|
2392 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMPRECAPTURECONTAINERBASE_SETUPACTIVEPALETTEL, "e_CAM_APP_ACTIVEPALETTE_INIT 0" ); |
|
2393 } |
|
2394 |
|
2395 |
|
2396 // ----------------------------------------------------------------------------- |
|
2397 // CCamPostCaptureContainer::BatteryPaneUpdated |
|
2398 // |
|
2399 // Called by CCamBatteryPaneController when battery pane content has been updated. |
|
2400 // Re-draws background under the battery pane and the battery pane itself. |
|
2401 // ----------------------------------------------------------------------------- |
|
2402 // |
|
2403 void |
|
2404 CCamPreCaptureContainerBase::BatteryPaneUpdated() |
|
2405 { |
|
2406 if( !iDisableRedraws && iBatteryPaneController ) |
|
2407 { |
|
2408 // Activate Gc |
|
2409 ActivateGc(); |
|
2410 |
|
2411 // Draw the battery pane |
|
2412 CWindowGc& gc = SystemGc(); |
|
2413 iBatteryPaneController->Draw( gc ); |
|
2414 |
|
2415 DeactivateGc(); |
|
2416 } |
|
2417 |
|
2418 } |
|
2419 |
|
2420 // ----------------------------------------------------------------------------- |
|
2421 // CCamPostCaptureContainer::LocationIconUpdated |
|
2422 // |
|
2423 // Called by CCamLocationIconController when battery pane content has been updated. |
|
2424 // Re-draws background under the location icon and the location icon itself. |
|
2425 // ----------------------------------------------------------------------------- |
|
2426 // |
|
2427 void CCamPreCaptureContainerBase::LocationIconUpdated() |
|
2428 { |
|
2429 PRINT( _L("Camera => CCamPreCaptureContainerBase::LocationIconUpdated()") ); |
|
2430 |
|
2431 if ( iController.UiConfigManagerPtr() && |
|
2432 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
2433 { |
|
2434 if ( !iDisableRedraws && iLocationIconController |
|
2435 && iController.IsViewFinding() |
|
2436 ) |
|
2437 { |
|
2438 // Get the location icon rectangle |
|
2439 TRect rect = iLocationIconController->Rect(); |
|
2440 // Activate Gc |
|
2441 ActivateGc(); |
|
2442 |
|
2443 // Invalidate the location icon area |
|
2444 RWindow window = Window(); |
|
2445 window.Invalidate( rect ); |
|
2446 window.BeginRedraw( rect ); |
|
2447 |
|
2448 // Redraw the background in that area |
|
2449 Redraw( rect ); |
|
2450 |
|
2451 // Draw the location icon |
|
2452 CWindowGc& gc = SystemGc(); |
|
2453 // Other navi controls should be drawn also before drawing location icon |
|
2454 // The drawing is done through DrawNaviControls() function since |
|
2455 // the background decoration should be drawn before the location indicator |
|
2456 DrawNaviControls(gc); |
|
2457 |
|
2458 // Tell the window redraw is finished and deactivate Gc |
|
2459 window.EndRedraw(); |
|
2460 DeactivateGc(); |
|
2461 } |
|
2462 } |
|
2463 PRINT( _L("Camera <= CCamPreCaptureContainerBase::LocationIconUpdated()") ); |
|
2464 } |
|
2465 |
|
2466 // ----------------------------------------------------------------------------- |
|
2467 // CCamPreCaptureContainerBase::HandleResourceChange |
|
2468 // |
|
2469 // Passes resource changes to battery pane controller |
|
2470 // ----------------------------------------------------------------------------- |
|
2471 // |
|
2472 void |
|
2473 CCamPreCaptureContainerBase::HandleResourceChange( TInt aType ) |
|
2474 { |
|
2475 if( iBatteryPaneController ) |
|
2476 { |
|
2477 // Inform battery pane of the resource change |
|
2478 iBatteryPaneController->HandleResourceChange( aType ); |
|
2479 } |
|
2480 |
|
2481 CCamContainerBase::HandleResourceChange( aType ); |
|
2482 } |
|
2483 |
|
2484 |
|
2485 // |
|
2486 // CCamPreCaptureContainerBase::HandlePointerEventL |
|
2487 // |
|
2488 void CCamPreCaptureContainerBase::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
2489 { |
|
2490 PRINT3( _L("Camera => CCamPreCaptureContainerBase::HandlePointerEventL iType=%d iPosition=(%d, %d)"), |
|
2491 aPointerEvent.iType, |
|
2492 aPointerEvent.iPosition.iX, |
|
2493 aPointerEvent.iPosition.iY ); |
|
2494 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2495 if ( !appUi->IsSecondCameraEnabled() ) |
|
2496 { |
|
2497 // don't let zoom pane be used when capturing image |
|
2498 if ( iController.CurrentMode() != ECamControllerImage || |
|
2499 ( iController.CurrentOperation() != ECamCapturing && |
|
2500 iController.CurrentOperation() != ECamCompleting && |
|
2501 iController.CurrentOperation() != ECamFocusing ) ) |
|
2502 { |
|
2503 if ( iZoomPane ) |
|
2504 { |
|
2505 if ( iZoomPane->HandlePointerEventL( aPointerEvent ) ) |
|
2506 { |
|
2507 ShowZoomPaneWithTimer(); |
|
2508 return; |
|
2509 } |
|
2510 } |
|
2511 } |
|
2512 |
|
2513 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
|
2514 !appUi->DrawPreCaptureCourtesyUI() ) |
|
2515 { |
|
2516 appUi->HandleCommandL( ECamCmdRaiseCourtesyUI ); |
|
2517 } |
|
2518 CCamContainerBase::HandlePointerEventL( aPointerEvent ); |
|
2519 } |
|
2520 |
|
2521 PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandlePointerEventL") ); |
|
2522 } |
|
2523 |
|
2524 // --------------------------------------------------------------------------- |
|
2525 // returns a count, not an error |
|
2526 // --------------------------------------------------------------------------- |
|
2527 // |
|
2528 TInt CCamPreCaptureContainerBase::CreateAfIconL( TRgb aColor ) |
|
2529 { |
|
2530 TInt AFIconCount(0); |
|
2531 if ( iController.UiConfigManagerPtr() && |
|
2532 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2533 { |
|
2534 CreateAfCornerL( aColor, EMbmCameraappQgn_indi_cam4_focus_frame_auto_tl ); |
|
2535 CreateAfCornerL( aColor, EMbmCameraappQgn_indi_cam4_focus_frame_auto_tr ); |
|
2536 CreateAfCornerL( aColor, EMbmCameraappQgn_indi_cam4_focus_frame_auto_bl ); |
|
2537 CreateAfCornerL( aColor, EMbmCameraappQgn_indi_cam4_focus_frame_auto_br ); |
|
2538 |
|
2539 AFIconCount = iAfIcons.Count(); |
|
2540 } |
|
2541 return AFIconCount; |
|
2542 } |
|
2543 |
|
2544 |
|
2545 // --------------------------------------------------------------------------- |
|
2546 // |
|
2547 // --------------------------------------------------------------------------- |
|
2548 // |
|
2549 void CCamPreCaptureContainerBase::CreateAfCornerL( TRgb aColor, |
|
2550 TInt aFileBitmapId ) |
|
2551 { |
|
2552 if ( iController.UiConfigManagerPtr() && |
|
2553 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2554 { |
|
2555 TFileName mbmFileName; |
|
2556 CamUtility::ResourceFileName( mbmFileName ); |
|
2557 TPtrC resname = mbmFileName; |
|
2558 |
|
2559 CFbsBitmap* bitmap = NULL; |
|
2560 CFbsBitmap* mask = NULL; |
|
2561 |
|
2562 // Create component bitmaps |
|
2563 AknIconUtils::CreateIconL( bitmap, mask, resname, |
|
2564 aFileBitmapId, aFileBitmapId+1 ); |
|
2565 |
|
2566 AknIconUtils::SetSize( bitmap, iAfIconCornerSize ); |
|
2567 CleanupStack::PushL( bitmap ); |
|
2568 CleanupStack::PushL( mask ); |
|
2569 |
|
2570 // Destroys mask, if doesn't leave |
|
2571 CamUtility::SetAlphaL( bitmap, mask, aColor ); |
|
2572 CleanupStack::Pop(); // (deleted) mask |
|
2573 User::LeaveIfError( iAfIcons.Append( bitmap ) ); |
|
2574 CleanupStack::Pop(); // bitmap |
|
2575 } |
|
2576 } |
|
2577 |
|
2578 // --------------------------------------------------------------------------- |
|
2579 // |
|
2580 // --------------------------------------------------------------------------- |
|
2581 // |
|
2582 void CCamPreCaptureContainerBase::SetAfIconSize( TInt aOffset ) |
|
2583 { |
|
2584 if ( iController.UiConfigManagerPtr() && |
|
2585 iController.UiConfigManagerPtr()->IsAutoFocusSupported() && |
|
2586 aOffset-- && iAfIcons.Count() > aOffset ) |
|
2587 { |
|
2588 for ( TInt i = aOffset; i > aOffset - KAFIconCorners ; i-- ) |
|
2589 { |
|
2590 AknIconUtils::SetSize( iAfIcons[i], iAfIconCornerSize ); |
|
2591 } |
|
2592 } |
|
2593 } |
|
2594 |
|
2595 // --------------------------------------------------------------------------- |
|
2596 // |
|
2597 // --------------------------------------------------------------------------- |
|
2598 // |
|
2599 void CCamPreCaptureContainerBase::DrawAf( CBitmapContext& aGc, |
|
2600 TInt aOffset ) const |
|
2601 { |
|
2602 if ( iController.UiConfigManagerPtr() && |
|
2603 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2604 { |
|
2605 TInt indx = aOffset - KAFIconCorners; |
|
2606 TInt corners = 0; |
|
2607 if ( aOffset && iAfIcons.Count() >= aOffset ) |
|
2608 { |
|
2609 while ( corners < KAFIconCorners && iLayouts.Count() > corners ) |
|
2610 { |
|
2611 TAknLayoutRect layout = iLayouts[corners]; |
|
2612 |
|
2613 aGc.BitBlt( layout.Rect().iTl, iAfIcons[ indx + corners ]); |
|
2614 corners++; |
|
2615 } |
|
2616 } |
|
2617 } |
|
2618 } |
|
2619 |
|
2620 // --------------------------------------------------------------------------- |
|
2621 // |
|
2622 // --------------------------------------------------------------------------- |
|
2623 // |
|
2624 void CCamPreCaptureContainerBase::SizeChanged() |
|
2625 { |
|
2626 if ( iController.UiConfigManagerPtr() && |
|
2627 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2628 { |
|
2629 if ( CamUtility::IsNhdDevice() ) |
|
2630 { |
|
2631 TouchLayout(); |
|
2632 } |
|
2633 else |
|
2634 { |
|
2635 NonTouchLayout(); |
|
2636 } |
|
2637 |
|
2638 if( !iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
2639 { |
|
2640 SetAfIconSize( iAfReadyIcon ); |
|
2641 SetAfIconSize( iAfFocusIcon ); |
|
2642 SetAfIconSize( iAfErrIcon ); |
|
2643 } |
|
2644 } |
|
2645 else |
|
2646 { |
|
2647 CCoeControl::SizeChanged(); |
|
2648 } |
|
2649 } |
|
2650 |
|
2651 // --------------------------------------------------------------------------- |
|
2652 // CCamPreCaptureContainerBase::NonTouchLayout |
|
2653 // --------------------------------------------------------------------------- |
|
2654 void CCamPreCaptureContainerBase::NonTouchLayout() |
|
2655 { |
|
2656 if ( iController.UiConfigManagerPtr() && |
|
2657 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2658 { |
|
2659 iLayouts.Reset(); |
|
2660 TAknLayoutRect parent; |
|
2661 TAknLayoutRect tmp; |
|
2662 TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
2663 TRect vfRect = ViewFinderFrameRect(); |
|
2664 |
|
2665 // Autofocus parent rectangle |
|
2666 parent.LayoutRect( vfRect, |
|
2667 AknLayoutScalable_Apps::cam6_autofocus_pane( variant ).LayoutLine() ); |
|
2668 iReticuleRect = parent.Rect(); |
|
2669 iReticuleRect.Move( vfRect.Center() - parent.Rect().Center() ); |
|
2670 |
|
2671 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2672 cam6_autofocus_pane_g1().LayoutLine() ); |
|
2673 iAfIconCornerSize = tmp.Rect().Size(); |
|
2674 iLayouts.Append( tmp ); // First corner |
|
2675 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2676 cam6_autofocus_pane_g2().LayoutLine() ); |
|
2677 iLayouts.Append( tmp ); |
|
2678 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2679 cam6_autofocus_pane_g3().LayoutLine() ); |
|
2680 iLayouts.Append( tmp ); |
|
2681 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2682 cam6_autofocus_pane_g4().LayoutLine() ); |
|
2683 iLayouts.Append( tmp ); |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 // --------------------------------------------------------------------------- |
|
2688 // CCamPreCaptureContainerBase::TouchLayout |
|
2689 // --------------------------------------------------------------------------- |
|
2690 void CCamPreCaptureContainerBase::TouchLayout() |
|
2691 { |
|
2692 if ( iController.UiConfigManagerPtr() && |
|
2693 iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
2694 { |
|
2695 iLayouts.Reset(); |
|
2696 TAknLayoutRect parent; |
|
2697 TAknLayoutRect tmp; |
|
2698 TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
2699 TRect vfRect = ViewFinderFrameRect(); |
|
2700 |
|
2701 // Autofocus parent rectangle |
|
2702 parent.LayoutRect( vfRect, |
|
2703 AknLayoutScalable_Apps::cam4_autofocus_pane( variant ).LayoutLine() ); |
|
2704 iReticuleRect = parent.Rect(); |
|
2705 iReticuleRect.Move( vfRect.Center() - parent.Rect().Center() ); |
|
2706 |
|
2707 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2708 cam4_autofocus_pane_g1().LayoutLine() ); |
|
2709 iAfIconCornerSize = tmp.Rect().Size(); |
|
2710 iLayouts.Append( tmp ); // First corner |
|
2711 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2712 cam4_autofocus_pane_g2().LayoutLine() ); |
|
2713 iLayouts.Append( tmp ); |
|
2714 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2715 cam4_autofocus_pane_g3().LayoutLine() ); |
|
2716 iLayouts.Append( tmp ); |
|
2717 tmp.LayoutRect( iReticuleRect, AknLayoutScalable_Apps:: |
|
2718 cam4_autofocus_pane_g3_copy1().LayoutLine() ); |
|
2719 iLayouts.Append( tmp ); |
|
2720 } |
|
2721 } |
|
2722 |
|
2723 // ---------------------------------------------------- |
|
2724 // CCamPreCaptureContainerBase::ResolutionIndicatorRect |
|
2725 // Returns the rectangle defining the position and size |
|
2726 // of the resolution icon |
|
2727 // ---------------------------------------------------- |
|
2728 // |
|
2729 TRect CCamPreCaptureContainerBase::ResolutionIndicatorRect() const |
|
2730 { |
|
2731 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
2732 TAknLayoutRect resolutionIconLayout; |
|
2733 TAknLayoutRect indicatorPane; |
|
2734 if ( CamUtility::IsNhdDevice() ) |
|
2735 { |
|
2736 TInt variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
2737 if ( appUi->TargetMode() == ECamControllerVideo ) |
|
2738 { |
|
2739 TRect rect; |
|
2740 TAknLayoutRect vidProgressPane; |
|
2741 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect ); |
|
2742 vidProgressPane.LayoutRect( rect, |
|
2743 AknLayoutScalable_Apps::vid4_progress_pane( variant ) ); |
|
2744 resolutionIconLayout.LayoutRect( vidProgressPane.Rect(), |
|
2745 AknLayoutScalable_Apps::vid4_progress_pane_g1() ); |
|
2746 } |
|
2747 else |
|
2748 { |
|
2749 indicatorPane.LayoutRect( Rect(), |
|
2750 AknLayoutScalable_Apps::cam4_indicators_pane( variant ) ); |
|
2751 |
|
2752 resolutionIconLayout.LayoutRect( indicatorPane.Rect(), |
|
2753 AknLayoutScalable_Apps::cam4_indicators_pane_g1() ); |
|
2754 } |
|
2755 } |
|
2756 else |
|
2757 { |
|
2758 TInt cba = AknLayoutUtils::CbaLocation() == |
|
2759 AknLayoutUtils::EAknCbaLocationLeft? |
|
2760 AknLayoutUtils::EAknCbaLocationLeft : 0; |
|
2761 |
|
2762 if ( appUi->TargetMode() == ECamControllerVideo ) |
|
2763 { |
|
2764 indicatorPane.LayoutRect( Rect(), |
|
2765 AknLayoutScalable_Apps::vid6_indi_pane( cba )); |
|
2766 |
|
2767 resolutionIconLayout.LayoutRect( indicatorPane.Rect(), |
|
2768 AknLayoutScalable_Apps::vid6_indi_pane_g1( cba ) ); |
|
2769 } |
|
2770 else |
|
2771 { |
|
2772 indicatorPane.LayoutRect( Rect(), |
|
2773 AknLayoutScalable_Apps::cam6_indi_pane( cba )); |
|
2774 |
|
2775 resolutionIconLayout.LayoutRect( indicatorPane.Rect(), |
|
2776 AknLayoutScalable_Apps::cam6_indi_pane_g1( cba ) ); |
|
2777 } |
|
2778 } |
|
2779 return resolutionIconLayout.Rect(); |
|
2780 } |
|
2781 |
|
2782 // ------------------------------------------------------------- |
|
2783 // CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange |
|
2784 // ------------------------------------------------------------- |
|
2785 // |
|
2786 void CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange( TBool aBlink ) |
|
2787 { |
|
2788 iBlinkResolutionIndicator = aBlink; |
|
2789 } |
|
2790 |
|
2791 // ------------------------------------------------------------- |
|
2792 // CCamPreCaptureContainerBase::DrawResolutionIndicator |
|
2793 // ------------------------------------------------------------- |
|
2794 // |
|
2795 void CCamPreCaptureContainerBase::DrawResolutionIndicator() |
|
2796 { |
|
2797 PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawResolutionIndicator") ); |
|
2798 iToggleCountdown--; |
|
2799 |
|
2800 // State changed, need to redraw |
|
2801 ActivateGc(); |
|
2802 |
|
2803 // Invalidate the flash icon area |
|
2804 TRect rect( (iBlinkModeIndicator) ? iSidePane->ModeIndicatorLayoutRect() |
|
2805 : iResolutionIndicators[iCurrentIndicator]->LayoutRect() ); |
|
2806 RWindow window = Window(); |
|
2807 window.Invalidate( rect ); |
|
2808 window.BeginRedraw( rect ); |
|
2809 |
|
2810 // Redraw the background in that area |
|
2811 Redraw( rect ); |
|
2812 |
|
2813 // Draw the icon |
|
2814 CWindowGc& gc = SystemGc(); |
|
2815 if ( iBlinkModeIndicator ) |
|
2816 { |
|
2817 iSidePane->DrawModeIndicator( gc, iDrawIndicator ); |
|
2818 } |
|
2819 else |
|
2820 { |
|
2821 // Mode indicator should be visible, while the resolution indicator blinks |
|
2822 if ( !iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() ) |
|
2823 { |
|
2824 iSidePane->DrawModeIndicator( gc, ETrue ); |
|
2825 } |
|
2826 |
|
2827 if( iDrawIndicator ) |
|
2828 { |
|
2829 iResolutionIndicators[iCurrentIndicator]->DisplayIcon(); |
|
2830 } |
|
2831 else |
|
2832 { |
|
2833 iResolutionIndicators[iCurrentIndicator]->ClearIcon(); |
|
2834 } |
|
2835 iResolutionIndicators[iCurrentIndicator]->Draw( gc ); |
|
2836 |
|
2837 // If blink timer is canceled abruptly(like capture image) at some places, resolution indicator may go missing in pre-capture mode. |
|
2838 // So alway set resolution clear flag to EFlase after drawing resolution indicator to avoiding missing indicator. |
|
2839 // This do not affect indicator blink function because this just set the flag, do not draw the indicator. |
|
2840 iResolutionIndicators[iCurrentIndicator]->DisplayIcon(); |
|
2841 } |
|
2842 |
|
2843 // Tell the window redraw is finished and deactivate Gc |
|
2844 window.EndRedraw(); |
|
2845 DeactivateGc(); |
|
2846 |
|
2847 // Stop the periodic timer when enough blinking has been done |
|
2848 if ( iDrawIndicator && iToggleCountdown <= 0 ) |
|
2849 { |
|
2850 iBlinkResolutionIndicator = EFalse; |
|
2851 iBlinkModeIndicator = EFalse; |
|
2852 iIndBlinkTimer->Cancel(); |
|
2853 } |
|
2854 |
|
2855 PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawResolutionIndicator") ); |
|
2856 } |
|
2857 |
|
2858 // ------------------------------------------------------------- |
|
2859 // CCamPreCaptureContainerBase::IndicatorVisible |
|
2860 // ------------------------------------------------------------- |
|
2861 // |
|
2862 TInt CCamPreCaptureContainerBase::IndicatorVisible( TAny *aSelf ) |
|
2863 { |
|
2864 PRINT( _L("Camera => CCamPreCaptureContainerBase::IndicatorVisible") ); |
|
2865 CCamPreCaptureContainerBase* self = static_cast<CCamPreCaptureContainerBase*> (aSelf); |
|
2866 |
|
2867 if ( self ) |
|
2868 { |
|
2869 self->iDrawIndicator = !self->iDrawIndicator; |
|
2870 self->DrawResolutionIndicator(); |
|
2871 } |
|
2872 PRINT( _L("Camera <= CCamPreCaptureContainerBase::IndicatorVisible") ); |
|
2873 return KErrNone; |
|
2874 } |
|
2875 |
|
2876 // ------------------------------------------------------------- |
|
2877 // CCamPreCaptureContainerBase::FocusChanged |
|
2878 // ------------------------------------------------------------- |
|
2879 // |
|
2880 void CCamPreCaptureContainerBase::FocusChanged( TDrawNow aDrawNow ) |
|
2881 { |
|
2882 PRINT3( _L("Camera <> CCamPreCaptureContainerBase::FocusChanged, draw:%d, focused:%d, button focused:%d"), |
|
2883 aDrawNow, IsFocused(), |
|
2884 iCaptureButtonContainer ? iCaptureButtonContainer->IsFocused() : 0 ); |
|
2885 UpdateCaptureButton(); |
|
2886 CCoeControl::FocusChanged( aDrawNow ); |
|
2887 } |
|
2888 |
|
2889 // ------------------------------------------------------------- |
|
2890 // CCamPreCaptureContainerBase::UpdateCaptureButton |
|
2891 // ------------------------------------------------------------- |
|
2892 // |
|
2893 void CCamPreCaptureContainerBase::UpdateCaptureButton() |
|
2894 { |
|
2895 PRINT(_L("Camera => CCamPreCaptureContainerBase::UpdateCaptureButton")); |
|
2896 |
|
2897 TBool buttonActive = EFalse; |
|
2898 if ( iCaptureButtonContainer ) |
|
2899 { |
|
2900 TCamCameraMode mode = iController.CurrentMode(); |
|
2901 |
|
2902 buttonActive = ( IsFocused() || iCaptureButtonContainer->IsFocused() ) |
|
2903 && ECamNoOperation == iController.CurrentOperation() |
|
2904 && iController.IsViewFinding() |
|
2905 && ( ECamControllerImage == mode || ECamControllerVideo == mode ); |
|
2906 |
|
2907 PRINT1( _L("Camera <> capture button shown:%d"), buttonActive ); |
|
2908 iCaptureButtonContainer->SetCaptureButtonShown( buttonActive ); |
|
2909 } |
|
2910 PRINT(_L("Camera <= CCamPreCaptureContainerBase::UpdateCaptureButton")); |
|
2911 } |
|
2912 |
|
2913 // ------------------------------------------------------------- |
|
2914 // CCamPreCaptureContainerBase::PrepareForCapture |
|
2915 // ------------------------------------------------------------- |
|
2916 // |
|
2917 void CCamPreCaptureContainerBase::PrepareForCapture() |
|
2918 { |
|
2919 if ( iZoomPane ) |
|
2920 { |
|
2921 PRINT( _L("Camera <> CCamPreCaptureContainerBase::PrepareForCapture - StopZoom()") ); |
|
2922 iZoomPane->StopZoom(); |
|
2923 } |
|
2924 |
|
2925 // Stop blinking icon when capture is initiated |
|
2926 if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() ) |
|
2927 { |
|
2928 iIndBlinkTimer->Cancel(); |
|
2929 iDrawIndicator = ETrue; |
|
2930 } |
|
2931 |
|
2932 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
2933 if ( iCaptureButtonContainer && !( appUi && appUi->SelfTimerEnabled() ) ) |
|
2934 { |
|
2935 iCaptureButtonContainer->SetCaptureButtonShown( EFalse ); |
|
2936 } |
|
2937 } |
|
2938 // End of File |
|
2939 |
|