camerauis/cameraapp/generic/src/CamStillPreCaptureContainer.cpp
branchRCL_3
changeset 54 bac7acad7cb3
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     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 class for still image pre-capture view*
       
    15 */
       
    16 
       
    17 // INCLUDE FILES
       
    18 #include <AknIconUtils.h>
       
    19 #include <cameraapp.mbg>
       
    20 
       
    21 #include <cameraapp.rsg>
       
    22 #include <vgacamsettings.rsg>
       
    23 #include <akntoolbar.h>
       
    24 #include <akntoolbarextension.h>
       
    25 #include <aknlayoutscalable_apps.cdl.h>
       
    26 
       
    27 #include "CamStillPreCaptureContainer.h"
       
    28 #include "CamLogger.h"
       
    29 #include "CamPreCaptureViewBase.h"
       
    30 #include "CamAppUi.h"
       
    31 #include "CamSidePane.h"
       
    32 #include "CamSelfTimer.h"
       
    33 #include "CamUtility.h"
       
    34 #include "camactivepalettehandler.h"
       
    35 #include "CameraUiConfigManager.h"
       
    36 #include "OstTraceDefinitions.h"
       
    37 #include "CamIndicator.h"
       
    38 #ifdef OST_TRACE_COMPILER_IN_USE
       
    39 #include "CamStillPreCaptureContainerTraces.h"
       
    40 #endif
       
    41 
       
    42 #include "camvfgridinterface.h"
       
    43 #include "camlinevfgriddrawer.h"
       
    44 #include "CamPanic.h"
       
    45 
       
    46 // Constants
       
    47 const TUid KGridDrawerUid = { KCamLineDrawVfGridUid };
       
    48 const TInt KGridHrzLines  = 2;
       
    49 const TInt KGridVrtLines  = 2;
       
    50 const TInt KGridThickness = 2;
       
    51 const TRgb KGridColor     = KRgbGray;
       
    52 const CGraphicsContext::TPenStyle KGridStyle = CGraphicsContext::ESolidPen;
       
    53 
       
    54 // ================= MEMBER FUNCTIONS =======================
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CCamStillPreCaptureContainer::NewL
       
    58 // Symbian OS two-phased constructor
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CCamStillPreCaptureContainer* CCamStillPreCaptureContainer::NewL(
       
    62         CCamAppController& aController,
       
    63         CAknView& aView,
       
    64         const TRect& aRect )
       
    65     {
       
    66     CCamStillPreCaptureContainer* self = new( ELeave ) CCamStillPreCaptureContainer(
       
    67         aController, aView );
       
    68 
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL( aRect );
       
    71     CleanupStack::Pop( self );
       
    72     // Return newly created CCamStillPreCaptureContainer instance
       
    73     return self;
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CCamStillPreCaptureContainer::~CCamStillPreCaptureContainer
       
    79 // Destructor
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CCamStillPreCaptureContainer::~CCamStillPreCaptureContainer()
       
    83   {
       
    84   PRINT( _L("Camera => ~CCamStillPreCaptureContainer" ))
       
    85 
       
    86   if ( iAPCreateAO )
       
    87       {
       
    88       iAPCreateAO->Cancel();
       
    89       delete iAPCreateAO;
       
    90       }
       
    91 
       
    92   if ( iXenonFlashSupported )
       
    93       {
       
    94       // Unsubscribe blink events
       
    95       if( CCamFlashStatus* flashStatus = iController.FlashStatus() )
       
    96         flashStatus->Subscribe( NULL );
       
    97 
       
    98       delete iFlashBitmap;
       
    99       delete iFlashBitmapMask;
       
   100       }
       
   101   PRINT( _L("Camera <= ~CCamStillPreCaptureContainer" ))
       
   102   }
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CCamStillPreCaptureContainer::ConstructL
       
   106 // Symbian OS 2nd phase constructor
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CCamStillPreCaptureContainer::ConstructL( const TRect& aRect )
       
   110   {
       
   111   PRINT( _L("Camera => CCamStillPreCaptureContainer::ConstructL" ))
       
   112   BaseConstructL( aRect );
       
   113 
       
   114   if ( iController.UiConfigManagerPtr() &&
       
   115        iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() )
       
   116       {
       
   117       iAPCreateAO = CIdle::NewL(CActive::EPriorityStandard);
       
   118       }
       
   119 
       
   120   if ( iController.UiConfigManagerPtr() &&
       
   121        iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   122       {
       
   123       if( iController.IntegerSettingValue( ECamSettingItemPhotoShowFocusPoint ) )
       
   124         {
       
   125         iShowReticule = EFalse;
       
   126         }
       
   127       else
       
   128         {
       
   129         iShowReticule = ETrue;
       
   130         }
       
   131     }
       
   132 
       
   133   iSidePane->SetCaptureMode( ECamControllerImage );
       
   134 
       
   135 
       
   136   iXenonFlashSupported = iController.UiConfigManagerPtr()->IsXenonFlashSupported();
       
   137   if ( iXenonFlashSupported )
       
   138       {
       
   139       InitFlashIconL();
       
   140       LayoutFlashIcon();
       
   141       }
       
   142 
       
   143   PrepareProcessingTextL( ETrue );
       
   144 
       
   145   if ( !( iController.UiConfigManagerPtr() &&
       
   146        iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) )
       
   147       {
       
   148       OstTrace0( CAMERAAPP_PERFORMANCE, CCAMSTILLPRECAPTURECONTAINER_CONSTRUCTL, "e_CAM_APP_AP_SETUP 1" );
       
   149       static_cast<CCamPreCaptureContainerBase*>( this )
       
   150           ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       
   151       OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMSTILLPRECAPTURECONTAINER_CONSTRUCTL, "e_CAM_APP_AP_SETUP 0" );
       
   152       }
       
   153 
       
   154   PRINT( _L("Camera <= CCamStillPreCaptureContainer::ConstructL" ))
       
   155   }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CCamContainerBase::BaseConstructL
       
   159 // Symbian OS 2nd phase constructor
       
   160 // ---------------------------------------------------------
       
   161 //
       
   162 void CCamStillPreCaptureContainer::BaseConstructL( const TRect& aRect )
       
   163     {
       
   164     CCamPreCaptureContainerBase::BaseConstructL( aRect );
       
   165     // Layout the reticule.
       
   166     if ( iController.UiConfigManagerPtr() &&
       
   167          iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   168         {
       
   169         SizeChanged(); // Init layout
       
   170         }
       
   171     }
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CCamStillPreCaptureContainer::CCamStillPreCaptureContainer
       
   175 // C++ constructor
       
   176 // ---------------------------------------------------------------------------
       
   177 //
       
   178 
       
   179 CCamStillPreCaptureContainer::CCamStillPreCaptureContainer(
       
   180         CCamAppController& aController,
       
   181         CAknView& aView )
       
   182 : CCamPreCaptureContainerBase( aController, aView )
       
   183     {
       
   184     }
       
   185 
       
   186 
       
   187 // ---------------------------------------------------------
       
   188 // CCamStillPreCaptureContainer::HandleControllerEventL
       
   189 // Receives notifications about changes in recording state from the controller
       
   190 // ---------------------------------------------------------
       
   191 //
       
   192 void CCamStillPreCaptureContainer::HandleControllerEventL( TCamControllerEvent aEvent, TInt aError )
       
   193   {
       
   194   PRINT1( _L("Camera => CCamStillPreCaptureContainer::HandleControllerEventL aEvent:%d" ), aEvent )
       
   195   CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi());
       
   196 
       
   197   switch( aEvent )
       
   198     {
       
   199     // ---------------------------------------------------
       
   200   	case ECamEventImageQualityChanged:
       
   201       {
       
   202       PRINT( _L("Camera <> CCamStillPreCaptureContainer - ECamEventImageQualityChanged") );
       
   203       // If our viewfinder area is already set and image quality changes,
       
   204       // do re-layout.
       
   205       if( !iRect.IsEmpty() )
       
   206         {
       
   207         const TRect r( ViewFinderFrameRect() );
       
   208         if( iRect != r )
       
   209           {
       
   210           PRINT( _L("Camera <> CCamStillPreCaptureContainer - doing re-layout..") );
       
   211           iRect = r;
       
   212           SizeChanged();
       
   213           }
       
   214         }
       
   215       SetResolutionIndicator();
       
   216       break;
       
   217       }
       
   218     // ---------------------------------------------------
       
   219   	case ECamEventLocationSettingChanged:
       
   220       {
       
   221       // If the location setting was changed on, then the indicator should be visible
       
   222       SetLocationIndicatorVisibility();
       
   223       break;
       
   224       }
       
   225     // ---------------------------------------------------
       
   226   	case ECamEventCameraChanged:
       
   227       {
       
   228       break;
       
   229       }
       
   230     // ---------------------------------------------------
       
   231   	case ECamEventOperationStateChanged:
       
   232   	  {
       
   233       if( ECamCapturing == iController.CurrentOperation() )
       
   234         {
       
   235         // If capture has just begun, and it's burst capture,
       
   236         // will need to set the softkeys to Blank/Cancel (via UpdateCbaL call)
       
   237         if ( appUi->IsBurstEnabled() )
       
   238             {
       
   239             // Burst *is* enabled, so force the update of the CBA
       
   240             static_cast<CCamViewBase&>(iView).UpdateCbaL();
       
   241             }
       
   242         else // if burst is not enabled show the saving image wait note
       
   243        	    {
       
   244 			Window().Invalidate();
       
   245        	    }
       
   246         }
       
   247       else
       
   248        	{
       
   249        	}
       
   250       break;
       
   251   	  }
       
   252     // ---------------------------------------------------
       
   253     case ECamEventSetupStateChanged:
       
   254       {
       
   255       appUi->APHandler()->UpdateActivePaletteL();
       
   256       break;
       
   257       }
       
   258     // ---------------------------------------------------
       
   259     case ECamEventEngineStateChanged:
       
   260         {
       
   261         if( iController.CurrentImageModeSetup() == ECamImageCaptureBurst &&
       
   262             !iController.SequenceCaptureInProgress() )
       
   263             {
       
   264             // Burst mode - processing text needed
       
   265             PrepareBurstProcessingTextL();
       
   266             }
       
   267          break;
       
   268          }
       
   269     // ---------------------------------------------------
       
   270     case ECamEventInitReady:
       
   271         {
       
   272         // event only received if UIOrientationOverride feature is supported
       
   273         if( iAPCreateAO->IsActive() )
       
   274             {
       
   275             iAPCreateAO->Cancel();
       
   276             }
       
   277 		iAPCreateAO->Start( TCallBack( BackgroundAPL,this ) );
       
   278         break;
       
   279         }
       
   280     // ---------------------------------------------------
       
   281     default:
       
   282       {
       
   283       // otherwise, do nothing
       
   284       break;
       
   285       }
       
   286     // ---------------------------------------------------
       
   287     }
       
   288     CCamPreCaptureContainerBase::HandleControllerEventL( aEvent, aError );
       
   289     PRINT( _L("Camera <= CCamStillPreCaptureContainer::HandleControllerEventL" ) )
       
   290     }
       
   291 
       
   292 
       
   293 //----------------------------------------------
       
   294 // BackgroundAPL
       
   295 // Create AP ItemActive object Callback
       
   296 //----------------------------------------------
       
   297 TInt CCamStillPreCaptureContainer::BackgroundAPL( TAny *aparam )
       
   298     {
       
   299     CCamStillPreCaptureContainer* camStillCaptureContainer = reinterpret_cast<CCamStillPreCaptureContainer*> (aparam);
       
   300     return camStillCaptureContainer->SetupActivePaletteCallbackL();
       
   301     }
       
   302 
       
   303 
       
   304 //----------------------------------------------
       
   305 // SetupActivePaletteCallbackL
       
   306 // Initializes ActivePalette
       
   307 //----------------------------------------------
       
   308 TInt CCamStillPreCaptureContainer::SetupActivePaletteCallbackL()
       
   309     {
       
   310     PRINT( _L("Camera => CCamStillPreCaptureContainer::SetupActivePaletteCallbackL" ) )
       
   311     CCamAppUi* appUi = static_cast<CCamAppUi*>(CEikonEnv::Static()->AppUi());
       
   312     if ( !iController.IsTouchScreenSupported() &&
       
   313          iController.CurrentMode()== ECamControllerImage )
       
   314         {
       
   315         if ( appUi )
       
   316             {
       
   317             appUi->SetActivePaletteVisibility( EFalse);
       
   318             if ( !appUi->ActivePalette() )
       
   319                 {
       
   320                 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMSTILLPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 1" );
       
   321                 static_cast<CCamPreCaptureContainerBase*>( this )
       
   322                     ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       
   323                 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMSTILLPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 0" );
       
   324                 }
       
   325             else
       
   326                 {
       
   327                 OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMSTILLPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 1" );
       
   328                 appUi->APHandler()->UpdateActivePaletteL();
       
   329                 OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMSTILLPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 0" );
       
   330                 }
       
   331             appUi->SetActivePaletteVisibility( ETrue );
       
   332             }
       
   333         else
       
   334             {
       
   335             }
       
   336         }
       
   337     PRINT( _L("Camera <= CCamStillPreCaptureContainer::SetupActivePaletteCallbackL" ) )
       
   338     return EFalse;
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------
       
   342 // CCamStillPreCaptureContainer::OfferKeyEventL
       
   343 // Handle key events
       
   344 // ---------------------------------------------------------
       
   345 //
       
   346 TKeyResponse
       
   347 CCamStillPreCaptureContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   348                                                     TEventCode aType )
       
   349     {
       
   350     // if the cancel softkey is pressed
       
   351 
       
   352     // If currently capturing a burst
       
   353     if ( iController.SequenceCaptureInProgress() )
       
   354         {
       
   355         if ( aKeyEvent.iScanCode == EStdKeyDevice1 )
       
   356             {
       
   357             // Just return so the key press does not pass up to the base
       
   358             // class This will now be handled in HandleCommandL()
       
   359             return EKeyWasNotConsumed;
       
   360             }
       
   361         }
       
   362     return CCamPreCaptureContainerBase::OfferKeyEventL( aKeyEvent, aType );
       
   363     }
       
   364 
       
   365 // ---------------------------------------------------------
       
   366 // CCamStillPreCaptureContainer::ViewFinderLayoutResourceIds
       
   367 // Return the layout resource id for the viewfinder
       
   368 // ---------------------------------------------------------
       
   369 //
       
   370 void CCamStillPreCaptureContainer::ViewFinderLayoutResourceIds(
       
   371                                                 TInt& aViewFinderLayoutId,
       
   372                                                 TInt& aReticuleLayoutId ) const
       
   373     {
       
   374         {
       
   375         aViewFinderLayoutId = ROID(R_CAM_VIEWFINDER_RECT_STILL_ID);
       
   376         CCamAppUiBase* appui = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   377         if ( appui->IsSecondCameraEnabled() )
       
   378             {
       
   379             aViewFinderLayoutId = ROID(R_CAM_STILL_DISPLAYED_RECT_SECONDARY_ID);
       
   380             }
       
   381         }
       
   382     if ( iController.UiConfigManagerPtr() &&
       
   383          iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   384         {
       
   385         // set the layouts for the still capture viewfinder and reticule
       
   386         aReticuleLayoutId = R_CAM_IMG_PRECAP_RETICULE;
       
   387         }
       
   388     else
       
   389         {
       
   390         aReticuleLayoutId = 0;
       
   391         }
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------
       
   395 // CCamStillPreCaptureContainer::SetResolutionIndicator
       
   396 // Sets the resolution indicator to the required icon
       
   397 // ---------------------------------------------------------
       
   398 //
       
   399 void CCamStillPreCaptureContainer::SetResolutionIndicator()
       
   400     {
       
   401     // The setting stored is an index into the array of supported qualities,
       
   402     // and since this matches the array of supported quality icons, we do
       
   403     // not need to do any further lookup on this value.
       
   404     iCurrentIndicator = iController.IntegerSettingValue( ECamSettingItemPhotoQuality );
       
   405     }
       
   406 
       
   407 // ---------------------------------------------------------
       
   408 // CCamStillPreCaptureContainer::SetLocationIndicatorVisibility
       
   409 // Sets the resolution indicator visibility, if it is set or not
       
   410 // ---------------------------------------------------------
       
   411 //
       
   412 void CCamStillPreCaptureContainer::SetLocationIndicatorVisibility()
       
   413     {
       
   414     // The setting stored is an index of whether the location setting is on or off
       
   415     iLocationIndicatorVisible = (/*TCamLocationId::ECamLocationOn*/1 == iController.IntegerSettingValue( ECamSettingItemRecLocation ));
       
   416     }
       
   417 
       
   418 // ----------------------------------------------------
       
   419 // CCamStillPreCaptureContainer::IncreaseFlashSettingL
       
   420 // Move up through the flash settings
       
   421 // ----------------------------------------------------
       
   422 //
       
   423 void CCamStillPreCaptureContainer::IncreaseFlashSettingL()
       
   424     {
       
   425     if ( iZoomPane->IsVisible()
       
   426          || static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled()
       
   427         )
       
   428         {
       
   429         return;
       
   430         }
       
   431     // get current setting
       
   432     TInt setting =
       
   433             iController.IntegerSettingValue( ECamSettingItemDynamicPhotoFlash );
       
   434 
       
   435     // Max/Min settings are ECamFlashAuto/ECamFlashOff
       
   436     // and navi-key right moves down the list of settings
       
   437     if ( setting == ECamFlashOff )
       
   438         {
       
   439         setting = ECamFlashAuto;
       
   440         }
       
   441     else if ( setting >= ECamFlashAuto )
       
   442         {
       
   443         setting++;
       
   444         }
       
   445     else
       
   446         {
       
   447         // remove Lint warning
       
   448         }
       
   449 
       
   450     // only update if setting is invalid
       
   451     if ( setting >= ECamFlashAuto && setting <= ECamFlashOff )
       
   452         {
       
   453         iController.SetIntegerSettingValueL(
       
   454                                 ECamSettingItemDynamicPhotoFlash, ( setting ) );
       
   455         }
       
   456     }
       
   457 
       
   458 // ----------------------------------------------------
       
   459 // CCamStillPreCaptureContainer::DecreaseFlashSettingL
       
   460 // Move down through the flash settings
       
   461 // ----------------------------------------------------
       
   462 //
       
   463 void CCamStillPreCaptureContainer::DecreaseFlashSettingL()
       
   464     {
       
   465     if ( iZoomPane->IsVisible()
       
   466          || static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled()
       
   467         )
       
   468         {
       
   469         return;
       
   470         }
       
   471     // get current setting
       
   472     TInt setting =
       
   473             iController.IntegerSettingValue( ECamSettingItemDynamicPhotoFlash );
       
   474 
       
   475     // Max/Min settings are ECamFlashAuto/ECamFlashOff
       
   476     // and navi-key left moves up the list of settings
       
   477     if ( setting == ECamFlashAuto )
       
   478         {
       
   479         setting = ECamFlashOff;
       
   480         }
       
   481     else if ( setting > ECamFlashAuto )
       
   482         {
       
   483         setting--;
       
   484         }
       
   485     else
       
   486         {
       
   487         // remove Lint warning
       
   488         }
       
   489 
       
   490     // only update if setting is invalid
       
   491     if ( setting >= ECamFlashAuto && setting <= ECamFlashOff )
       
   492         {
       
   493         iController.SetIntegerSettingValueL(
       
   494                                 ECamSettingItemDynamicPhotoFlash, ( setting ) );
       
   495         }
       
   496     }
       
   497 
       
   498 // ----------------------------------------------------
       
   499 // CCamStillPreCaptureContainer::HandleCaptureKeyEventL
       
   500 // Change the current capture state
       
   501 // ----------------------------------------------------
       
   502 //
       
   503 TKeyResponse
       
   504 CCamStillPreCaptureContainer::HandleCaptureKeyEventL( const TKeyEvent& aKeyEvent )
       
   505   {
       
   506   PRINT( _L("Camera => CCamStillPreCaptureContainer::HandleCaptureKeyEventL"))
       
   507   TKeyResponse keyResponse = EKeyWasNotConsumed;
       
   508   CCamAppUi* appui = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   509   __ASSERT_DEBUG(appui, CamPanic(ECamPanicNullPointer));
       
   510   TBool MSKCapture(EFalse);
       
   511   // First handle middle softkey and enter key capture event
       
   512   if ( !appui->IsToolBarVisible()
       
   513        && ( aKeyEvent.iScanCode == EStdKeyDevice3
       
   514             || aKeyEvent.iScanCode == EStdKeyEnter
       
   515             || aKeyEvent.iScanCode == EStdKeyNkpEnter ) )
       
   516     {
       
   517     if ( iController.UiConfigManagerPtr() )
       
   518         {
       
   519         if ( iController.UiConfigManagerPtr()->IsOpticalJoyStickSupported() )
       
   520             {
       
   521             MSKCapture = ETrue;
       
   522             }
       
   523         else
       
   524             {
       
   525             if ( iController.UiConfigManagerPtr()->IsXenonFlashSupported() )
       
   526                 {
       
   527                 if ( iController.CheckFlash()
       
   528                        && static_cast<CCamPreCaptureViewBase*>( &iView )
       
   529                            ->StartMskCaptureL() )
       
   530                     {
       
   531                     return EKeyWasConsumed;
       
   532                     }
       
   533                 }
       
   534              else if ( static_cast<CCamPreCaptureViewBase*>( &iView )->StartMskCaptureL() )
       
   535                 {
       
   536                 return EKeyWasConsumed;
       
   537                 }
       
   538             }
       
   539         }
       
   540     }
       
   541 
       
   542   TBool selfTimerEnabled = appui->SelfTimerEnabled();
       
   543   TBool timeLapseEnabled = appui->CurrentBurstMode() == ECamImageCaptureTimeLapse;
       
   544 
       
   545   // if currently capturing a sequence
       
   546   if ( iController.SequenceCaptureInProgress() )
       
   547     {
       
   548     // if capturing an advanced timelapse under the press to start, press to stop rules
       
   549     // (i.e. not selftimer which captures 6 images)
       
   550     if ( timeLapseEnabled && !selfTimerEnabled )
       
   551       {
       
   552       // Stop the capture now
       
   553       iController.StopSequenceCaptureL();
       
   554       // Update CBA for setup pane usage
       
   555       TRAP_IGNORE( static_cast<CCamPreCaptureViewBase*>( &iView )->UpdateCbaL() );
       
   556       PRINT( _L("Camera <= CCamStillPreCaptureContainer: sequence capture stopped"))
       
   557       return EKeyWasConsumed;
       
   558       }
       
   559     else
       
   560       {
       
   561       // For certain products normal sequence capture, if we
       
   562       // are already capturing a burst, just consume but ignore it.
       
   563       PRINT( _L("Camera <= CCamStillPreCaptureContainer: ignored during sequence"))
       
   564       return EKeyWasConsumed;
       
   565       }
       
   566     }
       
   567 
       
   568   if ( iController.UiConfigManagerPtr() &&
       
   569        iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   570       {
       
   571       // If the shutter key has continued to a full press OR
       
   572       // we are already focussed (as scene is a forced focus mode)
       
   573       if ( iKeyShutter
       
   574         || !iPhotoSceneUsesReticule
       
   575          )
       
   576         {
       
   577         iKeyShutter = EFalse;
       
   578 
       
   579         // Check if we are in Burst Mode with the controller not currently focussed.
       
   580         if ( appui->IsBurstEnabled()
       
   581           && iController.CurrentOperation() != ECamFocused &&
       
   582              iController.CurrentOperation() != ECamFocusFailed )
       
   583           {
       
   584           // We want to start focus if in multishot and NOT in self-timer mode
       
   585           // and current scene allows autofocus (ie if it's not forced)
       
   586           if ( !selfTimerEnabled
       
   587             && iPhotoSceneUsesReticule
       
   588              )
       
   589             {
       
   590             if( iXenonFlashSupported && timeLapseEnabled && !iController.CheckFlash() )
       
   591               {
       
   592               // In time lapse mode, do not start focusing with full press if
       
   593               // Xenon flash is not ready. This is not the case for normal
       
   594               // burst mode, because flash is not used there.
       
   595               iKeyShutter = ETrue;
       
   596               PRINT( _L("Camera <= CCamStillPreCaptureContainer: Flash not ready in timelapse mode, ignore key"))
       
   597               return EKeyWasConsumed;
       
   598               }
       
   599             // Below code commented out - fast capture should be supported also
       
   600             // in burst/sequence capture mode. Also, in case focusing is already
       
   601             // in progress, the call won't do anything.
       
   602             // iController.StartAutoFocus();
       
   603             }
       
   604           }
       
   605         }
       
   606 #ifndef __WINS__
       
   607       else
       
   608         {
       
   609         // This means we've received a full press without a half press -
       
   610         // probably because the half press was consumed by the post capture view
       
   611         // and triggered a switch to this view.  In this case, we don't want to
       
   612         // take a picture, therefore ignore the event.
       
   613         if ( !appui->IsSecondCameraEnabled()
       
   614              && !MSKCapture )
       
   615           {
       
   616           PRINT( _L("Camera <= CCamStillPreCaptureContainer: full press without half press ignored"))
       
   617           return EKeyWasConsumed;
       
   618           }
       
   619         }
       
   620 #endif // __WINS__
       
   621       }
       
   622   else
       
   623       {
       
   624       // in case AF is not supported, check memory here before capturing
       
   625       if ( !iController.IsViewFinding() || !appui->CheckMemoryL() )
       
   626           {
       
   627           return EKeyWasConsumed; 
       
   628           }         
       
   629       }
       
   630       
       
   631   if( iXenonFlashSupported
       
   632    && !appui->IsSecondCameraEnabled()
       
   633    && !MSKCapture
       
   634    && !iController.CheckFlash() )
       
   635     {
       
   636     if( !appui->IsBurstEnabled() || (timeLapseEnabled && selfTimerEnabled) )
       
   637       {
       
   638       // For non-burst case, or time lapse captures with self timer,
       
   639       // we do not allow primary camera capture if flash is required,
       
   640       // but not ready.
       
   641       iKeyShutter = ETrue;
       
   642       PRINT( _L("Camera <= CCamStillPreCaptureContainer: Flash not ready, ignore key"))
       
   643       return EKeyWasNotConsumed;
       
   644       }
       
   645     }
       
   646   if ( iController.UiConfigManagerPtr() 
       
   647          && !iController.UiConfigManagerPtr()->IsAutoFocusSupported()
       
   648          && iController.IsTouchScreenSupported() )
       
   649          {
       
   650          CAknToolbar* fixedToolbar = appui->CurrentFixedToolbar();
       
   651          if ( fixedToolbar )
       
   652             {
       
   653              CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension();
       
   654             if ( extension )
       
   655                 {
       
   656                  extension->SetShown( EFalse ); 
       
   657                 }
       
   658              }
       
   659          }
       
   660 
       
   661   // Go straight to capture
       
   662   keyResponse = appui->StartCaptureL( aKeyEvent );
       
   663 
       
   664   // Blank out the softkeys if we are capturing
       
   665   if ( EKeyWasConsumed == keyResponse
       
   666     && !iController.SequenceCaptureInProgress()
       
   667     && !iController.CaptureModeTransitionInProgress()
       
   668      )
       
   669     {
       
   670     // Only blank the cba if self timer is not enabled
       
   671     // or it is enabled but not counting down
       
   672     if ( !selfTimerEnabled
       
   673       || (  selfTimerEnabled && !appui->SelfTimer()->IsActive() )
       
   674        )
       
   675       {
       
   676       static_cast<CCamViewBase*>( &iView )->BlankSoftkeysL();
       
   677       }
       
   678      if ( iController.IsTouchScreenSupported() )
       
   679          {
       
   680          CAknToolbar* fixedToolbar = appui->CurrentFixedToolbar();
       
   681          if ( fixedToolbar )
       
   682              {
       
   683              fixedToolbar->SetToolbarVisibility( EFalse );
       
   684              }
       
   685          }
       
   686     }
       
   687 
       
   688   if ( iController.IsTouchScreenSupported() )
       
   689       {
       
   690       // Hide the toolbar in case full press in burstmode
       
   691       if ( appui->IsBurstEnabled() )
       
   692           {
       
   693           CAknToolbar* fixedToolbar = appui->CurrentFixedToolbar();
       
   694           if ( fixedToolbar )
       
   695               {
       
   696               fixedToolbar->SetToolbarVisibility( EFalse );
       
   697               }
       
   698           }
       
   699       }
       
   700 
       
   701   PRINT( _L("Camera <= CCamStillPreCaptureContainer::HandleCaptureKeyEventL"))
       
   702   return keyResponse;
       
   703   }
       
   704 
       
   705 
       
   706 // ----------------------------------------------------
       
   707 // CCamStillPreCaptureContainer::HandleShutterKeyEventL
       
   708 // Change the current capture state following shutter
       
   709 // key events
       
   710 // ----------------------------------------------------
       
   711 //
       
   712 TKeyResponse
       
   713 CCamStillPreCaptureContainer::HandleShutterKeyEventL( const TKeyEvent& aKeyEvent,
       
   714                                                             TEventCode aType )
       
   715   {
       
   716   CCamAppUi* appui = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   717   __ASSERT_DEBUG(appui, CamPanic(ECamPanicNullPointer));
       
   718   TBool MSKCapture(EFalse);
       
   719   if ( !appui->IsToolBarVisible()
       
   720        && aKeyEvent.iScanCode == EStdKeyDevice3
       
   721        && iController.UiConfigManagerPtr()
       
   722        && iController.UiConfigManagerPtr()->IsOpticalJoyStickSupported() )
       
   723     {
       
   724     MSKCapture = ETrue;
       
   725     }
       
   726 
       
   727   // If the key is a half-press and down
       
   728 #ifndef __WINS__
       
   729     if ( aKeyEvent.iScanCode == iPrimaryCameraAFKeys[0]
       
   730 #else
       
   731     if ( aKeyEvent.iScanCode == EProductKeyCaptureHalf &&
       
   732          !( aKeyEvent.iModifiers & EModifierShift )
       
   733 #endif //__WINS__
       
   734         && iController.UiConfigManagerPtr()
       
   735         && iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   736     {
       
   737     if ( aType == EEventKeyDown )
       
   738       {
       
   739       OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMSTILLPRECAPTURECONTAINER_HANDLESHUTTERKEYEVENTL, "e_CAM_PRI_AF_LOCK 1" );
       
   740       PRINT( _L("Camera => CCamStillPreCaptureContainer::HandleHalfKeyEventL DOWN"))
       
   741       PERF_MESSAGE_L2( EPerfMessageCaptureKeyHalfPressed );
       
   742       // If the shutter key has been half pressed
       
   743       iKeyShutter = ETrue; // Shutter key - first stage press -> start focussing...
       
   744 
       
   745       // check for active viewfinder and available space before proceeding with capture
       
   746       if ( !iController.IsViewFinding() || !appui->CheckMemoryL() )
       
   747         {
       
   748         // no memory available - stop capture
       
   749         return EKeyWasConsumed;
       
   750         }
       
   751 
       
   752       if ( iController.UiConfigManagerPtr()
       
   753            && iController.UiConfigManagerPtr()->IsAutoFocusSupported()
       
   754            && !appui->SelfTimerEnabled()
       
   755            && iPhotoSceneUsesReticule )
       
   756         {
       
   757         OstTrace0( CAMERAAPP_PERFORMANCE, CCAMSTILLPRECAPTURECONTAINER_HANDLESHUTTERKEYEVENTL, "e_CAM_APP_AF 1" );  //CCORAPP_AF_START
       
   758         iController.StartAutoFocus();
       
   759         }
       
   760 
       
   761       CAknToolbar* fixedToolbar = appui->CurrentFixedToolbar();
       
   762 
       
   763       if ( fixedToolbar )
       
   764         {
       
   765         CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension();
       
   766         if ( extension )
       
   767             {
       
   768             extension->SetShown( EFalse );
       
   769             }
       
   770         }
       
   771       iZoomPane->MakeVisible( EFalse, ETrue );
       
   772 
       
   773       return EKeyWasConsumed;
       
   774       }
       
   775     else if ( aType == EEventKeyUp && !MSKCapture )
       
   776       {
       
   777       PRINT( _L("Camera => CCamStillPreCaptureContainer::HandleKeyEventL EProductKeyCaptureHalf up "))
       
   778       // If full shutter press is released
       
   779       // The order of conditions is important here as half shutter only release resets the
       
   780       // value of iKeyShutter
       
   781       if ( !iKeyShutter )
       
   782         {
       
   783         // Cancelling of a press-and-hold burst is handled
       
   784         // when the full-press is released, so nothing to
       
   785         // do when release the half-press apart from consume it
       
   786         PRINT( _L("Camera <= CCamStillPreCaptureContainer::HandleKeyEventL no action, return EKeyWasConsumed"))
       
   787         return EKeyWasConsumed;
       
   788         }
       
   789       else
       
   790         {
       
   791         // if half shutter only is released
       
   792         iKeyShutter = EFalse;
       
   793         TCamCaptureOperation operation = iController.CurrentOperation();
       
   794         // if not in self timer mode or about to start a capture
       
   795         if ( !appui->SelfTimerEnabled()
       
   796           && !iController.CapturePending()
       
   797           || ECamFocusing == operation
       
   798            )
       
   799           {
       
   800           // In timelapse mode, when stopping with capture key,
       
   801           // need this condition to avoid unnecessary entering
       
   802           // to no-operation while already completing.
       
   803           if( ECamCompleting != operation )
       
   804             {
       
   805             iController.CancelFocusAndCapture();
       
   806             }
       
   807 
       
   808           // if not currently capturing
       
   809           if ( ECamCapturing != operation )
       
   810             {
       
   811             appui->UpdateCba();
       
   812             }
       
   813           }
       
   814         return EKeyWasConsumed;
       
   815         }
       
   816       }
       
   817     else
       
   818       {
       
   819       // Removal of warning
       
   820       }
       
   821     }
       
   822   return EKeyWasNotConsumed;
       
   823   }
       
   824 
       
   825 
       
   826 
       
   827 // ---------------------------------------------------------------------------
       
   828 // DrawAdditionalIcons
       
   829 //
       
   830 // ---------------------------------------------------------------------------
       
   831 //
       
   832 void
       
   833 CCamStillPreCaptureContainer::DrawAdditionalIcons( CBitmapContext& aGc ) const
       
   834   {
       
   835   if( iXenonFlashSupported && iFlashIconVisible && ECamActiveCameraSecondary != iController.ActiveCamera() )
       
   836     {
       
   837     DrawFlashIcon( aGc );
       
   838     }
       
   839   }
       
   840 
       
   841 // ----------------------------------------------------
       
   842 // CCamStillPreCaptureContainer::ResolutionIndicatorIconPsiKey
       
   843 // Returns the PSI key relating to the array of resolution
       
   844 // indicator bitmaps.
       
   845 // ----------------------------------------------------
       
   846 //
       
   847 TCamPsiKey CCamStillPreCaptureContainer::ResolutionIndicatorIconPsiKey() const
       
   848     {
       
   849     return ECamPsiPrecapStillQualityIconIds;
       
   850     }
       
   851 
       
   852 // ---------------------------------------------------------------------------
       
   853 // virtual GetAPResourceId
       
   854 // (From CCamPreCaptureContainerBase)
       
   855 //
       
   856 // Helper method to select the AP resource used to set AP items.
       
   857 // ---------------------------------------------------------------------------
       
   858 //
       
   859 TInt CCamStillPreCaptureContainer::GetAPResourceId() const
       
   860     {
       
   861     CCamAppUi* appUi =  static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   862     TBool embedded   = appUi->IsEmbedded();
       
   863     TInt resId = 0;
       
   864     if( embedded )
       
   865         {
       
   866         if ( !appUi->IsSecondCameraEnabled() )
       
   867             {
       
   868             resId = R_CAM_EMB_STILL_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   869             }
       
   870         }
       
   871     else
       
   872         {
       
   873         if ( !appUi->IsSecondCameraEnabled() )
       
   874             {
       
   875             resId = R_CAM_STILL_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   876             }
       
   877         else
       
   878             {
       
   879             resId = R_CAM_STILL_PRE_CAPTURE_AP_ITEMS_SECONDARY;
       
   880             }
       
   881         }
       
   882     return resId;
       
   883     }
       
   884 
       
   885 // ---------------------------------------------------------------------------
       
   886 // CCamStillPreCaptureContainer::SizeChanged
       
   887 // Called by framework when the component size is changed
       
   888 // ---------------------------------------------------------------------------
       
   889 //
       
   890 void CCamStillPreCaptureContainer::SizeChanged()
       
   891   {
       
   892   CCamPreCaptureContainerBase::SizeChanged();
       
   893   if ( iXenonFlashSupported )
       
   894       {
       
   895       LayoutFlashIcon();
       
   896       }
       
   897   }
       
   898 
       
   899 
       
   900 // ---------------------------------------------------------------------------
       
   901 // HandleForegroundEventL
       
   902 // ---------------------------------------------------------------------------
       
   903 //
       
   904 void
       
   905 CCamStillPreCaptureContainer::HandleForegroundEventL( TBool aForeground )
       
   906   {
       
   907   PRINT( _L("Camera => CCamStillPreCaptureContainer::HandleForegroundEventL") )
       
   908 
       
   909   CCamPreCaptureContainerBase::HandleForegroundEventL( aForeground );
       
   910   if ( iXenonFlashSupported )
       
   911       {
       
   912 
       
   913       // Subscribe / unsubscribe from flash related events
       
   914       // When going to background -> unsubscribe
       
   915       // Otherwise -> subscribe
       
   916       SubscribeFlashEvents( aForeground );
       
   917       }
       
   918 
       
   919   PRINT( _L("Camera => CCamStillPreCaptureContainer::HandleForegroundEventL") )
       
   920   }
       
   921 
       
   922 
       
   923 
       
   924 // ---------------------------------------------------------------------------
       
   925 // CCamStillPreCaptureContainer::FlashIconVisible
       
   926 // Called when Xenon flash icon visibility changes
       
   927 // ---------------------------------------------------------------------------
       
   928 //
       
   929 void CCamStillPreCaptureContainer::FlashIconVisible( TBool aVisible )
       
   930   {
       
   931   PRINT( _L("Camera => CCamStillPreCaptureContainer::FlashIconVisible") )
       
   932   if( ECamActiveCameraSecondary == iController.ActiveCamera() )
       
   933     {
       
   934     // Do not draw the flash icon even if visible, if using secondary
       
   935     // camera, as it does not use the flash at all.
       
   936     return;
       
   937     }
       
   938 
       
   939 
       
   940   if( ECamCapturing  == iController.CurrentOperation() ||
       
   941       ECamCompleting == iController.CurrentOperation() )
       
   942     {
       
   943     if ( !iFlashIconVisible && aVisible  )
       
   944       {
       
   945       // During capture, if flash icon is currently invisible,
       
   946       // do not make it visible. Also if the state has not changed,
       
   947       // we don't need to redraw anything
       
   948       return;
       
   949       }
       
   950     }
       
   951 
       
   952   if( iFlashIconVisible != aVisible )
       
   953     {
       
   954     // Icon state has changed. Redraw.
       
   955 
       
   956     iFlashIconVisible = aVisible;
       
   957 
       
   958     // State changed, need to redraw
       
   959     ActivateGc();
       
   960 
       
   961     // Invalidate the flash icon area
       
   962     RWindow window = Window();
       
   963     window.Invalidate( iFlashIconRect );
       
   964     window.BeginRedraw( iFlashIconRect );
       
   965 
       
   966     // Redraw the background in that area
       
   967     Redraw( iFlashIconRect );
       
   968 
       
   969     // Draw the flash icon itself
       
   970     CWindowGc& gc = SystemGc();
       
   971     if( aVisible )
       
   972       {
       
   973       DrawFlashIcon( gc );
       
   974       }
       
   975 
       
   976     // Tell the window redraw is finished and deactivate Gc
       
   977     window.EndRedraw();
       
   978     DeactivateGc();
       
   979     }
       
   980   PRINT( _L("Camera <= CCamStillPreCaptureContainer::FlashIconVisible") )
       
   981   }
       
   982 
       
   983 
       
   984 
       
   985 // ---------------------------------------------------------------------------
       
   986 // CCamStillPreCaptureContainer::FlashError
       
   987 // Called when there was an error while recharging
       
   988 // the Xenon flash.
       
   989 // ---------------------------------------------------------------------------
       
   990 //
       
   991 void CCamStillPreCaptureContainer::FlashError()
       
   992   {
       
   993   }
       
   994 
       
   995 
       
   996 // ---------------------------------------------------------------------------
       
   997 // CCamStillPreCaptureContainer::InitFlashIconL
       
   998 //
       
   999 // ---------------------------------------------------------------------------
       
  1000 //
       
  1001 void CCamStillPreCaptureContainer::InitFlashIconL()
       
  1002   {
       
  1003   iFlashIconVisible = EFalse;
       
  1004 
       
  1005   // Init flash icon bitmap and mask
       
  1006   TFileName resFileName;
       
  1007   CamUtility::ResourceFileName( resFileName );
       
  1008   TPtrC resname = resFileName;
       
  1009 
       
  1010   AknIconUtils::CreateIconL( iFlashBitmap,
       
  1011                            iFlashBitmapMask,
       
  1012                            resname,
       
  1013                            EMbmCameraappQgn_indi_cam4_flash_on,
       
  1014                            EMbmCameraappQgn_indi_cam4_flash_on_mask );
       
  1015 
       
  1016   // Subscribe to blink events
       
  1017   if( CCamFlashStatus* flashStatus = iController.FlashStatus() )
       
  1018     {
       
  1019     flashStatus->Subscribe( this );
       
  1020     iFlashIconVisible = flashStatus->FlashIconVisible();
       
  1021     PRINT( _L("Camera :: CCamStillPreCaptureContainer::InitFlashIconL - Flash events subscribed") )
       
  1022     }
       
  1023   else
       
  1024     {
       
  1025     iFlashIconVisible = EFalse;
       
  1026     }
       
  1027   }
       
  1028 
       
  1029 
       
  1030 // ---------------------------------------------------------------------------
       
  1031 // CCamStillPreCaptureContainer::LayoutFlashIcon
       
  1032 //
       
  1033 // ---------------------------------------------------------------------------
       
  1034 //
       
  1035 void CCamStillPreCaptureContainer::LayoutFlashIcon()
       
  1036   {
       
  1037   // Set rectangle
       
  1038     TRect rect;
       
  1039     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
       
  1040     TInt cba =  AknLayoutUtils::CbaLocation() ==
       
  1041                 AknLayoutUtils::EAknCbaLocationLeft;
       
  1042     TAknLayoutRect parent;
       
  1043     parent.LayoutRect( rect, AknLayoutScalable_Apps::cam6_mode_pane( cba ) );
       
  1044     TAknLayoutRect l;
       
  1045     l.LayoutRect( parent.Rect(),
       
  1046                   AknLayoutScalable_Apps::main_camera4_pane_g3( 1 ) );
       
  1047     iFlashIconRect = l.Rect();
       
  1048     if( iFlashBitmap )
       
  1049       {
       
  1050       AknIconUtils::SetSize( iFlashBitmap, iFlashIconRect.Size() );
       
  1051       }
       
  1052   }
       
  1053 
       
  1054 // ---------------------------------------------------------------------------
       
  1055 // CCamStillPreCaptureContainer::DrawFlashIcon
       
  1056 //
       
  1057 // ---------------------------------------------------------------------------
       
  1058 //
       
  1059 void CCamStillPreCaptureContainer::DrawFlashIcon( CBitmapContext& aGc ) const
       
  1060   {
       
  1061   if( iFlashBitmap )
       
  1062     {
       
  1063     // aGc.DrawBitmap( iFlashIconRect, iFlashBitmap );
       
  1064     aGc.BitBltMasked( iFlashIconRect.iTl, iFlashBitmap, iFlashIconRect.Size(), iFlashBitmapMask, ETrue );
       
  1065     }
       
  1066   }
       
  1067 
       
  1068 // ---------------------------------------------------------------------------
       
  1069 // SubscribeFlashEvents
       
  1070 // ---------------------------------------------------------------------------
       
  1071 //
       
  1072 void CCamStillPreCaptureContainer::SubscribeFlashEvents( TBool aSubscribe )
       
  1073   {
       
  1074   if( CCamFlashStatus* flashStatus = iController.FlashStatus() )
       
  1075     {
       
  1076     if( aSubscribe )
       
  1077       {
       
  1078       // Re-subscribe when going to foreground
       
  1079       // Duplicate subscription is acceptable since only one observer can subscribe to
       
  1080       // flash related events.
       
  1081       flashStatus->Subscribe( this );
       
  1082       iFlashIconVisible = flashStatus->FlashIconVisible();
       
  1083       PRINT( _L("Camera :: CCamStillPreCaptureContainer::SubscribeFlashEvents - Flash events subscribed") )
       
  1084       }
       
  1085     else
       
  1086       {
       
  1087       // Un-subscribe when going to background
       
  1088       flashStatus->Subscribe( NULL );
       
  1089       iFlashIconVisible = EFalse;
       
  1090       PRINT( _L("Camera :: CCamStillPreCaptureContainer::SubscribeFlashEvents - Flash events unsubscribed") )
       
  1091       }
       
  1092     }
       
  1093   }
       
  1094 
       
  1095 // ---------------------------------------------------------------------------
       
  1096 // CCamStillPreCaptureContainer::MakeVisible
       
  1097 //
       
  1098 // Used to subscribe / unsubscribe from flash events when the control is
       
  1099 // activated / deactivated (standby mode is enabled)
       
  1100 // ---------------------------------------------------------------------------
       
  1101 //
       
  1102 void CCamStillPreCaptureContainer::MakeVisible( TBool aVisible )
       
  1103   {
       
  1104   PRINT1( _L("Camera => CCamPreCaptureContainerBase::MakeVisible %d"), aVisible )
       
  1105   if ( iXenonFlashSupported )
       
  1106       {
       
  1107       // Subscribe / unsubscribe from flash related events
       
  1108       // When going to background -> unsubscribe
       
  1109       // Otherwise -> subscribe
       
  1110       SubscribeFlashEvents( aVisible );
       
  1111 
       
  1112       }
       
  1113   CCamPreCaptureContainerBase::MakeVisible( aVisible );
       
  1114   PRINT( _L("Camera <= CCamPreCaptureContainerBase::MakeVisible") )
       
  1115   }
       
  1116 
       
  1117 
       
  1118 // -----------------------------------------------------------------------------
       
  1119 // CCamStillPreCaptureContainer::InitVfGridL
       
  1120 // -----------------------------------------------------------------------------
       
  1121 // 
       
  1122 void 
       
  1123 CCamStillPreCaptureContainer::InitVfGridL( const TRect& /*aRect*/ )
       
  1124   {
       
  1125   PRINT( _L("Camera => CCamStillPreCaptureContainer::InitVfGridL") );  
       
  1126   iVfGridRect = ViewFinderFrameRect(ECamControllerImage);
       
  1127 
       
  1128   // No vf grid in secondary camera.
       
  1129   if( ECamActiveCameraSecondary != iController.ActiveCamera() )
       
  1130     {
       
  1131     // Create grid drawer if not done yet
       
  1132     if( !iVfGridDrawer )
       
  1133       {
       
  1134       iVfGridDrawer = CCamVfGridFactory::CreateVfGridDrawerL( KGridDrawerUid );
       
  1135       }
       
  1136     ResetVFGridVisibility();
       
  1137   
       
  1138     PRINT( _L("Camera <> CCamStillPreCaptureContainer: Setting vf grid lines..") );  
       
  1139     
       
  1140     // Setting the lines for grid is specific operation
       
  1141     // for CCamLineVfGridDrawer class not defined in MCamVfGridDrawer interface.
       
  1142     CCamLineVfGridDrawer* ptr = static_cast<CCamLineVfGridDrawer*>( iVfGridDrawer );
       
  1143     ptr->SetLinesL  ( iVfGridRect, KGridHrzLines, KGridVrtLines, EFalse );
       
  1144     ptr->SetPenStyle( KGridStyle ); 
       
  1145     ptr->SetPenSize ( TSize( KGridThickness, KGridThickness ) );
       
  1146     ptr->SetPenColor( KGridColor );
       
  1147     }
       
  1148   else
       
  1149     {
       
  1150     PRINT( _L("Camera <> CCamStillPreCaptureContainer: Secondary cam active, no vf grid") );  
       
  1151     }
       
  1152   PRINT( _L("Camera <= CCamStillPreCaptureContainer::InitVfGridL") );  
       
  1153   }
       
  1154 // End of File