camerauis/cameraapp/generic/src/CamSceneSettingContainer.cpp
changeset 0 1ddebce53859
child 17 8f559c47d7fd
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007 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 scene settings view*
       
    15 */
       
    16 
       
    17 // INCLUDE FILES
       
    18 #include "CamSceneSettingContainer.h"
       
    19 #include "CamUtility.h"
       
    20 #include "CamPanic.h"
       
    21 
       
    22 #include <eikenv.h>
       
    23 #include <eikappui.h> // For CCoeAppUiBase
       
    24 #include <eikapp.h>   // For CEikApplication
       
    25 #include <stringloader.h>
       
    26 #include <AknBidiTextUtils.h>
       
    27 #include <AknsUtils.h>
       
    28 #include <AknsDrawUtils.h>
       
    29 #include <cameraapp.mbg>
       
    30 #include <BitmapTransforms.h>
       
    31 #include <AknUtils.h>
       
    32 #include <AknLayoutFont.h>
       
    33 #include <barsRead.h>    // resource reader
       
    34 
       
    35 #include <cameraapp.rsg>
       
    36 #include <vgacamsettings.rsg>
       
    37 
       
    38 
       
    39 // CONSTANTS
       
    40 
       
    41 const TInt KStepSize = 4;  // Pixels the animation moves each timer event 
       
    42 
       
    43 const TInt KCornerSize = 3;
       
    44 const TInt KBorderSize = 1;
       
    45 
       
    46 const TReal KNumIconStages = 7;
       
    47 
       
    48 #define KRgbGray4 TRgb(0xEEEEEE)
       
    49 #define KRgbGray3 TRgb(0xDDDDDD)
       
    50 #define KRgbGray2 TRgb(0xCCCCCC)
       
    51 #define KRgbGray1 TRgb(0xBBBBBB)
       
    52 
       
    53 
       
    54 #ifdef __WINS__
       
    55 static const TInt KTimerPeriod = 10000;
       
    56 #else
       
    57 static const TInt KTimerPeriod = 150000;
       
    58 #endif
       
    59 
       
    60 // ================= MEMBER FUNCTIONS =======================
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // TCamAnimationData::Initialise
       
    64 // Sets up the animation data
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void TCamAnimationData::Initialise( const TRect& aRect )
       
    68     {
       
    69     iDeltaY = KStepSize;
       
    70     // scrolling needs to be faster (2 times?) than the fade in/out
       
    71     iScrollingY = iDeltaY * 2;
       
    72 
       
    73     iCurrentRect = aRect;
       
    74     iPreviousRect = iCurrentRect;
       
    75     iCurrentRectOld = iCurrentRect;
       
    76     iPreviousRectOld = iCurrentRect;
       
    77 
       
    78     iStep = 0;
       
    79     iPenFadeOut = KRgbBlack;
       
    80     iPenFadeIn = KRgbWhite;
       
    81     iScrolling = EFalse;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // CCamSceneSettingItem::NewL
       
    86 // Symbian OS two-phased constructor
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 CCamSceneSettingItem* CCamSceneSettingItem::NewL( TCamSceneId aSceneId,
       
    90                                                   const TSize& aLargeBmpSize,
       
    91                                                   const TSize& aSmallBmpSize )
       
    92     {
       
    93     CCamSceneSettingItem* self =  new( ELeave ) CCamSceneSettingItem( aSceneId );
       
    94     CleanupStack::PushL( self );
       
    95     self->ConstructL( aLargeBmpSize, aSmallBmpSize );
       
    96     CleanupStack::Pop( self );
       
    97     return self;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CCamSceneSettingItem::~CCamSceneSettingItem
       
   102 // Destructor
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 CCamSceneSettingItem::~CCamSceneSettingItem()
       
   106   {
       
   107   PRINT( _L("Camera => ~CCamSceneSettingItem") );
       
   108   delete iBitmapSmall;
       
   109   delete iBitmap1;
       
   110   delete iBitmap2;
       
   111   delete iBitmap3;
       
   112   delete iBitmap4;
       
   113   delete iBitmap5;
       
   114   delete iBitmap6;
       
   115   delete iBitmapLarge;
       
   116   delete iTitle;
       
   117   delete iDescription;
       
   118   PRINT( _L("Camera <= ~CCamSceneSettingItem") );
       
   119   }
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CCamSceneSettingItem::SceneId
       
   123 // Returns the sceneId
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 TCamSceneId CCamSceneSettingItem::SceneId() const
       
   127     {
       
   128     return iSceneId;
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CCamSceneSettingItem::Icon
       
   133 // Returns the bitmap specified by aSize
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 const CFbsBitmap* CCamSceneSettingItem::Icon( TCamIconSize aSize ) const
       
   137     {
       
   138     if ( aSize == ECamIconSizeLarge )
       
   139         {
       
   140         return iBitmapLarge;
       
   141         }
       
   142     else if ( aSize == ECamIconSizeSmall )
       
   143         {
       
   144         return iBitmapSmall;
       
   145         }
       
   146     else if ( aSize == ECamIconSizeOne )
       
   147         {
       
   148         return iBitmap1;
       
   149         }
       
   150     else if ( aSize == ECamIconSizeTwo )
       
   151         {
       
   152         return iBitmap2;
       
   153         }
       
   154     else if ( aSize == ECamIconSizeThree )
       
   155         {
       
   156         return iBitmap3;
       
   157         }
       
   158     else if ( aSize == ECamIconSizeFour )
       
   159         {
       
   160         return iBitmap4;
       
   161         }
       
   162     else if ( aSize == ECamIconSizeFive )
       
   163         {
       
   164         return iBitmap5;
       
   165         }
       
   166     else if ( aSize == ECamIconSizeSix )
       
   167         {
       
   168         return iBitmap6;
       
   169         }
       
   170     else
       
   171         {
       
   172         return iBitmapLarge;
       
   173         }
       
   174     }
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // CCamSceneSettingItem::Title
       
   178 // returns the title text
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 const HBufC* CCamSceneSettingItem::Title() const
       
   182     {
       
   183     return iTitle;
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // CCamSceneSettingItem::Description
       
   188 // returns the title text
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 const HBufC* CCamSceneSettingItem::Description() const
       
   192     {
       
   193     return iDescription;
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CCamSceneSettingItem::ConstructL
       
   198 // Symbian OS second phase constructor
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 void CCamSceneSettingItem::ConstructL( const TSize& aLargeBmpSize, 
       
   202                                        const TSize& aSmallBmpSize )
       
   203     {
       
   204     TInt bmpLarge = 0;
       
   205     TInt bmpSmall = 0;
       
   206     TInt title = 0;
       
   207     TInt description = 0;
       
   208     switch ( iSceneId )
       
   209         {
       
   210         case ECamSceneNight:
       
   211             {
       
   212             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_night_s;
       
   213             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_night_l;
       
   214             title = R_CAM_SCENE_TITLE_NIGHT;
       
   215             description = R_CAM_SCENE_DESCRIPTION_NIGHT;
       
   216             }
       
   217             break;
       
   218         case ECamSceneMacro:
       
   219             {
       
   220             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_macro_s;
       
   221             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_macro_l;    
       
   222             title = R_CAM_SCENE_TITLE_MACRO;
       
   223             description = R_CAM_SCENE_DESCRIPTION_MACRO;
       
   224             }
       
   225             break;
       
   226         case ECamScenePortrait:
       
   227             {
       
   228             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_port_s;
       
   229             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_port_l;          
       
   230             title = R_CAM_SCENE_TITLE_PORTRAIT;
       
   231             description = R_CAM_SCENE_DESCRIPTION_PORTRAIT;
       
   232             }
       
   233             break;
       
   234         case ECamSceneAuto:
       
   235             {
       
   236             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_auto_s;
       
   237             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_auto_l;
       
   238             title = R_CAM_SCENE_TITLE_AUTO;
       
   239             description = R_CAM_SCENE_DESCRIPTION_AUTO;
       
   240             }
       
   241             break;
       
   242         case ECamSceneScenery:
       
   243             {
       
   244             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_land_s;
       
   245             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_land_l;           
       
   246             title = R_CAM_SCENE_TITLE_LANDSCAPE;
       
   247             description = R_CAM_SCENE_DESCRIPTION_LANDSCAPE;
       
   248             }
       
   249             break;
       
   250         case ECamSceneSports:
       
   251             {
       
   252             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_sport_s;
       
   253             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_sport_l;           
       
   254             title = R_CAM_SCENE_TITLE_SPORTS;
       
   255             description = R_CAM_SCENE_DESCRIPTION_SPORTS;
       
   256             }
       
   257             break;
       
   258         case ECamSceneUser:
       
   259             {
       
   260             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_user_s;
       
   261             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_user_l;           
       
   262             title = R_CAM_SCENE_TITLE_USER;
       
   263             description = R_CAM_SCENE_DESCRIPTION_USER;
       
   264             }
       
   265             break;
       
   266         case ECamSceneNormal:
       
   267             {
       
   268             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_auto_s;
       
   269             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_auto_l;           
       
   270             title = R_CAM_SCENE_TITLE_NORMAL;
       
   271             description = R_CAM_SCENE_DESCRIPTION_NORMAL;
       
   272             }
       
   273             break;
       
   274         case ECamSceneNightScenery:
       
   275             {
       
   276             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_nightland_s;
       
   277             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_nightland_l;
       
   278             title = R_CAM_SCENE_TITLE_NIGHT_LANDSCAPE;
       
   279             description = R_CAM_SCENE_DESCRIPTION_NIGHT_LANDSCAPE;
       
   280             }
       
   281             break;
       
   282         case ECamSceneNightPortrait:
       
   283             {
       
   284             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_nightport_s;
       
   285             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_nightport_l;
       
   286             title = R_CAM_SCENE_TITLE_NIGHT_PORTRAIT;
       
   287             description = R_CAM_SCENE_DESCRIPTION_NIGHT_PORTRAIT;
       
   288             }
       
   289             break;
       
   290         case ECamSceneCandlelight:
       
   291             {
       
   292             bmpSmall = EMbmCameraappQgn_ico_lcam_sce_candle_s;
       
   293             bmpLarge = EMbmCameraappQgn_ico_lcam_sce_candle_l;           
       
   294             title = R_CAM_SCENE_TITLE_CANDLELIGHT;
       
   295             description = R_CAM_SCENE_DESCRIPTION_CANDLELIGHT;
       
   296             }
       
   297             break;
       
   298         default:
       
   299             User::Leave( KErrGeneral );
       
   300             break;
       
   301         }
       
   302 
       
   303     // Find the name and path of the MBM file for bitmaps
       
   304     TFileName mbmFileName;
       
   305     CamUtility::ResourceFileName( mbmFileName );
       
   306 
       
   307     iBitmapSmall = AknIconUtils::CreateIconL( mbmFileName, bmpSmall );
       
   308     AknIconUtils::SetSize( iBitmapSmall, aSmallBmpSize, EAspectRatioNotPreserved );
       
   309 
       
   310     TReal xInc = TReal( aLargeBmpSize.iWidth - aSmallBmpSize.iWidth ) / KNumIconStages;
       
   311     TReal yInc = TReal( aLargeBmpSize.iHeight - aSmallBmpSize.iHeight ) / KNumIconStages;
       
   312 
       
   313     TSize size;
       
   314     TReal width = aSmallBmpSize.iWidth;
       
   315     TReal height = aSmallBmpSize.iHeight;
       
   316     
       
   317     width += xInc;
       
   318     height += yInc;
       
   319     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   320 
       
   321     iBitmap1 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   322     AknIconUtils::SetSize( iBitmap1, size, EAspectRatioNotPreserved);
       
   323 
       
   324     width += xInc;
       
   325     height += yInc;
       
   326     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   327 
       
   328     iBitmap2 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   329     AknIconUtils::SetSize( iBitmap2, size, EAspectRatioNotPreserved );
       
   330 
       
   331     width += xInc;
       
   332     height += yInc;
       
   333     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   334 
       
   335     iBitmap3 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   336     AknIconUtils::SetSize( iBitmap3, size, EAspectRatioNotPreserved );
       
   337 
       
   338     width += xInc;
       
   339     height += yInc;
       
   340     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   341 
       
   342     iBitmap4 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   343     AknIconUtils::SetSize( iBitmap4, size, EAspectRatioNotPreserved );
       
   344 
       
   345     width += xInc;
       
   346     height += yInc;
       
   347     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   348 
       
   349     iBitmap5 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   350     AknIconUtils::SetSize( iBitmap5, size, EAspectRatioNotPreserved );
       
   351 
       
   352     width += xInc;
       
   353     height += yInc;
       
   354     size.SetSize( ( TInt ) width, ( TInt ) height );
       
   355 
       
   356     iBitmap6 = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   357     AknIconUtils::SetSize( iBitmap6, size, EAspectRatioNotPreserved );
       
   358 
       
   359     iBitmapLarge = AknIconUtils::CreateIconL( mbmFileName, bmpLarge );
       
   360     AknIconUtils::SetSize( iBitmapLarge, aLargeBmpSize, EAspectRatioNotPreserved );
       
   361     
       
   362     iTitle = StringLoader::LoadL( title );
       
   363     iDescription = StringLoader::LoadL( description );
       
   364     }
       
   365 
       
   366 // ---------------------------------------------------------------------------
       
   367 // CCamSceneSettingItem::CCamSceneSettingContainer
       
   368 // C++ constructor
       
   369 // ---------------------------------------------------------------------------
       
   370 //
       
   371 CCamSceneSettingItem::CCamSceneSettingItem( TCamSceneId aSceneId ) :
       
   372     iSceneId( aSceneId )
       
   373     {
       
   374     }  
       
   375 
       
   376 // ---------------------------------------------------------------------------
       
   377 // CCamSceneSettingContainer::NewL
       
   378 // Symbian OS two-phased constructor
       
   379 // ---------------------------------------------------------------------------
       
   380 //
       
   381 CCamSceneSettingContainer* 
       
   382 CCamSceneSettingContainer::NewL( const TRect& aRect, 
       
   383                                  CAknView& aView,
       
   384                                  TCamCameraMode aMode,
       
   385                                  CCamAppController& aController,
       
   386                                  TBool aUserBaseScenes )
       
   387   {
       
   388   CCamSceneSettingContainer* self = 
       
   389       new( ELeave ) CCamSceneSettingContainer( aMode,
       
   390                                                aController,
       
   391                                                aView, 
       
   392                                                aUserBaseScenes );
       
   393   CleanupStack::PushL( self );
       
   394   self->ConstructL( aRect );
       
   395   CleanupStack::Pop( self );
       
   396   return self;
       
   397   }
       
   398 
       
   399 // ---------------------------------------------------------------------------
       
   400 // CCamSceneSettingContainer::~CCamSceneSettingContainer
       
   401 // Destructor
       
   402 // ---------------------------------------------------------------------------
       
   403 //
       
   404 CCamSceneSettingContainer::~CCamSceneSettingContainer()
       
   405   {
       
   406   PRINT( _L( "Camera => ~CCamSceneSettingContainer" ) );
       
   407   
       
   408   iSettingItemArray.ResetAndDestroy();
       
   409   iSettingItemArray.Close();
       
   410   
       
   411   iHighlightIcons.Close();
       
   412   iNormalIcons.Close();
       
   413   iDisplacedIcons.Close();
       
   414   
       
   415   iHighlightArray.Close();
       
   416   iHighlightTitles.Close();
       
   417   iHighlightDescriptions.Close();
       
   418   
       
   419   iNormalTitles.Close();
       
   420   iDisplacedTitles.Close();
       
   421   
       
   422   if (iAnimTimer)
       
   423     {
       
   424     iAnimTimer->Cancel();
       
   425     }
       
   426   delete iAnimTimer;
       
   427   delete iScrollFrame;
       
   428   delete iAnimData.iOffScreenBitmap;
       
   429   
       
   430   PRINT( _L( "Camera <= ~CCamSceneSettingContainer" ) );    
       
   431   }
       
   432   
       
   433 // ---------------------------------------------------------
       
   434 // CCamSceneSettingContainer::ConstructL
       
   435 // Symbian OS 2nd phase constructor
       
   436 // ---------------------------------------------------------
       
   437 //
       
   438 void CCamSceneSettingContainer::ConstructL( const TRect& aRect )
       
   439   {
       
   440   PRINT(_L("Camera => CCamSceneSettingContainer::ConstructL") )
       
   441   
       
   442   CCamContainerBase::BaseConstructL( aRect );
       
   443 
       
   444   TBool secondCameraOn = 
       
   445       static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled();
       
   446 
       
   447   if( !AknLayoutUtils::LayoutMirrored() )
       
   448     {
       
   449     // get the icon positions from the resource
       
   450     ReadLayoutL( ROID(R_CAM_SCENE_ICON_HIGHLIGHT_ARRAY_ID), iHighlightIcons );
       
   451     ReadLayoutL( ROID(R_CAM_SCENE_ICON_DISPLACED_ARRAY_ID), iDisplacedIcons );
       
   452     ReadLayoutL( ROID(R_CAM_SCENE_ICON_NORMAL_ARRAY_ID), iNormalIcons );
       
   453 
       
   454     // get the highlight rects
       
   455     ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_LAYOUT_ARRAY_ID), iHighlightArray );
       
   456 
       
   457     // Check if we require APAC layouts
       
   458     if( AknLayoutUtils::Variant() == EApacVariant )
       
   459       {
       
   460       // get the layout texts
       
   461       ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_APAC_ID), iHighlightTitles );
       
   462       ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_APAC_ID), iHighlightDescriptions );
       
   463 
       
   464       ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_APAC_ID), iNormalTitles );
       
   465       ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_APAC_ID), iDisplacedTitles );
       
   466       }
       
   467     else
       
   468       {
       
   469       // get the layout texts
       
   470       ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_ID), iHighlightTitles );
       
   471       ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_ID), iHighlightDescriptions );
       
   472       
       
   473       ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_ID), iNormalTitles );
       
   474       ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_ID), iDisplacedTitles );
       
   475       }
       
   476     }
       
   477   else
       
   478     {
       
   479     // get the icon positions from the resource
       
   480     ReadLayoutL( ROID(R_CAM_SCENE_ICON_HIGHLIGHT_ARRAY_AH_ID), iHighlightIcons );
       
   481     ReadLayoutL( ROID(R_CAM_SCENE_ICON_DISPLACED_ARRAY_AH_ID), iDisplacedIcons );
       
   482     ReadLayoutL( ROID(R_CAM_SCENE_ICON_NORMAL_ARRAY_AH_ID), iNormalIcons );
       
   483 
       
   484     // get the highlight rects
       
   485     ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_LAYOUT_ARRAY_AH_ID), iHighlightArray );
       
   486 
       
   487     // get the layout texts
       
   488     ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_TITLE_ARRAY_AH_ID), iHighlightTitles );
       
   489     ReadLayoutL( ROID(R_CAM_SCENE_HIGHLIGHT_DESCRIPTION_ARRAY_AH_ID), iHighlightDescriptions );
       
   490 
       
   491     ReadLayoutL( ROID(R_CAM_SCENE_TITLE_NORMAL_ARRAY_AH_ID), iNormalTitles );
       
   492     ReadLayoutL( ROID(R_CAM_SCENE_TITLE_DISPLACED_ARRAY_AH_ID), iDisplacedTitles );
       
   493     }
       
   494 
       
   495   TResourceReader reader;                                                                                     
       
   496   iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_SCENE_MAX_ITEMS_TO_DISPLAY_ID));    
       
   497   iNumberOfIconsToDisplay = reader.ReadInt16();
       
   498   CleanupStack::PopAndDestroy(); // reader
       
   499 
       
   500   if ( iUserBaseScenes )
       
   501     {
       
   502     CreateSceneArrayL( R_CAM_SCENE_LIST_USER );
       
   503     TCamSceneId currentScene = static_cast<TCamSceneId>( 
       
   504         iController.IntegerSettingValue( 
       
   505             ECamSettingItemUserSceneBasedOnScene ) );
       
   506     SetCurrentPositionToScene( currentScene );      
       
   507     SetupScrollbarL();
       
   508     }
       
   509   else if ( ECamControllerImage == iMode )
       
   510     {
       
   511     if ( secondCameraOn )
       
   512       {
       
   513       CreateSceneArrayL( R_CAM_SCENE_LIST_PHOTO_CAM2 );
       
   514       }
       
   515     else
       
   516       {
       
   517       CreateSceneArrayL( R_CAM_SCENE_LIST_PHOTO);         
       
   518       SetupScrollbarL();
       
   519       }
       
   520 
       
   521     TCamSceneId currentScene = static_cast<TCamSceneId>( 
       
   522             iController.IntegerSettingValue( 
       
   523                 ECamSettingItemDynamicPhotoScene ) );
       
   524     SetCurrentPositionToScene( currentScene );      
       
   525     }
       
   526   else
       
   527     {
       
   528     if ( secondCameraOn )
       
   529       {
       
   530       CreateSceneArrayL( R_CAM_SCENE_LIST_VIDEO_CAM2);
       
   531       }
       
   532     else
       
   533       {
       
   534       CreateSceneArrayL( R_CAM_SCENE_LIST_VIDEO );
       
   535       }
       
   536     
       
   537     TCamSceneId currentScene = static_cast<TCamSceneId>( 
       
   538             iController.IntegerSettingValue( 
       
   539                 ECamSettingItemDynamicVideoScene ) );
       
   540     SetCurrentPositionToScene( currentScene );      
       
   541     }
       
   542 
       
   543   TInt index = iCurrentArrayPosition - iTopDisplayPosition;
       
   544   iAnimData.Initialise( iHighlightArray[index].Rect() );
       
   545 
       
   546   // create a bitmap to be used off-screen
       
   547   iAnimData.iOffScreenBitmap = new ( ELeave ) CFbsBitmap();
       
   548   User::LeaveIfError( iAnimData.iOffScreenBitmap->Create( aRect.Size(), EColor256 ) );
       
   549 
       
   550   TInt leftMarginDiff = iNormalIcons[0].Rect().iTl.iX - 
       
   551                         iHighlightIcons[0].Rect().iTl.iX;
       
   552   iAnimData.iIconLeftInc = TReal( leftMarginDiff / KNumIconStages );
       
   553 
       
   554 
       
   555   // Create the timeout timer
       
   556   iAnimTimer = CPeriodic::NewL( EPriorityHigh );
       
   557   
       
   558   PRINT(_L("Camera <= CCamSceneSettingContainer::ConstructL") )    
       
   559   }
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // CCamSceneSettingContainer::ReadLayoutL
       
   563 // Read the TAknLayoutRect info from the resource file
       
   564 // ---------------------------------------------------------------------------
       
   565 //
       
   566 void CCamSceneSettingContainer::ReadLayoutL( TInt aResourceId, 
       
   567                                              RArray<TAknLayoutRect>& aArray) const
       
   568   {
       
   569   TResourceReader reader;                                                                                     
       
   570   iEikonEnv->CreateResourceReaderLC( reader, aResourceId );    
       
   571   const TInt count = reader.ReadInt16();
       
   572   
       
   573   TInt i;
       
   574   // Read all of the layout entries from the resource file
       
   575   for ( i = 0; i < count; i++ )
       
   576     {
       
   577     TAknLayoutRect layoutRect;
       
   578     layoutRect.LayoutRect( Rect(), reader );
       
   579     User::LeaveIfError( aArray.Append( layoutRect ) );
       
   580     }
       
   581   CleanupStack::PopAndDestroy(); // reader
       
   582   }
       
   583 
       
   584 // ---------------------------------------------------------------------------
       
   585 // CCamSceneSettingContainer::ReadLayoutL
       
   586 // Read the TAknLayoutText info from the resource file
       
   587 // ---------------------------------------------------------------------------
       
   588 //
       
   589 void CCamSceneSettingContainer::ReadLayoutL( TInt aResourceId, 
       
   590                                              RArray<TAknLayoutText>& aArray) const
       
   591   {
       
   592   TResourceReader reader;                                                                                     
       
   593   iEikonEnv->CreateResourceReaderLC( reader, aResourceId );    
       
   594   const TInt count = reader.ReadInt16();
       
   595   
       
   596   TInt i;
       
   597   // Read all of the layout entries from the resource file
       
   598   for ( i = 0; i < count; i++ )
       
   599     {
       
   600     TAknLayoutText layoutText;
       
   601     layoutText.LayoutText( Rect(), reader );
       
   602     User::LeaveIfError( aArray.Append( layoutText ) );
       
   603     }
       
   604   CleanupStack::PopAndDestroy(); // reader
       
   605   }
       
   606     
       
   607 // ---------------------------------------------------------------------------
       
   608 // CCamSceneSettingContainer::CCamSceneSettingContainer
       
   609 // C++ constructor
       
   610 // ---------------------------------------------------------------------------
       
   611 //
       
   612 CCamSceneSettingContainer::CCamSceneSettingContainer( 
       
   613     TCamCameraMode aMode,
       
   614     CCamAppController& aController,
       
   615     CAknView& aView,
       
   616     TBool aUserBaseScenes )
       
   617   : CCamContainerBase( aController, aView ), 
       
   618     iMode( aMode ), 
       
   619     iUserBaseScenes( aUserBaseScenes )
       
   620   {
       
   621   }
       
   622 
       
   623 // ----------------------------------------------------------------
       
   624 // CCamSceneSettingContainer::UserSceneHighlighted
       
   625 // Returns ETrue if the current selected scene is User
       
   626 // ----------------------------------------------------------------
       
   627 //
       
   628 TBool CCamSceneSettingContainer::UserSceneHighlighted()
       
   629   {
       
   630   return ( iSettingItemArray[iCurrentArrayPosition]->SceneId() == 
       
   631            ECamSceneUser );
       
   632   }
       
   633 
       
   634 // ----------------------------------------------------------------
       
   635 // CCamSceneSettingContainer::SaveSceneSetting
       
   636 // Stores the currently selected scene in the dynamic settings model
       
   637 // ----------------------------------------------------------------
       
   638 //
       
   639 TBool CCamSceneSettingContainer::SaveSceneSettingL()
       
   640   {
       
   641   TInt scene = 0;
       
   642   if ( iUserBaseScenes )
       
   643     {
       
   644     scene = ECamSettingItemUserSceneBasedOnScene;
       
   645     }
       
   646   else if ( ECamControllerImage == iMode )
       
   647     {
       
   648     scene = ECamSettingItemDynamicPhotoScene;
       
   649     }
       
   650   else
       
   651     {
       
   652     scene = ECamSettingItemDynamicVideoScene;
       
   653     }
       
   654 
       
   655   iController.SetIntegerSettingValueL( scene,
       
   656               iSettingItemArray[iCurrentArrayPosition]->SceneId() );
       
   657 
       
   658   // If user selected sports scene from list.
       
   659   if ( iSettingItemArray[iCurrentArrayPosition]->SceneId() == ECamSceneSports )
       
   660     {
       
   661     // if the selection was for user scene base scene, and user 
       
   662     // scene is active, but request was cancelled, return false.
       
   663     if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
       
   664              == ECamSceneUser ) &&
       
   665          ( iController.IntegerSettingValue( ECamSettingItemUserSceneBasedOnScene )
       
   666              != ECamSceneSports ) )
       
   667       {
       
   668       return EFalse;
       
   669       }
       
   670     // if the selection was for the photo/video scene, but request was 
       
   671     // cancelled, return false.
       
   672     if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
       
   673          != ECamSceneUser )  && 
       
   674          ( iController.IntegerSettingValue( scene ) != ECamSceneSports ) )
       
   675       {
       
   676       return EFalse;
       
   677       }
       
   678     }
       
   679   // Otherwise, if the user selected user scene from the list, but request
       
   680   // was cancelled, return false.
       
   681   else if ( ( iSettingItemArray[iCurrentArrayPosition]->SceneId() 
       
   682             == ECamSceneUser ) &&
       
   683             ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene )
       
   684            != ECamSceneUser ) )
       
   685     {
       
   686     return EFalse;
       
   687     }
       
   688 
       
   689   // Remove lint warning.
       
   690   else
       
   691     {
       
   692     }
       
   693 
       
   694   // In all other cases, return true.
       
   695   return ETrue;
       
   696   }
       
   697 
       
   698 
       
   699 // ---------------------------------------------------------
       
   700 // CCamSceneSettingContainer::CountComponentControls 
       
   701 // Returns the number of controls owned
       
   702 // ---------------------------------------------------------
       
   703 //
       
   704 TInt CCamSceneSettingContainer::CountComponentControls() const
       
   705   {
       
   706   TInt count = 0; // Return the number of controls inside this container    
       
   707   if ( iScrollFrame )
       
   708     {
       
   709     count = iScrollFrame->CountComponentControls();
       
   710     }
       
   711   return count;
       
   712   }
       
   713 
       
   714 // ---------------------------------------------------------
       
   715 // CCamSceneSettingContainer::ComponentControl
       
   716 // Returns the requested component control
       
   717 // ---------------------------------------------------------
       
   718 //
       
   719 CCoeControl* CCamSceneSettingContainer::ComponentControl( TInt aIndex ) const
       
   720   {
       
   721   if ( iScrollFrame )
       
   722     {
       
   723     return iScrollFrame->ComponentControl( aIndex );
       
   724     }
       
   725   else
       
   726     {
       
   727     return NULL;
       
   728     }    
       
   729   }
       
   730 
       
   731 // ---------------------------------------------------------
       
   732 // CCamSceneSettingContainer::Draw
       
   733 // Draw control
       
   734 // ---------------------------------------------------------
       
   735 //
       
   736 void CCamSceneSettingContainer::Draw( const TRect& /*aRect*/ ) const
       
   737   {
       
   738   PRINT(_L("Camera => CCamSceneSettingContainer::Draw") )
       
   739   
       
   740   CWindowGc& gc = SystemGc();
       
   741   // Draw the background
       
   742   gc.SetBrushColor( KRgbWhite );
       
   743   gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   744   gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   745   gc.DrawRect( Rect() );
       
   746   gc.SetPenStyle( CGraphicsContext::ESolidPen );
       
   747   
       
   748   TBool drawnHighlight = EFalse;
       
   749   TInt index = 0;
       
   750   
       
   751   TInt i;
       
   752   for ( i = 0; i < iNumberOfIconsToDisplay; i++ )
       
   753     {
       
   754     TInt position = iTopDisplayPosition + i;
       
   755     CCamSceneSettingItem* item = iSettingItemArray[position];
       
   756     const HBufC* title = item->Title();
       
   757     const HBufC* description = item->Description();
       
   758 
       
   759     // Drawing currently selected icon and text
       
   760     if ( position == iCurrentArrayPosition )
       
   761       {
       
   762       // Draw the highlight
       
   763       gc.DrawRoundRect( iHighlightArray[i].Rect(), 
       
   764                         TSize( KCornerSize, KCornerSize ) );
       
   765       
       
   766       // Draw the enlarged icon
       
   767       iHighlightIcons[i].DrawImage( gc, 
       
   768           const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeLarge ) ), NULL );
       
   769       
       
   770       // Draw the enlarged header text
       
   771       iHighlightTitles[i].DrawText( gc, *title );
       
   772       
       
   773       // Draw the description text
       
   774       iHighlightDescriptions[i].DrawText( gc, *description );
       
   775       
       
   776 #if 0       // debug drawing code
       
   777       gc.SetPenColor(KRgbRed);
       
   778       gc.DrawRect( iHighlightTitles[i].TextRect() );
       
   779       gc.DrawRect( iHighlightDescriptions[i].TextRect() );
       
   780 #endif
       
   781       drawnHighlight = ETrue;
       
   782       }
       
   783     else    // Drawing normal items
       
   784       {
       
   785       // Draw the highlight box
       
   786       TAknLayoutRect layoutRect;
       
   787       TAknLayoutText layoutText;
       
   788       if ( drawnHighlight )
       
   789         {
       
   790         layoutRect = iNormalIcons[index];
       
   791         layoutText = iNormalTitles[index];
       
   792         }
       
   793       else
       
   794         {
       
   795         layoutRect = iDisplacedIcons[index];
       
   796         layoutText = iDisplacedTitles[index];
       
   797         }
       
   798 
       
   799       // Draw the standard icon
       
   800       layoutRect.DrawImage( gc, 
       
   801           const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeSmall ) ), NULL );
       
   802       // Draw the header text
       
   803       layoutText.DrawText( gc, *title );
       
   804             
       
   805 #if 0       // debug drawing code
       
   806       gc.SetPenColor(KRgbRed);
       
   807       gc.DrawRect( layoutText.TextRect() );
       
   808 #endif
       
   809       index++;
       
   810       }
       
   811     }
       
   812   PRINT(_L("Camera <= CCamSceneSettingContainer::Draw") )
       
   813   }
       
   814 
       
   815 // ----------------------------------------------------------------
       
   816 // CCamSceneSettingContainer::OfferKeyEventL
       
   817 // Handles this application view's command keys. Forwards other
       
   818 // keys to child control(s).
       
   819 // ----------------------------------------------------------------
       
   820 //
       
   821 TKeyResponse CCamSceneSettingContainer::OfferKeyEventL( 
       
   822     const TKeyEvent& aKeyEvent,
       
   823     TEventCode aType )
       
   824     {
       
   825     PRINT( _L( "Camera => CCamSceneSettingContainer::OfferKeyEventL" ) );
       
   826 
       
   827     if ( iAnimTimer->IsActive() )
       
   828         {
       
   829         return EKeyWasNotConsumed;
       
   830         }
       
   831 
       
   832     // Moving down the list
       
   833     if ( aKeyEvent.iScanCode == EStdKeyDownArrow && aType == EEventKey )
       
   834         {
       
   835         // at the bottom of the list and pressing down key
       
   836         if ( iCurrentArrayPosition == iSettingItemArray.Count() - 1 )
       
   837             {
       
   838             // wrap to the top of the list and redraw
       
   839             iCurrentArrayPosition = 0;
       
   840             iPreviousArrayPosition = 0;
       
   841             iTopDisplayPosition = 0;
       
   842 
       
   843             iAnimData.iCurrentRect = iHighlightArray[0].Rect();
       
   844             iAnimData.iPreviousRect = iAnimData.iCurrentRect;
       
   845 
       
   846             if ( iScrollFrame )
       
   847                 {
       
   848                 iScrollFrame->MoveVertThumbTo( 0 );
       
   849                 }
       
   850 
       
   851             DrawDeferred();
       
   852             return EKeyWasConsumed;
       
   853             }
       
   854 
       
   855         iAnimData.iMovingDown = ETrue;
       
   856         iPreviousArrayPosition = iCurrentArrayPosition;
       
   857         iCurrentArrayPosition++;
       
   858 
       
   859         // need to scroll the list
       
   860         if( iCurrentArrayPosition > iNumberOfIconsToDisplay - 1 )
       
   861             {
       
   862             iAnimData.iScrolling = ETrue;
       
   863             iScrollFrame->MoveThumbsBy( 0, 1 );
       
   864             iTopDisplayPosition++;
       
   865             DrawListL();
       
   866 
       
   867             // blit the bitmap at above the 2nd displaced icon
       
   868             TInt yPos = iDisplacedIcons[1].Rect().iTl.iY;
       
   869             // less the difference between the top of the first icon on 
       
   870             // the off-screen bitmap and the top of the off-screen bitmap
       
   871             yPos -= iDisplacedIcons[0].Rect().iTl.iY;
       
   872             // less the scrolling value
       
   873             yPos -= iAnimData.iScrollingY;
       
   874             iAnimData.iOffScreenPos.SetXY( 0, yPos );
       
   875 
       
   876             TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
       
   877             TInt defaultIndex = curIndex - 1;
       
   878             iAnimData.iTitleFadeIn = iNormalTitles[defaultIndex].TextRect();
       
   879 
       
   880             iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
       
   881             TRect rect = iNormalIcons[defaultIndex].Rect();
       
   882             iAnimData.iCurrentRect.iTl.iY = rect.iTl.iY;
       
   883             iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + rect.Height();
       
   884 
       
   885             // clear the top item from the list
       
   886             ActivateGc();
       
   887             SystemGc().Clear( iHighlightArray[0].Rect() );
       
   888             DeactivateGc();
       
   889             }
       
   890         else // just move to the next position
       
   891             {
       
   892             MoveHighlight();
       
   893             }
       
   894 
       
   895         StartAnimation();
       
   896         return EKeyWasConsumed;
       
   897         }
       
   898     else if ( aKeyEvent.iScanCode == EStdKeyUpArrow && aType == EEventKey )
       
   899         {
       
   900         // At the top of list and pressing the up key
       
   901         if ( iCurrentArrayPosition == 0 )
       
   902             {
       
   903             // wrap to the bottom of the list and redraw
       
   904             TInt lastItem = iSettingItemArray.Count() - 1;
       
   905             iCurrentArrayPosition = lastItem;
       
   906             iPreviousArrayPosition = lastItem;
       
   907             iTopDisplayPosition = iSettingItemArray.Count() - iNumberOfIconsToDisplay;
       
   908             
       
   909             TInt pos = iCurrentArrayPosition - iTopDisplayPosition;
       
   910             iAnimData.iCurrentRect = iHighlightArray[pos].Rect();
       
   911             iAnimData.iPreviousRect = iAnimData.iCurrentRect;
       
   912 
       
   913             if ( iScrollFrame )
       
   914                 {
       
   915                 iScrollFrame->MoveThumbsBy( 0, iTopDisplayPosition );
       
   916                 }
       
   917 
       
   918             DrawDeferred();
       
   919             iController.StartIdleTimer();
       
   920             return EKeyWasConsumed;
       
   921             }
       
   922 
       
   923         iAnimData.iMovingDown = EFalse;
       
   924         iPreviousArrayPosition = iCurrentArrayPosition;
       
   925         iCurrentArrayPosition--;
       
   926 
       
   927         // need to scroll the list
       
   928         if ( iPreviousArrayPosition > iNumberOfIconsToDisplay - 1 )
       
   929             {
       
   930             iAnimData.iScrolling = ETrue;
       
   931             iScrollFrame->MoveThumbsBy( 0, -1 );
       
   932             // draw the list before decrementing top display pos
       
   933             DrawListL();
       
   934             iTopDisplayPosition--;
       
   935 
       
   936             iAnimData.iOffScreenPos.SetXY( 0, iAnimData.iScrollingY );
       
   937 
       
   938             TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
       
   939             TInt defaultIndex = curIndex - 1;
       
   940             iAnimData.iTitleFadeIn = iNormalTitles[defaultIndex].TextRect();
       
   941 
       
   942             iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
       
   943             TRect rect = iNormalIcons[defaultIndex].Rect();
       
   944             iAnimData.iCurrentRect.iTl.iY = rect.iTl.iY;
       
   945             iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + rect.Height();
       
   946             }
       
   947         else // just move to the next position
       
   948             {
       
   949             MoveHighlight();
       
   950             }
       
   951 
       
   952         StartAnimation();
       
   953         iController.StartIdleTimer();
       
   954         return EKeyWasConsumed;
       
   955         }
       
   956     else
       
   957         {
       
   958         return CCamContainerBase::OfferKeyEventL( aKeyEvent, aType );
       
   959         }
       
   960     }
       
   961 
       
   962 // ---------------------------------------------------------------------------
       
   963 // CCamSceneSettingContainer::HandleScrollEventL
       
   964 // Called when a scroll event is detected
       
   965 // ---------------------------------------------------------------------------
       
   966 //
       
   967 void CCamSceneSettingContainer::HandleScrollEventL( CEikScrollBar* /*aScrollBar*/, 
       
   968                                                     TEikScrollEvent /*aEventType*/ )
       
   969     {
       
   970     }
       
   971 
       
   972 // ----------------------------------------------------------------
       
   973 // CCamBurstThumbnailGrid::SetupScrollbarL
       
   974 // Sets up the scrollbar for the list
       
   975 // ----------------------------------------------------------------
       
   976 //
       
   977 void CCamSceneSettingContainer::SetupScrollbarL()
       
   978     {
       
   979     if ( !AknLayoutUtils::LayoutMirrored() )
       
   980         {
       
   981         iScrollLayout.LayoutRect( Rect(), ROID(R_CAM_SCENE_SCROLLBAR_POSITION_ID));
       
   982         }
       
   983     else
       
   984         {
       
   985         iScrollLayout.LayoutRect( Rect(), ROID(R_CAM_SCENE_SCROLLBAR_POSITION_AH_ID));
       
   986         }
       
   987 
       
   988     // Create scrollbar frame
       
   989     iScrollFrame = new (ELeave) CEikScrollBarFrame( this, this, ETrue );
       
   990 
       
   991     // Set up the model accordingly
       
   992     ivModel.SetScrollSpan( iSettingItemArray.Count() );
       
   993     ivModel.SetFocusPosition( 0 );
       
   994     ivModel.SetWindowSize( iNumberOfIconsToDisplay );
       
   995             
       
   996     iScrollFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 
       
   997                                            CEikScrollBarFrame::EOn );
       
   998     iScrollFrame->CreateDoubleSpanScrollBarsL( ETrue, EFalse );
       
   999     
       
  1000     TRect rect = iScrollLayout.Rect();
       
  1001     iScrollFrame->Tile( &ivModel, rect );
       
  1002     iScrollFrame->MoveVertThumbTo( iTopDisplayPosition );
       
  1003     }
       
  1004 
       
  1005 // ----------------------------------------------------------------
       
  1006 // CCamSceneSettingContainer::CreateSceneArrayL
       
  1007 // Populates the scene array with scenes using a resource
       
  1008 // ----------------------------------------------------------------
       
  1009 //
       
  1010 void CCamSceneSettingContainer::CreateSceneArrayL( TInt aResourceId )
       
  1011     {
       
  1012     // Create a resource reader for the scene array resource id.
       
  1013     TResourceReader reader;                                                                                     
       
  1014     iEikonEnv->CreateResourceReaderLC( reader, aResourceId );    
       
  1015 
       
  1016     // Create all scene list items from the resource reader.
       
  1017     TInt sceneCount = reader.ReadInt16();
       
  1018 
       
  1019     TInt i;
       
  1020     for ( i = 0; i < sceneCount; ++i )
       
  1021         {
       
  1022         TCamSceneId sceneId = static_cast<TCamSceneId> ( reader.ReadInt16() );
       
  1023         if ( iController.IsSceneSupported( sceneId ) )
       
  1024             {
       
  1025             TSize large = iHighlightIcons[0].Rect().Size();
       
  1026             TSize small = iNormalIcons[0].Rect().Size();
       
  1027             CCamSceneSettingItem* settingItem = CCamSceneSettingItem::NewL( 
       
  1028                                                 sceneId, large, small );
       
  1029             CleanupStack::PushL( settingItem );
       
  1030             iSettingItemArray.AppendL( settingItem );
       
  1031             CleanupStack::Pop( settingItem );            
       
  1032             }
       
  1033 
       
  1034         }
       
  1035 
       
  1036     CleanupStack::PopAndDestroy(); // reader
       
  1037 
       
  1038     // If total number of scenes is less than the current number 
       
  1039     // of icons to display on screen then reset the current number of
       
  1040     // icons to display on screen.
       
  1041     if ( sceneCount < iNumberOfIconsToDisplay )
       
  1042         {
       
  1043         iNumberOfIconsToDisplay = sceneCount;
       
  1044         }    
       
  1045     }
       
  1046 
       
  1047 // ----------------------------------------------------------------
       
  1048 // CCamSceneSettingContainer::SetCurrentPositionToScene
       
  1049 // Sets the current position of the scene array to the element
       
  1050 // associated with a particular scene id.
       
  1051 // ----------------------------------------------------------------
       
  1052 //
       
  1053 void CCamSceneSettingContainer::SetCurrentPositionToScene
       
  1054 ( TCamSceneId aSceneId )
       
  1055     {
       
  1056     // Find scene in scene array.
       
  1057     TInt count = iSettingItemArray.Count();
       
  1058     TInt j;
       
  1059     for ( j = 0; j < count; j++ )
       
  1060         {
       
  1061         if ( aSceneId == iSettingItemArray[j]->SceneId() )
       
  1062             {  
       
  1063             iCurrentArrayPosition = j;
       
  1064             j = count; // stop loop
       
  1065             }
       
  1066         }
       
  1067 
       
  1068     // If scene array position is offscreen, move top display position.
       
  1069     if ( iCurrentArrayPosition >= iNumberOfIconsToDisplay )
       
  1070         {
       
  1071         iTopDisplayPosition = ( iCurrentArrayPosition - 
       
  1072                                 iNumberOfIconsToDisplay ) + 1;
       
  1073         }
       
  1074     }
       
  1075 
       
  1076 // ---------------------------------------------------------------------------
       
  1077 // CCamSceneSettingContainer::StartAnimation
       
  1078 // Called to start the animation
       
  1079 // ---------------------------------------------------------------------------
       
  1080 //
       
  1081 void CCamSceneSettingContainer::StartAnimation()
       
  1082     {
       
  1083 #ifndef _ANIMATION_OFF
       
  1084     iAnimTimer->Start( KTimerPeriod, KTimerPeriod, TCallBack( TimerExpired, this ) );
       
  1085 #else
       
  1086     DrawDeferred();
       
  1087 #endif
       
  1088     }
       
  1089 
       
  1090 // ---------------------------------------------------------------------------
       
  1091 // CCamSceneSettingContainer::TimerExpired
       
  1092 // Called when the timer expires
       
  1093 // ---------------------------------------------------------------------------
       
  1094 //
       
  1095 TInt CCamSceneSettingContainer::TimerExpired( TAny* aAny )
       
  1096     {
       
  1097     CCamSceneSettingContainer* container = 
       
  1098                     static_cast<CCamSceneSettingContainer*>( aAny );
       
  1099     __ASSERT_DEBUG( container != NULL, CamPanic( ECamPanicNullPointer ) );
       
  1100     container->Animate();
       
  1101     return KErrNone;
       
  1102     }
       
  1103 
       
  1104 // ---------------------------------------------------------------------------
       
  1105 // CCamSceneSettingContainer::Animate
       
  1106 // Called every time the timer expires to update the animation
       
  1107 // The animation works by changing a single line non-highlighted item
       
  1108 // into a double line highlighted item.
       
  1109 // When a highlighted item comes into focus, the title text remains the same
       
  1110 // size, but its position is moved up to indicate moving from a single to
       
  1111 // double line.
       
  1112 // The description text fades in underneath the title text - the title text
       
  1113 // moves up to make way for the description text.
       
  1114 // When a highlighted item looses the focus, the title text remains the same
       
  1115 // size, but its position moves down to indicate moving from a double line
       
  1116 // to a single line.
       
  1117 // The description text fades out and the title text moves down into the 
       
  1118 // position occupied by the description text.
       
  1119 // ---------------------------------------------------------------------------
       
  1120 //
       
  1121 void CCamSceneSettingContainer::Animate()
       
  1122     {
       
  1123     iAnimData.iStep++;
       
  1124 
       
  1125     // update the pen/bitmaps
       
  1126     UpdateAnimationData();
       
  1127 
       
  1128     // font is the same for all titles
       
  1129     const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( 
       
  1130                                        iHighlightTitles[0].Font() );
       
  1131     __ASSERT_DEBUG( layoutFont != NULL, CamPanic( ECamPanicNullPointer ) );
       
  1132     TInt baseline = layoutFont->TextPaneTopToBaseline();
       
  1133 
       
  1134     const CCamSceneSettingItem* previousItem = iSettingItemArray[iPreviousArrayPosition];
       
  1135     const CCamSceneSettingItem* currentItem = iSettingItemArray[iCurrentArrayPosition];
       
  1136 
       
  1137     TInt currentPosition = iCurrentArrayPosition - iTopDisplayPosition;
       
  1138     TInt previousPosition = iPreviousArrayPosition - iTopDisplayPosition;
       
  1139 
       
  1140     CWindowGc& gc = SystemGc();
       
  1141     ActivateGc();
       
  1142 
       
  1143     TBool animScrolled = ETrue;
       
  1144     TBool animCompleted = ETrue;
       
  1145     if ( iAnimData.iScrolling )
       
  1146         {
       
  1147         animScrolled = ScrollList();
       
  1148 
       
  1149         // update the highlight rects
       
  1150         animCompleted = UpdateHighlight();
       
  1151 
       
  1152         DrawIcon( EFalse );
       
  1153 
       
  1154         if ( iAnimData.iMovingDown )
       
  1155             {
       
  1156             // Save the current position, so we can rub it out later
       
  1157             iAnimData.iTitleFadeInOld = iAnimData.iTitleFadeIn;
       
  1158 
       
  1159             TRect rectLimit = iHighlightTitles[currentPosition].TextRect();
       
  1160             iAnimData.iTitleFadeIn.Move( 0, -iAnimData.iDeltaY );
       
  1161             if ( iAnimData.iTitleFadeIn.iTl.iY <= rectLimit.iTl.iY )
       
  1162                 {
       
  1163                 // finish
       
  1164                 iAnimData.iTitleFadeIn.iTl.iY = rectLimit.iTl.iY;
       
  1165                 iAnimData.iTitleFadeIn.iBr.iY = rectLimit.iBr.iY;
       
  1166                 }
       
  1167             DrawText( *currentItem->Title(), layoutFont, baseline, EFalse );
       
  1168             }
       
  1169 
       
  1170         // draw the description text
       
  1171         iHighlightDescriptions[currentPosition].DrawText( gc, 
       
  1172                 *currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
       
  1173 
       
  1174         // draw the highlighted border
       
  1175         DrawHighlight();
       
  1176         }
       
  1177     else
       
  1178         {
       
  1179         // update the highlight rects
       
  1180         animCompleted = UpdateHighlight();
       
  1181 
       
  1182         // draw the highlighted border
       
  1183         DrawHighlight();
       
  1184 
       
  1185 /**** PREVIOUS ITEM - FADE OUT ****/
       
  1186         DrawIcon( ETrue );
       
  1187 
       
  1188         // fade description text out
       
  1189         iHighlightDescriptions[previousPosition].DrawText( gc, 
       
  1190                *previousItem->Description(), ETrue, iAnimData.iPenFadeOut );
       
  1191 
       
  1192         // Save the current position, so we can rub it out later
       
  1193         iAnimData.iTitleFadeOutOld = iAnimData.iTitleFadeOut;
       
  1194 
       
  1195         // Draw the title text if moving down the list
       
  1196         TRect rectLimit;
       
  1197         if ( iAnimData.iMovingDown )
       
  1198             {
       
  1199             rectLimit = iDisplacedTitles[previousPosition].TextRect();
       
  1200             }
       
  1201         else // Draw the title text if moving up the list
       
  1202             {
       
  1203             rectLimit = iNormalTitles[previousPosition-1].TextRect();
       
  1204             } 
       
  1205 
       
  1206         iAnimData.iTitleFadeOut.Move( 0, iAnimData.iDeltaY );
       
  1207         if ( iAnimData.iTitleFadeOut.iTl.iY >= rectLimit.iTl.iY )
       
  1208             {
       
  1209             // finish
       
  1210             iAnimData.iTitleFadeOut.iTl.iY = rectLimit.iTl.iY;
       
  1211             iAnimData.iTitleFadeOut.iBr.iY = rectLimit.iBr.iY;
       
  1212             }
       
  1213 
       
  1214         DrawText( *previousItem->Title(), layoutFont, baseline, ETrue );
       
  1215 
       
  1216 /**** NEXT ITEM - FADE IN ****/
       
  1217         DrawIcon( EFalse );
       
  1218 
       
  1219         if ( iAnimData.iMovingDown )
       
  1220             {
       
  1221             iHighlightDescriptions[currentPosition].DrawText( gc, 
       
  1222                 *currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
       
  1223             }
       
  1224         else
       
  1225             {
       
  1226             // don't fade in straight away otherwise looks messy
       
  1227             if ( iAnimData.iStep > 3 )
       
  1228                 {
       
  1229                 iHighlightDescriptions[currentPosition].DrawText( gc, 
       
  1230                     *currentItem->Description(), ETrue, iAnimData.iPenFadeIn );
       
  1231                 }
       
  1232             }
       
  1233 
       
  1234         // Save the current position, so we can rub it out later
       
  1235         iAnimData.iTitleFadeInOld = iAnimData.iTitleFadeIn;
       
  1236 
       
  1237         rectLimit = iHighlightTitles[currentPosition].TextRect();
       
  1238         iAnimData.iTitleFadeIn.Move( 0, -iAnimData.iDeltaY );
       
  1239         if ( iAnimData.iTitleFadeIn.iTl.iY <= rectLimit.iTl.iY )
       
  1240             {
       
  1241             // finish
       
  1242             iAnimData.iTitleFadeIn.iTl.iY = rectLimit.iTl.iY;
       
  1243             iAnimData.iTitleFadeIn.iBr.iY = rectLimit.iBr.iY;
       
  1244             }
       
  1245         DrawText( *currentItem->Title(), layoutFont, baseline, EFalse );
       
  1246         }
       
  1247 
       
  1248     DeactivateGc();
       
  1249 
       
  1250     if ( animScrolled && animCompleted )
       
  1251         {
       
  1252         iAnimTimer->Cancel();
       
  1253         iAnimData.iScrolling = EFalse;
       
  1254         iAnimData.iPenFadeOut = KRgbBlack;
       
  1255         iAnimData.iPenFadeIn = KRgbWhite;
       
  1256         iAnimData.iStep = 0;
       
  1257         iAnimData.iIconLeftOffset = 0;
       
  1258         DrawNow();
       
  1259         }
       
  1260     }
       
  1261 
       
  1262 // ---------------------------------------------------------------------------
       
  1263 // CCamSceneSettingContainer::UpdateHighlight
       
  1264 // Updates the highlight rect each time Animate() is called
       
  1265 // ---------------------------------------------------------------------------
       
  1266 //
       
  1267 TBool CCamSceneSettingContainer::UpdateHighlight()
       
  1268     {
       
  1269     TInt currentPosition = iCurrentArrayPosition - iTopDisplayPosition;
       
  1270     TInt previousPosition = iPreviousArrayPosition - iTopDisplayPosition;
       
  1271 
       
  1272     // Save the current position, so we can rub it out later
       
  1273     iAnimData.iCurrentRectOld = iAnimData.iCurrentRect;
       
  1274     iAnimData.iPreviousRectOld = iAnimData.iPreviousRect;
       
  1275     
       
  1276     TBool completedCurrentTop = EFalse;
       
  1277     TBool completedCurrentBottom = EFalse;
       
  1278     TBool completedPreviousTop = EFalse;
       
  1279     TBool completedPreviousBottom = EFalse;
       
  1280 
       
  1281     TInt currentRectTopLimit = iHighlightArray[currentPosition].Rect().iTl.iY;
       
  1282     TInt currentRectBottomLimit = iHighlightArray[currentPosition].Rect().iBr.iY;
       
  1283         
       
  1284     iAnimData.iCurrentRect.iTl.iY -= iAnimData.iDeltaY;
       
  1285     if ( iAnimData.iCurrentRect.iTl.iY <= currentRectTopLimit )
       
  1286         {
       
  1287         iAnimData.iCurrentRect.iTl.iY = currentRectTopLimit;
       
  1288         completedCurrentTop = ETrue;
       
  1289         }
       
  1290     iAnimData.iCurrentRect.iBr.iY += iAnimData.iDeltaY;
       
  1291     if ( iAnimData.iCurrentRect.iBr.iY >= currentRectBottomLimit )
       
  1292         {
       
  1293         iAnimData.iCurrentRect.iBr.iY = currentRectBottomLimit;
       
  1294         completedCurrentBottom = ETrue;
       
  1295         }
       
  1296 
       
  1297     // not scrolling so fade the previous highlight
       
  1298     if ( !iAnimData.iScrolling )
       
  1299         {
       
  1300         TInt previousRectTopLimit;
       
  1301         TInt previousRectBottomLimit;
       
  1302         if ( iAnimData.iMovingDown )
       
  1303             {    
       
  1304             previousRectTopLimit = iDisplacedIcons[previousPosition].Rect().iTl.iY;
       
  1305             previousRectBottomLimit = iDisplacedIcons[previousPosition].Rect().iBr.iY;
       
  1306             }
       
  1307         else // moving up
       
  1308             {
       
  1309             previousRectTopLimit = iNormalIcons[previousPosition-1].Rect().iTl.iY;
       
  1310             previousRectBottomLimit = iNormalIcons[previousPosition-1].Rect().iBr.iY;
       
  1311             }
       
  1312 
       
  1313         iAnimData.iPreviousRect.iTl.iY += iAnimData.iDeltaY;
       
  1314         if ( iAnimData.iPreviousRect.iTl.iY >= previousRectTopLimit )
       
  1315             {
       
  1316             iAnimData.iPreviousRect.iTl.iY = previousRectTopLimit;
       
  1317             completedPreviousTop = ETrue;
       
  1318             }
       
  1319 
       
  1320         iAnimData.iPreviousRect.iBr.iY -= iAnimData.iDeltaY;
       
  1321         if ( iAnimData.iPreviousRect.iBr.iY <= previousRectBottomLimit )
       
  1322             {
       
  1323             iAnimData.iPreviousRect.iBr.iY = previousRectBottomLimit;
       
  1324             completedPreviousBottom = ETrue;
       
  1325             }
       
  1326         }
       
  1327     else // scrolling - don't draw the previous rect
       
  1328         {
       
  1329         completedPreviousTop = ETrue;
       
  1330         completedPreviousBottom = ETrue;
       
  1331         }
       
  1332 
       
  1333     return ( completedCurrentTop && completedCurrentBottom && 
       
  1334              completedPreviousTop && completedPreviousBottom );
       
  1335     }
       
  1336 
       
  1337 // ---------------------------------------------------------------------------
       
  1338 // CCamSceneSettingContainer::UpdateAnimationData
       
  1339 // Updates the pen/icons each time Animate() is called
       
  1340 // ---------------------------------------------------------------------------
       
  1341 //
       
  1342 void CCamSceneSettingContainer::UpdateAnimationData()
       
  1343     {
       
  1344     const CCamSceneSettingItem* previousItem = iSettingItemArray[iPreviousArrayPosition];
       
  1345     const CCamSceneSettingItem* currentItem = iSettingItemArray[iCurrentArrayPosition];
       
  1346 
       
  1347     if ( iAnimData.iStep == 1 )
       
  1348         {
       
  1349         iAnimData.iPenFadeOut = KRgbDarkGray;
       
  1350         iAnimData.iPenFadeIn = KRgbGray4;
       
  1351         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeSix );
       
  1352         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeOne );
       
  1353         } 
       
  1354     else if ( iAnimData.iStep == 2 )
       
  1355         {
       
  1356         iAnimData.iPenFadeOut = KRgbGray;
       
  1357         iAnimData.iPenFadeIn = KRgbGray3;
       
  1358         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeFive );
       
  1359         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeTwo );
       
  1360         }
       
  1361     else if ( iAnimData.iStep == 3 )
       
  1362         {
       
  1363         iAnimData.iPenFadeOut = KRgbGray1;
       
  1364         iAnimData.iPenFadeIn = KRgbGray2;
       
  1365         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeFour );
       
  1366         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeThree );
       
  1367         }
       
  1368     else if ( iAnimData.iStep == 4 )
       
  1369         {
       
  1370         iAnimData.iPenFadeOut = KRgbGray2;
       
  1371         iAnimData.iPenFadeIn = KRgbGray1;
       
  1372         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeThree );
       
  1373         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeFour );
       
  1374         }
       
  1375     else if ( iAnimData.iStep == 5 )
       
  1376         {
       
  1377         iAnimData.iPenFadeOut = KRgbGray3;
       
  1378         iAnimData.iPenFadeIn = KRgbGray;
       
  1379         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeTwo );
       
  1380         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeFive );
       
  1381         }
       
  1382     else if ( iAnimData.iStep == 6 )
       
  1383         {
       
  1384         iAnimData.iPenFadeOut = KRgbGray4;
       
  1385         iAnimData.iPenFadeIn = KRgbDarkGray;
       
  1386 
       
  1387         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeOne );
       
  1388         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeSix );
       
  1389         }
       
  1390     else if ( iAnimData.iStep == 7 )
       
  1391         {
       
  1392         iAnimData.iPenFadeOut = KRgbWhite;
       
  1393         iAnimData.iPenFadeIn = KRgbBlack;
       
  1394         iAnimData.iIconFadeOut = previousItem->Icon( ECamIconSizeSmall );
       
  1395         iAnimData.iIconFadeIn = currentItem->Icon( ECamIconSizeLarge );
       
  1396         }
       
  1397     else
       
  1398         {
       
  1399         
       
  1400         }
       
  1401     iAnimData.iIconLeftOffset += iAnimData.iIconLeftInc;
       
  1402     }
       
  1403 
       
  1404 // ---------------------------------------------------------------------------
       
  1405 // CCamSceneSettingContainer::DrawText
       
  1406 // Draws the title text each time Animate() is called
       
  1407 // ---------------------------------------------------------------------------
       
  1408 //
       
  1409 void CCamSceneSettingContainer::DrawText( const TDesC& aText, 
       
  1410                                           const CAknLayoutFont* aFont, 
       
  1411                                           TInt aBaseline,
       
  1412                                           TBool aFadeOut ) const
       
  1413     {
       
  1414     CWindowGc& gc = SystemGc();
       
  1415 
       
  1416     TRect oldRect;
       
  1417     TRect rect;
       
  1418     if ( aFadeOut )
       
  1419         {
       
  1420         rect = iAnimData.iTitleFadeOut;
       
  1421         oldRect = iAnimData.iTitleFadeOutOld;
       
  1422         }
       
  1423     else
       
  1424         {
       
  1425         rect = iAnimData.iTitleFadeIn;
       
  1426         oldRect = iAnimData.iTitleFadeInOld;
       
  1427         }
       
  1428     gc.UseFont( aFont );
       
  1429     TLogicalRgb backgroundColour( TLogicalRgb::ESystemBackgroundColor );
       
  1430     gc.SetPenColor( backgroundColour );
       
  1431     // draw test aligned left or right depending on layout
       
  1432     if( !AknLayoutUtils::LayoutMirrored() )
       
  1433         {
       
  1434         gc.DrawText( aText, oldRect, aBaseline, CGraphicsContext::ELeft );
       
  1435         gc.SetPenColor( KRgbBlack );
       
  1436         gc.DrawText( aText, rect, aBaseline, CGraphicsContext::ELeft );
       
  1437         }
       
  1438     else
       
  1439         {
       
  1440         gc.DrawText( aText, oldRect, aBaseline, CGraphicsContext::ERight );
       
  1441         gc.SetPenColor( KRgbBlack );
       
  1442         gc.DrawText( aText, rect, aBaseline, CGraphicsContext::ERight );
       
  1443         }
       
  1444 
       
  1445     gc.DiscardFont();
       
  1446     }
       
  1447 
       
  1448 // ---------------------------------------------------------------------------
       
  1449 // CCamSceneSettingContainer::DrawIcon
       
  1450 // Draws the icon each time Animate() is called
       
  1451 // ---------------------------------------------------------------------------
       
  1452 //
       
  1453 void CCamSceneSettingContainer::DrawIcon( TBool aFadeOut )
       
  1454     {
       
  1455     TRect oldRect;
       
  1456     TRect bmpRect;
       
  1457     const CFbsBitmap* bitmap = NULL;
       
  1458 
       
  1459     TRect largeIcon = iHighlightIcons[0].Rect();
       
  1460     TRect smallIcon = iNormalIcons[0].Rect();
       
  1461 
       
  1462     if ( aFadeOut )
       
  1463         {
       
  1464         bitmap = iAnimData.iIconFadeOut;
       
  1465         TSize bmpSize = bitmap->SizeInPixels();
       
  1466 
       
  1467         TInt iconYPos = ( iAnimData.iPreviousRect.Height() - bmpSize.iHeight ) / 2;
       
  1468 
       
  1469         TPoint iconPos( ( largeIcon.iTl.iX + (TInt)iAnimData.iIconLeftOffset ), 
       
  1470                       ( iAnimData.iPreviousRect.iTl.iY + iconYPos ) );
       
  1471 
       
  1472         iAnimData.iIconRectFadeOutOld = iAnimData.iIconRectFadeOut;
       
  1473         iAnimData.iIconRectFadeOut.SetRect( iconPos, bmpSize );
       
  1474 
       
  1475         oldRect = iAnimData.iIconRectFadeOutOld;
       
  1476         bmpRect = iAnimData.iIconRectFadeOut;
       
  1477         }
       
  1478     else
       
  1479         {
       
  1480         bitmap = iAnimData.iIconFadeIn;
       
  1481         TSize bmpSize = bitmap->SizeInPixels();
       
  1482  
       
  1483         TInt iconYPos = ( iAnimData.iCurrentRect.Height() - bmpSize.iHeight ) / 2;
       
  1484         
       
  1485         TPoint iconPos( ( smallIcon.iTl.iX - (TInt)iAnimData.iIconLeftOffset ), 
       
  1486                         ( iAnimData.iCurrentRect.iTl.iY + iconYPos ) );
       
  1487 
       
  1488         iAnimData.iIconRectFadeInOld = iAnimData.iIconRectFadeIn;
       
  1489         iAnimData.iIconRectFadeIn.SetRect( iconPos, bmpSize );
       
  1490 
       
  1491         oldRect = iAnimData.iIconRectFadeInOld;
       
  1492         bmpRect = iAnimData.iIconRectFadeIn;
       
  1493         }
       
  1494 
       
  1495     CWindowGc& gc = SystemGc();
       
  1496     gc.Clear( oldRect );
       
  1497     gc.BitBlt( bmpRect.iTl, bitmap );
       
  1498     }
       
  1499 
       
  1500 // ---------------------------------------------------------------------------
       
  1501 // CCamSceneSettingContainer::DrawHighlight
       
  1502 // Draws the highlight rect each time Animate() is called
       
  1503 // ---------------------------------------------------------------------------
       
  1504 //
       
  1505 void CCamSceneSettingContainer::DrawHighlight() const
       
  1506     {
       
  1507     if( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ) 
       
  1508         {
       
  1509         return;
       
  1510         }
       
  1511 
       
  1512     CWindowGc& gc = SystemGc();
       
  1513 
       
  1514     TSize corner( KCornerSize,KCornerSize );
       
  1515     // Clear the old highlight
       
  1516     gc.SetPenSize( TSize( KBorderSize, KBorderSize ) );
       
  1517     TLogicalRgb backgroundColour( TLogicalRgb::ESystemBackgroundColor );
       
  1518     gc.SetPenColor( backgroundColour );
       
  1519     gc.DrawRoundRect( iAnimData.iCurrentRectOld, corner );
       
  1520     if ( !iAnimData.iScrolling )
       
  1521         {
       
  1522         gc.DrawRoundRect( iAnimData.iPreviousRectOld, corner );
       
  1523         }
       
  1524     // Draw the new highlight
       
  1525     gc.SetPenSize( TSize( KBorderSize, KBorderSize ) );
       
  1526     gc.SetPenColor( iAnimData.iPenFadeIn );
       
  1527     gc.DrawRoundRect( iAnimData.iCurrentRect, corner );
       
  1528     if ( !iAnimData.iScrolling )
       
  1529         {
       
  1530         gc.SetPenColor( iAnimData.iPenFadeOut );
       
  1531         gc.DrawRoundRect( iAnimData.iPreviousRect, corner );
       
  1532         }
       
  1533     }
       
  1534 
       
  1535 // ---------------------------------------------------------------------------
       
  1536 // CCamSceneSettingContainer::DrawListL
       
  1537 // Draws the list to an off-screen bitmap
       
  1538 // ---------------------------------------------------------------------------
       
  1539 //
       
  1540 void CCamSceneSettingContainer::DrawListL()
       
  1541     {
       
  1542     // create an off-screen device and context
       
  1543     CFbsBitGc* bitmapGc = NULL;
       
  1544     CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( iAnimData.iOffScreenBitmap );
       
  1545     CleanupStack::PushL( bitmapDevice );
       
  1546     User::LeaveIfError( bitmapDevice->CreateContext( bitmapGc ) );
       
  1547     CleanupStack::PushL( bitmapGc );
       
  1548 
       
  1549     bitmapGc->SetPenStyle( CGraphicsContext::ENullPen );
       
  1550     bitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1551     bitmapGc->DrawRect( TRect( iAnimData.iOffScreenBitmap->SizeInPixels() ) );
       
  1552 
       
  1553     TInt i;
       
  1554     // only draw top 4 items in the list
       
  1555     for ( i = 0; i < iNumberOfIconsToDisplay-1; i++ )
       
  1556         {
       
  1557         TInt position = iTopDisplayPosition + i;
       
  1558         CCamSceneSettingItem* item = iSettingItemArray[position];
       
  1559 
       
  1560         // Draw the standard icon
       
  1561         iDisplacedIcons[i].DrawImage( *bitmapGc, 
       
  1562                 const_cast<CFbsBitmap*>( item->Icon( ECamIconSizeSmall ) ), NULL );
       
  1563         // Draw the header text
       
  1564         iDisplacedTitles[i].DrawText( *bitmapGc, *item->Title() );
       
  1565         }
       
  1566 
       
  1567     CleanupStack::PopAndDestroy( bitmapGc );
       
  1568     CleanupStack::PopAndDestroy( bitmapDevice );
       
  1569     }
       
  1570 
       
  1571 // ---------------------------------------------------------------------------
       
  1572 // CCamSceneSettingContainer::ScrollList
       
  1573 // Scrolls the list
       
  1574 // ---------------------------------------------------------------------------
       
  1575 //
       
  1576 TBool CCamSceneSettingContainer::ScrollList()
       
  1577     {
       
  1578     SystemGc().BitBlt( iAnimData.iOffScreenPos, iAnimData.iOffScreenBitmap );
       
  1579     if ( iAnimData.iMovingDown )
       
  1580         {
       
  1581         iAnimData.iOffScreenPos.iY -= iAnimData.iScrollingY;
       
  1582         if ( iAnimData.iOffScreenPos.iY <= 0 )
       
  1583             {
       
  1584             return ETrue;
       
  1585             }
       
  1586         }
       
  1587     else
       
  1588         {
       
  1589         iAnimData.iOffScreenPos.iY += iAnimData.iScrollingY;
       
  1590         if ( iAnimData.iOffScreenPos.iY >= iDisplacedIcons[1].Rect().iTl.iY )
       
  1591             {
       
  1592             return ETrue;
       
  1593             }
       
  1594         }
       
  1595     return EFalse;
       
  1596     }
       
  1597 
       
  1598 // ---------------------------------------------------------------------------
       
  1599 // CCamSceneSettingContainer::MoveHighlight
       
  1600 // Moves the highlight to its new position, ready to be animated
       
  1601 // ---------------------------------------------------------------------------
       
  1602 //
       
  1603 void CCamSceneSettingContainer::MoveHighlight()
       
  1604     {
       
  1605     iAnimData.iPreviousRect = iAnimData.iCurrentRect;
       
  1606 
       
  1607     TInt curIndex = iCurrentArrayPosition - iTopDisplayPosition;
       
  1608     TInt prevIndex = iPreviousArrayPosition - iTopDisplayPosition;
       
  1609 
       
  1610     TRect iconRect;
       
  1611     TRect titleRect;
       
  1612 
       
  1613     if ( iAnimData.iMovingDown )
       
  1614         {
       
  1615         TInt defaultIndex = curIndex - 1;
       
  1616         iconRect = iNormalIcons[defaultIndex].Rect();
       
  1617         titleRect = iNormalTitles[defaultIndex].TextRect();
       
  1618         }
       
  1619     else
       
  1620         {        
       
  1621         iconRect = iDisplacedIcons[curIndex].Rect();
       
  1622         titleRect = iDisplacedTitles[curIndex].TextRect();
       
  1623         }
       
  1624 
       
  1625     iAnimData.iCurrentRect = iHighlightArray[curIndex].Rect();
       
  1626     iAnimData.iCurrentRect.iTl.iY = iconRect.iTl.iY;
       
  1627     iAnimData.iCurrentRect.iBr.iY = iAnimData.iCurrentRect.iTl.iY + iconRect.Height();
       
  1628 
       
  1629     iAnimData.iTitleFadeOut = iHighlightTitles[prevIndex].TextRect();
       
  1630     iAnimData.iTitleFadeIn = titleRect;
       
  1631 
       
  1632     iAnimData.iIconRectFadeOut = iHighlightIcons[prevIndex].Rect();
       
  1633     iAnimData.iIconRectFadeIn = iconRect;
       
  1634     }
       
  1635 
       
  1636 // End of File