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