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