camerauis/cameraapp/generic/src/CamPreCaptureContainerBase.cpp
branchRCL_3
changeset 27 53c8aa5d97a3
parent 20 38fb6f7eacd5
child 31 8f559c47d7fd
equal deleted inserted replaced
25:bf64cebf4673 27:53c8aa5d97a3
    32 #include <aknlayoutscalable_apps.cdl.h>    
    32 #include <aknlayoutscalable_apps.cdl.h>    
    33 
    33 
    34 #include <cameraapp.mbg>
    34 #include <cameraapp.mbg>
    35 #include <cameraapp.rsg>
    35 #include <cameraapp.rsg>
    36 #include <vgacamsettings.rsg>
    36 #include <vgacamsettings.rsg>
    37 
    37 #include <touchfeedback.h>
       
    38 #include <akntoolbar.h>
       
    39 #include <akntoolbarextension.h>
    38 
    40 
    39 #include "CamAppUiBase.h"
    41 #include "CamAppUiBase.h"
    40 #include "CamPreCaptureContainerBase.h"
    42 #include "CamPreCaptureContainerBase.h"
    41 #include "CamLogger.h"
    43 #include "CamLogger.h"
    42 #include "CamSidePane.h"
    44 #include "CamSidePane.h"
    60 #include "CamPreCaptureContainerBaseTraces.h"
    62 #include "CamPreCaptureContainerBaseTraces.h"
    61 #endif
    63 #endif
    62 #include "camconfiguration.h"
    64 #include "camconfiguration.h"
    63 #include "CameraUiConfigManager.h"
    65 #include "CameraUiConfigManager.h"
    64 #include "camstartuplogo.h"
    66 #include "camstartuplogo.h"
    65 
    67 #include "camvfgridinterface.h"
       
    68 #include "camlinevfgriddrawer.h"
    66 
    69 
    67 // CONSTANTS
    70 // CONSTANTS
    68 const TInt KZoomPanelTimeout = 4000000;     // 4s 
    71 const TInt KZoomPanelTimeout = 4000000;     // 4s 
    69 const TInt KReticuleFlashTimeout = 250000;  // Quarter of a second (in microseconds).
    72 const TInt KReticuleFlashTimeout = 250000;  // Quarter of a second (in microseconds).
    70 const TInt KAFIconCorners = 4; // Hip to be square 
    73 const TInt KAFIconCorners = 4; // Hip to be square 
    71 
    74 
    72 const TInt KIndicatorBlinkDelay = 250 * 1000;
    75 const TInt KIndicatorBlinkDelay = 250 * 1000;
    73 const TInt KNumberOfBlinks = 3;
    76 const TInt KNumberOfBlinks = 3;
    74 const TInt KNumberOfBlinksVideo = 8;
    77 const TInt KNumberOfBlinksVideo = 8;
    75 
    78 
    76 #include "camvfgridinterface.h"
    79 const TRect KIconRect(0, 0, 40, 40);
    77 #include "camlinevfgriddrawer.h"
    80 const TInt32 KCaptureButtonWidth( 50 );
       
    81 const TInt32 KCaptureButtonYDelta( 35 );
       
    82 const TInt32 KCaptureIconDelta( 7 );
       
    83 const TUint32 KToolbarExtensionBgColor = 0x00000000;
       
    84 const TInt KToolBarExtensionBgAlpha = 0x7F;
       
    85 
    78 
    86 
    79 // Snapshot data is needed in timelapse mode
    87 // Snapshot data is needed in timelapse mode
    80 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl      
    88 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl      
    81                                    | ECamCameraEventClassVfData 
    89                                    | ECamCameraEventClassVfData 
    82                                    | ECamCameraEventClassSsData 
    90                                    | ECamCameraEventClassSsData 
   301   if (appUi->StartupLogoController())
   309   if (appUi->StartupLogoController())
   302     {
   310     {
   303     TRAP_IGNORE(iStartupLogo = CCamStartupLogo::NewL(*appUi->StartupLogoController(), aRect));
   311     TRAP_IGNORE(iStartupLogo = CCamStartupLogo::NewL(*appUi->StartupLogoController(), aRect));
   304     }
   312     }
   305 
   313 
       
   314   // Capture icon rectangle
       
   315   TRect containerRect = Rect();
       
   316   TPoint center( containerRect.Center() );
       
   317 
       
   318   iCaptureRect.SetRect( center.iX - KCaptureButtonWidth/2, 
       
   319                         containerRect.iBr.iY - KCaptureButtonWidth - KCaptureButtonYDelta, 
       
   320                         center.iX + KCaptureButtonWidth/2, 
       
   321                         containerRect.iBr.iY - KCaptureButtonYDelta  );
       
   322 
   306   PRINT( _L("Camera <= CCamPreCaptureContainerBase::BaseConstructL ") );
   323   PRINT( _L("Camera <= CCamPreCaptureContainerBase::BaseConstructL ") );
   307   }
   324   }
   308 
   325 
   309 // ---------------------------------------------------------------------------
   326 // ---------------------------------------------------------------------------
   310 // CCamPreCaptureContainerBase::CCamPreCaptureContainerBase
   327 // CCamPreCaptureContainerBase::CCamPreCaptureContainerBase
   482 
   499 
   483     // The key press has not been handled by a visible control
   500     // The key press has not been handled by a visible control
   484     // so will be processed by the container.
   501     // so will be processed by the container.
   485 
   502 
   486     // Handle Zoom in key if we are not saving video
   503     // Handle Zoom in key if we are not saving video
       
   504     // and if toolbar extension is not visible
   487     PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL B") )
   505     PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL B") )
   488     if ( IsZoomKeyL( aKeyEvent, aType ) 
   506     if ( IsZoomKeyL( aKeyEvent, aType ) 
   489             && ECamCompleting != iController.CurrentOperation() 
   507             && ECamCompleting != iController.CurrentOperation() 
   490             && !iController.CurrentlySavingVideo()
   508             && !iController.CurrentlySavingVideo()
   491             && !appUi->IsSecondCameraEnabled() )
   509             && !appUi->IsSecondCameraEnabled()
       
   510             && !appUi->IsToolBarExtensionVisible() )
   492         {       
   511         {       
   493         // Offer the key event to the zoom pane/model
   512         // Offer the key event to the zoom pane/model
   494         TKeyResponse resp = iZoomPane->OfferKeyEventL( aKeyEvent, aType );
   513         TKeyResponse resp = iZoomPane->OfferKeyEventL( aKeyEvent, aType );
   495 
   514 
   496         // If it was consumed, we need to keep the zoom pane visible
   515         // If it was consumed, we need to keep the zoom pane visible
   547 
   566 
   548         if ( zoom_pane )
   567         if ( zoom_pane )
   549             {
   568             {
   550             PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL calling StopZoom()") );
   569             PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL calling StopZoom()") );
   551             zoom_pane->StopZoom();
   570             zoom_pane->StopZoom();
       
   571             }
       
   572         
       
   573         // Stop blinking icon when capture is initiated
       
   574         if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() )
       
   575             {
       
   576             iIndBlinkTimer->Cancel();
       
   577             iDrawIndicator = ETrue;
   552             }
   578             }
   553         }
   579         }
   554     TBool viewFinderRunning = iReceivedVfFrame;
   580     TBool viewFinderRunning = iReceivedVfFrame;
   555     if ( iController.UiConfigManagerPtr() &&
   581     if ( iController.UiConfigManagerPtr() &&
   556            ( iController.UiConfigManagerPtr()->
   582            ( iController.UiConfigManagerPtr()->
   723         if ( ECamControllerImage == iController.CurrentMode() )
   749         if ( ECamControllerImage == iController.CurrentMode() )
   724             {
   750             {
   725             iPhotoSceneUsesReticule = !iController.CurrentSceneHasForcedFocus();
   751             iPhotoSceneUsesReticule = !iController.CurrentSceneHasForcedFocus();
   726             HandleOperationStateChangeEventL();
   752             HandleOperationStateChangeEventL();
   727             }
   753             }
   728        
   754         }
   729         }
   755       iCaptureButtonShown = CaptureButtonActive();
   730       break;
   756       break;
   731       }
   757       }
       
   758     // ---------------------------------------------------
       
   759     case ECamEventEngineStateChanged:
       
   760         {
       
   761         PRINT1( _L("Camera <> Start mode indi blinking, op:%d"), iController.CurrentOperation() );
       
   762 
       
   763         if ( !iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() 
       
   764                 && !iController.EngineRequestsPending()
       
   765                 && iController.TargetMode() == iController.CurrentMode()
       
   766                 && iController.CurrentOperation() == ECamNoOperation 
       
   767                 && !iBlinkResolutionIndicator )
       
   768             {
       
   769             PRINT( _L("Camera <> mode indi blinking - starting timers") );
       
   770             if ( !iIndBlinkTimer )
       
   771                 {
       
   772                 iIndBlinkTimer = CPeriodic::NewL( EPriorityLess );
       
   773                 }
       
   774             else 
       
   775                 {
       
   776                 iIndBlinkTimer->Cancel();            
       
   777                 }
       
   778             
       
   779             iToggleCountdown = 2 * KNumberOfBlinks;
       
   780             iBlinkModeIndicator = ETrue;          
       
   781             iIndBlinkTimer->Start( KIndicatorBlinkDelay,
       
   782                                    KIndicatorBlinkDelay,
       
   783                                    TCallBack( IndicatorVisible, this) );
       
   784             
       
   785             iDrawIndicator = ETrue;
       
   786             }
       
   787         break;
       
   788         }
   732     // ---------------------------------------------------
   789     // ---------------------------------------------------
   733     case ECamEventExitRequested:
   790     case ECamEventExitRequested:
   734       {
   791       {
   735       iShuttingDown = ETrue;                        
   792       iShuttingDown = ETrue;                        
   736       break;
   793       break;
   796     // ---------------------------------------------------        
   853     // ---------------------------------------------------        
   797     case ECamEventImageQualityChanged:
   854     case ECamEventImageQualityChanged:
   798     case ECamEventVideoQualityChanged:
   855     case ECamEventVideoQualityChanged:
   799         if ( iBlinkResolutionIndicator ) 
   856         if ( iBlinkResolutionIndicator ) 
   800             {
   857             {
       
   858             iBlinkModeIndicator = EFalse;
       
   859         
   801             // Force the first blink to occur right away 
   860             // Force the first blink to occur right away 
   802             iDrawIndicator = EFalse;
   861             iDrawIndicator = EFalse;
   803             DrawResolutionIndicator();
   862             DrawResolutionIndicator();
   804 
   863 
   805             // Update the resolution indicator icon to be used.
   864             // Update the resolution indicator icon to be used.
   890             }            
   949             }            
   891 
   950 
   892         ResetVFGridVisibility();
   951         ResetVFGridVisibility();
   893         }
   952         }
   894     else    
   953     else    
   895         {
   954         { // Background
   896         if ( iIndBlinkTimer )
   955         if ( iIndBlinkTimer )
   897             {
   956             {
   898             iIndBlinkTimer->Cancel();
   957             iIndBlinkTimer->Cancel();
   899             iDrawIndicator = ETrue;
   958             iDrawIndicator = ETrue;
   900             }
   959             }
   912             iZoomPane->HandleForegroundEvent( aForeground );
   971             iZoomPane->HandleForegroundEvent( aForeground );
   913             }
   972             }
   914         
   973         
   915         // Update the view ID for when we come back.
   974         // Update the view ID for when we come back.
   916         TCamAppViewIds viewId = static_cast<TCamAppViewIds>( iView.Id().iUid );
   975         TCamAppViewIds viewId = static_cast<TCamAppViewIds>( iView.Id().iUid );
   917         SetPreviousViewId( viewId );      
   976         SetPreviousViewId( viewId );
   918         }
   977         }
   919     PRINT( _L( "Camera <= CCamPreCaptureContainerBase::HandleForegroundEventL" ) );        
   978     PRINT( _L( "Camera <= CCamPreCaptureContainerBase::HandleForegroundEventL" ) );        
   920     }
   979     }
   921 
   980 
   922 
   981 
  1059        {
  1118        {
  1060        //Do nothing
  1119        //Do nothing
  1061        }
  1120        }
  1062    DrawScreenFurniture( gc );
  1121    DrawScreenFurniture( gc );
  1063    DrawNaviControls( gc );
  1122    DrawNaviControls( gc );
       
  1123    
       
  1124    // Draw capture button
       
  1125    if( iCaptureButtonShown )
       
  1126        {
       
  1127        DrawCaptureButton( gc );   
       
  1128        }
       
  1129 
  1064    PRINT( _L( "Camera <= CCamPreCaptureContainerBase::Draw" ) );        
  1130    PRINT( _L( "Camera <= CCamPreCaptureContainerBase::Draw" ) );        
  1065    }
  1131    }
  1066 
  1132 
  1067 
  1133 
  1068 
  1134 
  2381 //
  2447 //
  2382 // CCamPreCaptureContainerBase::HandlePointerEventL
  2448 // CCamPreCaptureContainerBase::HandlePointerEventL
  2383 //
  2449 //
  2384 void CCamPreCaptureContainerBase::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  2450 void CCamPreCaptureContainerBase::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  2385     {
  2451     {
  2386     PRINT3( _L("CCamPreCaptureContainerBase::HandlePointerEventL iType=%d iPosition=(%d, %d)"),
  2452     PRINT3( _L("Camera => CCamPreCaptureContainerBase::HandlePointerEventL iType=%d iPosition=(%d, %d)"),
  2387         aPointerEvent.iType,
  2453         aPointerEvent.iType,
  2388         aPointerEvent.iPosition.iX,
  2454         aPointerEvent.iPosition.iX,
  2389         aPointerEvent.iPosition.iY );
  2455         aPointerEvent.iPosition.iY );
  2390    CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
  2456    CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
  2391    
  2457    
  2392    if ( !appUi->IsSecondCameraEnabled() )
  2458    // Capture button
       
  2459    TRect captureRect( iCaptureRect );
       
  2460    captureRect.Grow( 30, 30 );
       
  2461    
       
  2462    if ( iCaptureButtonShown && captureRect.Contains( aPointerEvent.iPosition ) )
  2393        {
  2463        {
  2394        // don't let zoom pane be used when capturing image
  2464        if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  2395        if ( iController.CurrentMode() != ECamControllerImage ||
       
  2396             (iController.CurrentOperation() != ECamCapturing &&
       
  2397             iController.CurrentOperation() != ECamCompleting) )
       
  2398            {
  2465            {
  2399            if ( iZoomPane )  
  2466            MTouchFeedback* feedback = MTouchFeedback::Instance(); 
       
  2467            if ( !iCaptureIconPressed && feedback )
       
  2468                {
       
  2469                feedback->InstantFeedback( ETouchFeedbackBasicButton );        
       
  2470                }
       
  2471            iCaptureIconPressed = ETrue;           
       
  2472            DrawNow( captureRect );
       
  2473            }
       
  2474        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up
       
  2475                  && iCaptureIconPressed )
       
  2476            {
       
  2477            iCaptureIconPressed = EFalse;
       
  2478 
       
  2479            // Give feedback on button release
       
  2480            MTouchFeedback* feedback = MTouchFeedback::Instance(); 
       
  2481            if ( feedback )
       
  2482                {
       
  2483                feedback->InstantFeedback( ETouchFeedbackBasicButton );        
       
  2484                }
       
  2485 
       
  2486            // About to start capture ... hide stop zoom etc.
       
  2487            if ( iZoomPane )
       
  2488                {
       
  2489                PRINT( _L("Camera <> CCamPreCaptureContainerBase::HandlePointerEventL - StopZoom()") );
       
  2490                iZoomPane->StopZoom();
       
  2491                iZoomPane->MakeVisible( EFalse, ETrue );
       
  2492                }
       
  2493            // Stop blinking icon when capture is initiated
       
  2494            if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() )
       
  2495                {
       
  2496                iIndBlinkTimer->Cancel();
       
  2497                iDrawIndicator = ETrue;
       
  2498                }
       
  2499 
       
  2500            if ( iController.CurrentMode() == ECamControllerVideo ) 
       
  2501                {
       
  2502                iView.HandleCommandL( ECamCmdRecord );
       
  2503                }
       
  2504            else
       
  2505                {
       
  2506                iView.HandleCommandL( ECamCmdCaptureImage );
       
  2507                }
       
  2508            }
       
  2509        else
       
  2510            {
       
  2511 		   // Avoid compiler warning
       
  2512            }
       
  2513        }
       
  2514    else 
       
  2515        {
       
  2516        PRINT( _L("Camera <> CCamPreCaptureContainerBase::HandlePointerEventL - outside button region") );
       
  2517        // Drags can potentially start from inside button area
       
  2518        if ( iCaptureIconPressed && aPointerEvent.iType != TPointerEvent::EDrag )
       
  2519            {
       
  2520            iCaptureIconPressed = EFalse;
       
  2521            DrawNow( captureRect );
       
  2522            }
       
  2523           
       
  2524        if ( !appUi->IsSecondCameraEnabled() )
       
  2525            {
       
  2526            // don't let zoom pane be used when capturing image
       
  2527            if ( iController.CurrentMode() != ECamControllerImage ||
       
  2528                 ( iController.CurrentOperation() != ECamCapturing &&
       
  2529                   iController.CurrentOperation() != ECamCompleting &&
       
  2530                   iController.CurrentOperation() != ECamFocusing ) )
       
  2531                {
       
  2532                if ( iZoomPane )  
       
  2533                     {
       
  2534                     if ( iZoomPane->HandlePointerEventL( aPointerEvent ) )
       
  2535                         {
       
  2536                         ShowZoomPaneWithTimer(); 
       
  2537                         return;
       
  2538                         }
       
  2539                     }
       
  2540                }
       
  2541     
       
  2542             if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
       
  2543                   !appUi->DrawPreCaptureCourtesyUI() )
  2400                 {
  2544                 {
  2401                 if ( iZoomPane->HandlePointerEventL( aPointerEvent ) )
  2545                 appUi->HandleCommandL( ECamCmdRaiseCourtesyUI );
  2402                     {
       
  2403                     ShowZoomPaneWithTimer(); 
       
  2404                     return;
       
  2405                     }
       
  2406                 }
  2546                 }
       
  2547            CCamContainerBase::HandlePointerEventL( aPointerEvent );
  2407            }
  2548            }
  2408 
  2549        }
  2409         if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
  2550 
  2410               !appUi->DrawPreCaptureCourtesyUI() )
       
  2411             {
       
  2412             appUi->HandleCommandL( ECamCmdRaiseCourtesyUI );
       
  2413             }
       
  2414 
       
  2415         CCamContainerBase::HandlePointerEventL( aPointerEvent );
       
  2416     }    
       
  2417     PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandlePointerEventL") );
  2551     PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandlePointerEventL") );
  2418     }
  2552     }
  2419 
  2553 
  2420 // ---------------------------------------------------------------------------
  2554 // ---------------------------------------------------------------------------
  2421 //  returns a count, not an error
  2555 //  returns a count, not an error
  2673             }
  2807             }
  2674         }
  2808         }
  2675     return resolutionIconLayout.Rect();
  2809     return resolutionIconLayout.Rect();
  2676     }
  2810     }
  2677 
  2811 
       
  2812 // -------------------------------------------------------------
       
  2813 // CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange
       
  2814 // -------------------------------------------------------------
       
  2815 //
  2678 void CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange( TBool aBlink )
  2816 void CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange( TBool aBlink )
  2679     {
  2817     {
  2680     iBlinkResolutionIndicator = aBlink;
  2818     iBlinkResolutionIndicator = aBlink;
  2681     }
  2819     }
  2682 
  2820 
       
  2821 // -------------------------------------------------------------
       
  2822 // CCamPreCaptureContainerBase::DrawResolutionIndicator
       
  2823 // -------------------------------------------------------------
       
  2824 //
  2683 void CCamPreCaptureContainerBase::DrawResolutionIndicator()
  2825 void CCamPreCaptureContainerBase::DrawResolutionIndicator()
  2684     {
  2826     {
  2685     PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawResolutionIndicator") );
  2827     PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawResolutionIndicator") );
  2686     iToggleCountdown--;
  2828     iToggleCountdown--;
  2687 
  2829 
  2688     // Stop immediately the periodic timer for showing correctly 
       
  2689     // the text "Processing image" when capturing a still image. 
       
  2690     TBool stillCapturing = ECamControllerImage == iController.CurrentMode() && 
       
  2691                            ECamImageCaptureSingle == iController.CurrentImageMode() &&
       
  2692                            iController.IsProcessingCapture();
       
  2693     if ( stillCapturing )
       
  2694       {        
       
  2695       iBlinkResolutionIndicator = EFalse;
       
  2696       iIndBlinkTimer->Cancel();
       
  2697       return;
       
  2698       }  
       
  2699       
       
  2700     // State changed, need to redraw
  2830     // State changed, need to redraw
  2701     ActivateGc();
  2831     ActivateGc();
  2702 
  2832 
  2703     // Invalidate the flash icon area
  2833     // Invalidate the flash icon area
  2704     TRect rect( iResolutionIndicators[iCurrentIndicator]->LayoutRect() );
  2834     TRect rect( (iBlinkModeIndicator) ? iSidePane->ModeIndicatorLayoutRect()
       
  2835                                       : iResolutionIndicators[iCurrentIndicator]->LayoutRect() );
  2705     RWindow window = Window();
  2836     RWindow window = Window();
  2706     window.Invalidate( rect  );
  2837     window.Invalidate( rect  );
  2707     window.BeginRedraw( rect );
  2838     window.BeginRedraw( rect );
  2708 
  2839 
  2709     // Redraw the background in that area
  2840     // Redraw the background in that area
  2710     Redraw( rect );
  2841     Redraw( rect );
  2711 
  2842 
  2712     // Draw the flash icon itself
  2843     // Draw the icon 
  2713     CWindowGc& gc = SystemGc();
  2844     CWindowGc& gc = SystemGc();
  2714     if( iDrawIndicator )
  2845     if ( iBlinkModeIndicator )
  2715         {
  2846         {
       
  2847         iSidePane->DrawModeIndicator( gc, iDrawIndicator );
       
  2848         }
       
  2849     else
       
  2850         {
       
  2851         // Mode indicator should be visible, while the resolution indicator blinks
       
  2852         if ( !iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() )
       
  2853             {
       
  2854             iSidePane->DrawModeIndicator( gc, ETrue );
       
  2855             }
       
  2856 
       
  2857         if( iDrawIndicator )
       
  2858             {
       
  2859             iResolutionIndicators[iCurrentIndicator]->DisplayIcon();
       
  2860             }
       
  2861         else
       
  2862             {
       
  2863             iResolutionIndicators[iCurrentIndicator]->ClearIcon();
       
  2864             }
       
  2865         iResolutionIndicators[iCurrentIndicator]->Draw( gc );
       
  2866         
       
  2867         // If blink timer is canceled abruptly(like capture image) at some places, resolution indicator may go missing in pre-capture mode.
       
  2868         // So alway set resolution clear flag to EFlase after drawing resolution indicator to avoiding missing indicator.
       
  2869         // This do not affect indicator blink function because this just set the flag, do not draw the indicator.        
  2716         iResolutionIndicators[iCurrentIndicator]->DisplayIcon();
  2870         iResolutionIndicators[iCurrentIndicator]->DisplayIcon();
  2717         }
  2871         }
  2718     else
       
  2719         {
       
  2720         iResolutionIndicators[iCurrentIndicator]->ClearIcon();
       
  2721         }
       
  2722     iResolutionIndicators[iCurrentIndicator]->Draw( gc );
       
  2723 
  2872 
  2724     // Tell the window redraw is finished and deactivate Gc
  2873     // Tell the window redraw is finished and deactivate Gc
  2725     window.EndRedraw();
  2874     window.EndRedraw();
  2726     DeactivateGc();
  2875     DeactivateGc();
  2727 
  2876 
  2728     // Stop the periodic timer when enough blinking has been done
  2877     // Stop the periodic timer when enough blinking has been done
  2729     if ( iDrawIndicator && iToggleCountdown <= 0 )
  2878     if ( iDrawIndicator && iToggleCountdown <= 0 )
  2730         {
  2879         {
  2731         iBlinkResolutionIndicator = EFalse;
  2880         iBlinkResolutionIndicator = EFalse;
       
  2881         iBlinkModeIndicator = EFalse;        
  2732         iIndBlinkTimer->Cancel();
  2882         iIndBlinkTimer->Cancel();
  2733         }
  2883         }
  2734 
  2884 
  2735     PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawResolutionIndicator") );
  2885     PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawResolutionIndicator") );
  2736     }
  2886     }
  2737 
  2887 
       
  2888 // -------------------------------------------------------------
       
  2889 // CCamPreCaptureContainerBase::IndicatorVisible
       
  2890 // -------------------------------------------------------------
       
  2891 //
  2738 TInt CCamPreCaptureContainerBase::IndicatorVisible( TAny *aSelf )
  2892 TInt CCamPreCaptureContainerBase::IndicatorVisible( TAny *aSelf )
  2739     {
  2893     {
  2740     PRINT( _L("Camera => CCamPreCaptureContainerBase::IndicatorVisible") );
  2894     PRINT( _L("Camera => CCamPreCaptureContainerBase::IndicatorVisible") );
  2741     CCamPreCaptureContainerBase* self = static_cast<CCamPreCaptureContainerBase*> (aSelf);
  2895     CCamPreCaptureContainerBase* self = static_cast<CCamPreCaptureContainerBase*> (aSelf);
  2742 
  2896 
  2747         }
  2901         }
  2748     PRINT( _L("Camera <= CCamPreCaptureContainerBase::IndicatorVisible") );
  2902     PRINT( _L("Camera <= CCamPreCaptureContainerBase::IndicatorVisible") );
  2749     return KErrNone;
  2903     return KErrNone;
  2750     }
  2904     }
  2751 
  2905 
       
  2906 // -------------------------------------------------------------
       
  2907 // CCamPreCaptureContainerBase::DrawCaptureButton
       
  2908 // -------------------------------------------------------------
       
  2909 //
       
  2910 void CCamPreCaptureContainerBase::DrawCaptureButton( CBitmapContext& aGc ) const
       
  2911     {
       
  2912     TRect containerRect = Rect();
       
  2913     TPoint iconTl( containerRect.Center().iX - KCaptureButtonWidth/2 + KCaptureIconDelta, 
       
  2914                    containerRect.iBr.iY - KCaptureButtonYDelta - KCaptureButtonWidth + KCaptureIconDelta );
       
  2915 
       
  2916     aGc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
       
  2917     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2918     aGc.SetPenStyle( CGraphicsContext::ENullPen );
       
  2919    
       
  2920     if ( iCaptureIconPressed )
       
  2921         {
       
  2922         aGc.SetBrushColor( KRgbBlack );
       
  2923         }
       
  2924     else
       
  2925         {
       
  2926         aGc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) );
       
  2927         }
       
  2928     aGc.DrawEllipse( iCaptureRect );    
       
  2929 
       
  2930     aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
  2931     aGc.SetPenStyle( CGraphicsContext::ESolidPen );
       
  2932     aGc.BitBltMasked( iconTl, iCaptureIcon, KIconRect, iCaptureMask, EFalse );
       
  2933     }
       
  2934 
       
  2935 // -------------------------------------------------------------
       
  2936 // CCamPreCaptureContainerBase::FocusChanged
       
  2937 // -------------------------------------------------------------
       
  2938 //
       
  2939 void CCamPreCaptureContainerBase::FocusChanged( TDrawNow aDrawNow )
       
  2940     {
       
  2941     PRINT2( _L("Camera <> CCamPreCaptureContainerBase::FocusChanged, draw:%d, focused:%d"), aDrawNow, 
       
  2942                 IsFocused() );
       
  2943     iCaptureButtonShown = CaptureButtonActive();
       
  2944     if ( aDrawNow )
       
  2945         {
       
  2946         DrawNow();
       
  2947         }
       
  2948     }
       
  2949 
       
  2950 // -------------------------------------------------------------
       
  2951 // CCamPreCaptureContainerBase::CaptureButtonActive
       
  2952 // -------------------------------------------------------------
       
  2953 //
       
  2954 TBool CCamPreCaptureContainerBase::CaptureButtonActive() const
       
  2955     {
       
  2956     TBool buttonActive = EFalse;
       
  2957     if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() 
       
  2958             && iController.IsTouchScreenSupported() )
       
  2959         {
       
  2960         buttonActive = IsFocused() && iController.CurrentOperation() == ECamNoOperation;
       
  2961         PRINT1( _L("Camera <> capture button active:%d"), buttonActive );
       
  2962         }
       
  2963     return buttonActive;
       
  2964     }
       
  2965 
  2752 // End of File  
  2966 // End of File  
  2753 
  2967