basiclocationinfodisplay/blid/ui/src/CHtkTripMeterControl.cpp
branchRCL_3
changeset 18 870918037e16
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Blid application Tripmeter view's control class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDES
       
    20 #include <coemain.h>
       
    21 #include <akncontext.h> 
       
    22 #include <aknnavide.h> 
       
    23 #include <eikspane.h> 
       
    24 #include <StringLoader.h> 
       
    25 #include <akntitle.h> 
       
    26 #include <akntabgrp.h>
       
    27 #include <blid.mbg>
       
    28 #include <blid.rsg>
       
    29 #include <aknlayoutscalable_avkon.cdl.h>
       
    30 #include <centralrepository.h>
       
    31 #include <aknnotedialog.h>
       
    32 #include <aknlayoutscalable_apps.cdl.h>
       
    33 #include <layoutmetadata.cdl.h>
       
    34 #include <AknUtils.h>
       
    35 #include <AknsConstants.h>
       
    36 
       
    37 #include <alf/alfenv.h>
       
    38 #include <alf/alfanchorlayout.h>
       
    39 #include <alf/alftextvisual.h>
       
    40 #include <alf/alfborderbrush.h>
       
    41 #include <alf/alfbrusharray.h>
       
    42 #include <alf/alfevent.h>
       
    43 #include <alf/alftransformation.h>
       
    44 #include <alf/alfimagevisual.h>
       
    45 #include <alf/alftexture.h>
       
    46 #include <alf/alfroster.h>
       
    47 #include <alf/alflinevisual.h>
       
    48 #include <alf/alfcurvepath.h>
       
    49 #include <alf/alfcurvepathlayout.h>
       
    50 #include <alf/alfimagebrush.h>
       
    51 #include <alf/alfframebrush.h>
       
    52 #include <alf/alfdecklayout.h>
       
    53 #include <alf/alftextstyle.h>
       
    54 #include <alf/alfutil.h>
       
    55 #include <alf/alfimageloaderutil.h>
       
    56 // USER INCLUDES
       
    57 #include "CBlidBaseView.h"
       
    58 #include "CBlidEng.h"
       
    59 #include "CHtkTripMeterControl.h"
       
    60 #include "Blid.hrh"
       
    61 #include "CHtkTripMeterControl.h"
       
    62 #include "MBlidRouter.h"
       
    63 #include "MBlidSettings.h"
       
    64 #include "MBlidLocation.h"
       
    65 #include "e32const.h"
       
    66 #include "Blidutils.h"
       
    67 #include "bliduiconsts.h"
       
    68 #include "BlidSettingsCrkeys.h"
       
    69 #include "Debug.h"
       
    70 
       
    71 _LIT( KText1,  " " );
       
    72 _LIT( KDistanceFormat,"%.1f" );
       
    73 const TInt KTimerInterval = 200000;
       
    74 
       
    75 // ================= MEMBER FUNCTIONS =======================
       
    76 // ---------------------------------------------------------
       
    77 // CHtkTripMeterControl::NewL()
       
    78 // ---------------------------------------------------------
       
    79 //
       
    80 CHtkTripMeterControl* CHtkTripMeterControl::NewL(CAlfEnv& aEnv,
       
    81 				    							MKeyProcessor& aKeyProcessor,
       
    82 		                                        MObjectProvider* /*aParent*/,
       
    83 				                                const TRect& aRect,
       
    84 		                                        MBlidLocation* aLocation,
       
    85 		                                        MBlidRouter* aRouter,
       
    86 		                                        CBlidEng& aEngine,
       
    87 		                                        CBlidBaseView& aView)
       
    88     {
       
    89 	CHtkTripMeterControl* self =
       
    90 		new (ELeave) CHtkTripMeterControl( aEnv, aKeyProcessor, *aRouter, aView, aEngine );
       
    91 	CleanupStack::PushL(self);
       
    92 	self->ConstructL(aEnv, aRect, aLocation, aEngine );
       
    93     CleanupStack::Pop( self ); // self
       
    94 	return self;
       
    95     }
       
    96 
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 //
       
   100 //CHtkTripMeterControl::CHtkTripMeterControl()
       
   101 // ---------------------------------------------------------
       
   102 //
       
   103 CHtkTripMeterControl::CHtkTripMeterControl(CAlfEnv& aEnv,
       
   104 					    					MKeyProcessor& /*aKeyProcessor*/,
       
   105 				                            MBlidRouter& aRouter,
       
   106 					                        CBlidBaseView& aView,
       
   107 					                        CBlidEng& aEngine )
       
   108     : CAlfControl( ),iRouter( aRouter ),iView( aView ), iEngine(aEngine),iEnv(aEnv)
       
   109 
       
   110     {
       
   111     }
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------
       
   115 // CHtkTripMeterControl::ConstructL()
       
   116 // ---------------------------------------------------------
       
   117 //
       
   118 void CHtkTripMeterControl::ConstructL( CAlfEnv& aEnv,
       
   119 										const TRect& /*aRect*/,
       
   120 					                    MBlidLocation* aLocation,
       
   121 					                    CBlidEng& aEngine )
       
   122     {
       
   123     
       
   124     CAlfControl::ConstructL( aEnv );
       
   125     
       
   126     iLocation = aLocation ;
       
   127     iSpeedCount = 0;
       
   128     iSettingsModel = aEngine.SettingsModel();
       
   129     
       
   130     iDurationFormatLong = CEikonEnv::Static()->AllocReadResourceL( 
       
   131                       R_QTN_TIME_DURAT_LONG_WITH_ZERO );
       
   132 
       
   133     iSpeedFormatKmph = CEikonEnv::Static()->AllocReadResourceL( R_BLID_METRIC_SPEED_FORMAT );
       
   134     
       
   135     iSpeedFormatMph = CEikonEnv::Static()->AllocReadResourceL( R_BLID_IMPERIAL_SPEED_FORMAT );                       
       
   136 
       
   137 		
       
   138     /// item's formats
       
   139     iDataBlank = StringLoader::LoadL( R_BLID_BLANK, CEikonEnv::Static() );    
       
   140 	iTripDistance = HBufC::NewL( KBlidLBItemMaxLen );
       
   141 	iOdometerDistance = HBufC::NewL( KBlidLBItemMaxLen );
       
   142 	iImagePath = HBufC::NewL( iEnv.TextureManager().ImagePath().Length() + 1 );
       
   143 	iImagePath->Des().Copy( iEnv.TextureManager().ImagePath() );
       
   144 	
       
   145 	iRepository = CRepository::NewL( KCRUidBlidOdometerSettings );
       
   146 	TInt error = iRepository->Get( KBlidOdometerSettingsValue, iLastodometerValue );
       
   147 	if( error == KErrNone )
       
   148 		{
       
   149 		iOdoValueToStore = iLastodometerValue;
       
   150 		FormatOdometerDistance( iLastodometerValue );
       
   151 		}
       
   152 
       
   153     TInt textStyleId = iEnv.TextStyleManager().
       
   154         CreatePlatformTextStyleL( EAknLogicalFontDigitalFont, 
       
   155                                   EAlfTextStyleSmall );
       
   156     iStyle1 = iEnv.TextStyleManager().TextStyle( textStyleId );                                  
       
   157     iStyle1->SetBold( ETrue );
       
   158    	iStyle1->SetTextSizeInPixels( 22, ETrue );
       
   159 
       
   160     // Create a single text visual. The pointer to the visual is stored
       
   161     // as a member variable for later access.
       
   162 	CreateNaviPaneL( EFalse );
       
   163     ActivateTabL( *iDecoratedTabGroup, EBlidNavigationView );
       
   164     
       
   165     iIsLessThanInitial = EFalse;
       
   166     iSTripDimmed = EFalse;
       
   167     
       
   168     CalculateRects();
       
   169     iTripLayout = CAlfAnchorLayout::AddNewL( *this );
       
   170     CreateTripVisualsL();// ordinal 0 to 8
       
   171 	CreateSpeedVisualsL();// ordinal 9 to 17
       
   172 	CreateSignalTexturesL();
       
   173 	CreatePopupImgTextureL();
       
   174 	// image visual for signal strength
       
   175 	iImageVisual = CAlfImageVisual::AddNewL(*this, iTripLayout);// ordinal 18
       
   176 	
       
   177 	LaunchDeviceNotAvlNoteL( );
       
   178 	SetAnchors();
       
   179     
       
   180     // Make the dial in zeroth position
       
   181     iNextAngle = -( ( 240.0 / iMaxScale ) * iCurrSpeed ) + 30;  	
       
   182 	RotateSpeedDialL( iPrevAngle, iNextAngle );
       
   183 	iPrevAngle = iNextAngle;	      
       
   184 	isDeviceUnavailableDisplayed = EFalse;	      
       
   185 	iIsDownPressed = EFalse;	      
       
   186     }
       
   187 
       
   188 
       
   189 // ---------------------------------------------------------
       
   190 // CHtkTripMeterControl::CreateSpeedVisualsL()
       
   191 // ---------------------------------------------------------
       
   192 //
       
   193 void CHtkTripMeterControl::CreateSpeedVisualsL()
       
   194 	{
       
   195 	TInt j = 0;
       
   196 	HBufC* lTextSpeed = HBufC::NewLC( 20 );
       
   197 	
       
   198 	for ( TInt i = 0; i < 9; i++ )
       
   199 		{
       
   200 		iMileVisual[i] = CAlfTextVisual::AddNewL( *this, iTripLayout );// ordinal 9 to 17
       
   201 		lTextSpeed->Des().Zero();
       
   202 		lTextSpeed->Des().AppendNum( j );
       
   203 		j = j + 5;
       
   204 		iMileVisual[i]->SetTextL( *lTextSpeed );
       
   205 		iMileVisual[i]->SetTextStyle( iStyle1->Id() );
       
   206 		iMileVisual[i]->SetColor( KRgbWhite );
       
   207 		iMileVisual[i]->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
       
   208 		iMileVisual[i]->SetPadding(TAlfBoxMetric(TAlfMetric(.04, EAlfUnitNormalized)));			
       
   209 		}
       
   210 
       
   211 	iMaxScale = j - 5;		
       
   212 	CleanupStack::PopAndDestroy( lTextSpeed );
       
   213 	}
       
   214 
       
   215 // ----------------------------------------------------
       
   216 // CHtkTripMeterControl::CreateGlobeVisualL
       
   217 // ----------------------------------------------------
       
   218 //
       
   219 void CHtkTripMeterControl::CreatePopUpVisualL( )
       
   220 	{
       
   221 	// code to load svg icon
       
   222 	MAlfBitmapProvider* provider = NULL;
       
   223 	
       
   224 	// first creste the image loader utils and then call SetSize.	
       
   225     iView.ImageLoaderUtils()->SetSize( TAlfRealSize( 60, 60 ) );
       
   226     
       
   227     // then create the bitmap provider  
       
   228     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   229     												 iView.ImagePathName(),        // mif file name with path.
       
   230     												 EMbmBlidQgn_graf_blid_searching_01, // bitmap id defiened in mbg file
       
   231     												 EMbmBlidQgn_graf_blid_searching_01_mask ); // bitmap mask id defiened in mbg file
       
   232 	// now using that bitmap provider create the texture.
       
   233 	CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   234 	                                                                provider,
       
   235 	                                                                EAlfTextureFlagDefault ); 
       
   236     iPopupTextures.Append(&texture1);
       
   237     												 
       
   238     // then create the bitmap provider  
       
   239     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   240     												 iView.ImagePathName(),        // mif file name with path.
       
   241     												 EMbmBlidQgn_graf_blid_searching_02, // bitmap id defiened in mbg file
       
   242     												 EMbmBlidQgn_graf_blid_searching_02_mask ); // bitmap mask id defiened in mbg file
       
   243 	// now using that bitmap provider create the texture.
       
   244 	CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   245 	                                                                provider,
       
   246 	                                                                EAlfTextureFlagDefault ); 
       
   247     iPopupTextures.Append(&texture2);
       
   248     
       
   249     // then create the bitmap provider  
       
   250     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   251     												 iView.ImagePathName(),        // mif file name with path.
       
   252     												 EMbmBlidQgn_graf_blid_searching_03, // bitmap id defiened in mbg file
       
   253     												 EMbmBlidQgn_graf_blid_searching_03_mask ); // bitmap mask id defiened in mbg file
       
   254 	// now using that bitmap provider create the texture.
       
   255 	CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   256 	                                                                provider,
       
   257 	                                                                EAlfTextureFlagDefault ); 
       
   258     iPopupTextures.Append(&texture3);
       
   259     
       
   260     // then create the bitmap provider  
       
   261     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   262     												 iView.ImagePathName(),        // mif file name with path.
       
   263     												 EMbmBlidQgn_graf_blid_searching_04, // bitmap id defiened in mbg file
       
   264     												 EMbmBlidQgn_graf_blid_searching_04_mask ); // bitmap mask id defiened in mbg file
       
   265 	// now using that bitmap provider create the texture.
       
   266 	CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   267 	                                                                provider,
       
   268 	                                                                EAlfTextureFlagDefault ); 
       
   269     iPopupTextures.Append(&texture4);
       
   270     
       
   271     // then create the bitmap provider  
       
   272     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   273     												 iView.ImagePathName(),        // mif file name with path.
       
   274     												 EMbmBlidQgn_graf_blid_searching_05, // bitmap id defiened in mbg file
       
   275     												 EMbmBlidQgn_graf_blid_searching_05_mask ); // bitmap mask id defiened in mbg file
       
   276 	// now using that bitmap provider create the texture.
       
   277 	CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   278 	                                                                provider,
       
   279 	                                                                EAlfTextureFlagDefault ); 
       
   280     iPopupTextures.Append(&texture5);
       
   281     
       
   282     // then create the bitmap provider  
       
   283     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   284     												 iView.ImagePathName(),        // mif file name with path.
       
   285     												 EMbmBlidQgn_graf_blid_searching_06, // bitmap id defiened in mbg file
       
   286     												 EMbmBlidQgn_graf_blid_searching_06_mask ); // bitmap mask id defiened in mbg file
       
   287 	// now using that bitmap provider create the texture.
       
   288 	CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   289 	                                                                provider,
       
   290 	                                                                EAlfTextureFlagDefault ); 
       
   291     iPopupTextures.Append(&texture6);
       
   292     
       
   293     // then create the bitmap provider  
       
   294     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   295     												 iView.ImagePathName(),        // mif file name with path.
       
   296     												 EMbmBlidQgn_graf_blid_searching_07, // bitmap id defiened in mbg file
       
   297     												 EMbmBlidQgn_graf_blid_searching_07_mask ); // bitmap mask id defiened in mbg file
       
   298 	// now using that bitmap provider create the texture.
       
   299 	CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   300 	                                                                provider,
       
   301 	                                                                EAlfTextureFlagDefault ); 
       
   302     iPopupTextures.Append(&texture7);
       
   303     
       
   304     // then create the bitmap provider  
       
   305     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file
       
   306     												 iView.ImagePathName(),        // mif file name with path.
       
   307     												 EMbmBlidQgn_graf_blid_searching_08, // bitmap id defiened in mbg file
       
   308     												 EMbmBlidQgn_graf_blid_searching_08_mask ); // bitmap mask id defiened in mbg file
       
   309 	// now using that bitmap provider create the texture.
       
   310 	CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   311 	                                                                provider,
       
   312 	                                                                EAlfTextureFlagDefault ); 
       
   313     iPopupTextures.Append(&texture8);
       
   314 	}
       
   315 	
       
   316 // ---------------------------------------------------------
       
   317 // CHtkTripMeterControl::ChangeSpeedometerScaleL()
       
   318 // ---------------------------------------------------------
       
   319 //
       
   320 void CHtkTripMeterControl::ChangeSpeedometerScaleL()
       
   321 	{
       
   322 	TInt j = 0;
       
   323 	HBufC* lTextSpeed = HBufC::NewLC( 20 );
       
   324 	for ( TInt i = 0; i < 9; i++ )
       
   325 		{
       
   326 		lTextSpeed->Des().Zero();
       
   327 		if( iCurrSpeed > 40 &&
       
   328 			iCurrSpeed <= 200 )
       
   329 			{
       
   330 			lTextSpeed->Des().AppendNum( j );
       
   331 			j = j + 25;	
       
   332 			}
       
   333 		else if( iCurrSpeed <= 40 )
       
   334 			{
       
   335 			lTextSpeed->Des().AppendNum( j );			
       
   336 			j = j + 5;		
       
   337 			}
       
   338 		iMileVisual[i]->SetTextL( *lTextSpeed );
       
   339 		}
       
   340 		
       
   341 	if( iCurrSpeed > 40 &&
       
   342 		iCurrSpeed <= 200 )
       
   343 		{
       
   344 		iMaxScale = j - 25;
       
   345 		}
       
   346 	else if( iCurrSpeed < 40 )
       
   347 		{
       
   348 		iMaxScale = j - 5;
       
   349 		}
       
   350 
       
   351 	CleanupStack::PopAndDestroy( lTextSpeed );
       
   352 
       
   353 	}
       
   354 
       
   355 // ---------------------------------------------------------
       
   356 // CHtkTripMeterControl::CreateSpeedFormatsL()
       
   357 // ---------------------------------------------------------
       
   358 //
       
   359 void CHtkTripMeterControl::CreateSpeedFormatsL()
       
   360 	{
       
   361 	iSpeedFormatVisual = CAlfTextVisual::AddNewL( *this, iTripLayout );// ordinal 18
       
   362 	TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknLogicalFontPrimarySmallFont, EAlfTextStyleSmall);
       
   363 	
       
   364 	if ( iSettingsModel->UnitOfMeasurement() == EUnitsMetric )
       
   365 		{
       
   366 		iSpeedFormatVisual->SetTextL( *iSpeedFormatKmph );		
       
   367 		}
       
   368 	else
       
   369 		{
       
   370 		iSpeedFormatVisual->SetTextL( *iSpeedFormatMph );	
       
   371 		}
       
   372 	iSpeedFormatVisual->SetTextStyle( typefaceStyleId );
       
   373 	iSpeedFormatVisual->SetColor( KRgbWhite );
       
   374 	iSpeedFormatVisual->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );	
       
   375 	iSpeedFormatVisual->SetPadding(TAlfBoxMetric(TAlfMetric(.03, EAlfUnitNormalized)));
       
   376 	}
       
   377 
       
   378 // ---------------------------------------------------------
       
   379 // CHtkTripMeterControl::CreateTripVisualsL()
       
   380 // ---------------------------------------------------------
       
   381 //
       
   382 void CHtkTripMeterControl::CreateTripVisualsL( )
       
   383 	{
       
   384 	MAlfBitmapProvider* provider = NULL;
       
   385 	
       
   386 	iBigTripVisual = CAlfImageVisual::AddNewL(*this, iTripLayout);// ordinal 0
       
   387 
       
   388     // create the bitmap provider
       
   389     iView.ImageLoaderUtils()->SetSize( iBigTripRect.Size() );
       
   390     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidTpmeter, // svg icon skin constant id defiened in Aknsconstant.h file
       
   391     												 			iView.ImagePathName(),        // mif file name with path.
       
   392     												 			EMbmBlidQgn_graf_blid_tpmeter, // bitmap id defiened in mbg file
       
   393     												 			EMbmBlidQgn_graf_blid_tpmeter_mask ); // bitmap mask id defiened in mbg file
       
   394     												 
       
   395 	    												 
       
   396 	// now using that bitmap provider create the texture.
       
   397 	CAlfTexture & tripTexture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   398                                                                 provider,
       
   399                                                                 EAlfTextureFlagDefault ); 
       
   400 		                                                                  
       
   401 	iBigTripVisual->SetImage(TAlfImage(tripTexture1));// big trip
       
   402 
       
   403 	iTripDeckVisual = CAlfImageVisual::AddNewL(*this, iTripLayout);// ordinal 1	
       
   404 	
       
   405     iView.ImageLoaderUtils()->SetSize( iTripDeckRect.Size() ); 
       
   406     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidInfo, // svg icon skin constant id defiened in Aknsconstant.h file
       
   407     												 			iView.ImagePathName(),        // mif file name with path.
       
   408     												 			EMbmBlidQgn_graf_blid_info, // bitmap id defiened in mbg file
       
   409     												 			EMbmBlidQgn_graf_blid_info_mask ); // bitmap mask id defiened in mbg file
       
   410     												 
       
   411 	    												 
       
   412 	// now using that bitmap provider create the texture.
       
   413 	CAlfTexture & tripTexture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   414                                                                 provider,
       
   415                                                                 EAlfTextureFlagDefault ); 
       
   416 			                                                                  
       
   417 	iTripDeckVisual->SetImage( TAlfImage( tripTexture2 ) );//trip table
       
   418 
       
   419     iTripMeter = CAlfTextVisual::AddNewL( *this, iTripLayout );// ordinal 2
       
   420 	TRgb rgb;
       
   421 	AknsUtils::GetCachedColor ( AknsUtils::SkinInstance(),
       
   422 								rgb,
       
   423 								KAknsIIDQsnTextColors,
       
   424 								EAknsCIQsnTextColorsCG1 
       
   425 								);
       
   426 								
       
   427     iTripMeter->SetColor( rgb );
       
   428     iTripMeter->SetClipping( EFalse );
       
   429 	iTripMeter->SetTextStyle( iStyle1->Id() );	
       
   430 	iTripMeter->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
       
   431 
       
   432 	iOdoDeckVisual = CAlfImageVisual::AddNewL(*this, iTripLayout );// ordinal 3
       
   433 	
       
   434     iView.ImageLoaderUtils()->SetSize( iOdoDeckRect.Size() ); 
       
   435     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidInfo, // svg icon skin constant id defiened in Aknsconstant.h file
       
   436     												 			iView.ImagePathName(),        // mif file name with path.
       
   437     												 			EMbmBlidQgn_graf_blid_info, // bitmap id defiened in mbg file
       
   438     												 			EMbmBlidQgn_graf_blid_info_mask ); // bitmap mask id defiened in mbg file
       
   439     												 
       
   440 	    												 
       
   441 	// now using that bitmap provider create the texture.
       
   442 	CAlfTexture & tripTexture6 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   443                                                                 provider,
       
   444                                                                 EAlfTextureFlagDefault ); 
       
   445                                                                 	
       
   446 	iOdoDeckVisual->SetImage( TAlfImage( tripTexture6 ) );//odometer table
       
   447 	
       
   448     iOdoMeter = CAlfTextVisual::AddNewL( *this, iTripLayout );// ordinal 4
       
   449 	iOdoMeter->SetColor( rgb );
       
   450     iOdoMeter->SetClipping( EFalse );
       
   451 	iOdoMeter->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
       
   452 	iOdoMeter->SetTextStyle( iStyle1->Id() );
       
   453 	iOdoMeter->SetTextL( *iOdometerDistance );
       
   454 	
       
   455 	// Speed Format
       
   456 	CreateSpeedFormatsL();// ordinal 5
       
   457 
       
   458 	iTripDialVisual = CAlfImageVisual::AddNewL(*this, iTripLayout );// ordinal 6
       
   459 	
       
   460     iView.ImageLoaderUtils()->SetSize( iTripDialRect.Size() ); 
       
   461     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidTpPointer, // svg icon skin constant id defiened in Aknsconstant.h file
       
   462     												 			iView.ImagePathName(),        // mif file name with path.
       
   463     												 			EMbmBlidQgn_graf_blid_tp_pointer, // bitmap id defiened in mbg file
       
   464     												 			EMbmBlidQgn_graf_blid_tp_pointer_mask ); // bitmap mask id defiened in mbg file
       
   465     												 
       
   466 	    												 
       
   467 	// now using that bitmap provider create the texture.
       
   468 	CAlfTexture & tripTexture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   469                                                                 provider,
       
   470                                                                 EAlfTextureFlagDefault ); 
       
   471 		                                                                 
       
   472 	iTripDialVisual->SetImage( TAlfImage( tripTexture4 ) );//pointer
       
   473 	
       
   474 	iTripTimeVisual = CAlfImageVisual::AddNewL(*this, iTripLayout );// ordinal 7	
       
   475 
       
   476     iView.ImageLoaderUtils()->SetSize( iClockImageRect.Size() ); 
       
   477     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidTime, // svg icon skin constant id defiened in Aknsconstant.h file
       
   478     												 			iView.ImagePathName(),        // mif file name with path.
       
   479     												 			EMbmBlidQgn_graf_blid_time, // bitmap id defiened in mbg file
       
   480     												 			EMbmBlidQgn_graf_blid_time_mask ); // bitmap mask id defiened in mbg file
       
   481     												 
       
   482 	    												 
       
   483 	// now using that bitmap provider create the texture.
       
   484 	CAlfTexture & tripTexture7 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
   485                                                                 provider,
       
   486                                                                 EAlfTextureFlagDefault ); 
       
   487 	
       
   488 	iTripTimeVisual->SetImage( TAlfImage( tripTexture7 ) );//clock
       
   489 	
       
   490 	// trip time text	
       
   491     iTriptime = CAlfTextVisual::AddNewL( *this, iTripLayout );// ordinal 8
       
   492     iTriptime->SetColor( rgb );
       
   493     iTriptime->SetClipping( EFalse );
       
   494 	iTriptime->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
       
   495 	iTriptime->SetTextStyle( iStyle1->Id() );
       
   496 	}
       
   497 
       
   498 // ---------------------------------------------------------
       
   499 // CHtkTripMeterControl::~CHtkTripMeterControl()
       
   500 // ---------------------------------------------------------
       
   501 //
       
   502 CHtkTripMeterControl::~CHtkTripMeterControl()
       
   503     {
       
   504     delete iPeriodic;
       
   505     iPeriodic = NULL;
       
   506     iPopupTextures.Reset();
       
   507     iPopupTextures.Close();
       
   508 	delete iDecoratedTabGroup;
       
   509 	delete iDurationFormatLong;
       
   510 	delete iDataBlank;
       
   511 	delete iOdometerDistance;
       
   512 	delete iTripDistance;
       
   513 	delete iSpeedFormatKmph;
       
   514 	delete iSpeedFormatMph;
       
   515 	delete iRepository;
       
   516 	delete iImagePath;
       
   517 	iSignalTextures.Reset();
       
   518     iSignalTextures.Close();	
       
   519     }
       
   520 
       
   521 
       
   522 // ----------------------------------------------------------------------------
       
   523 // CHtkTripMeterControl::UpdateL
       
   524 // ----------------------------------------------------------------------------
       
   525 //
       
   526 void CHtkTripMeterControl::UpdateL()
       
   527     {
       
   528     if((iEngine.AppMode() == CBlidEng::EAppForeground) && 
       
   529        (iSettingsModel->GetBacklightOption() == EBlidBackLightOnDuringNavigation) && !iView.IsSettingsViewActive() )
       
   530         {
       
   531         User::ResetInactivityTime();        
       
   532         }
       
   533     
       
   534 	if( iLocation->IsGPSDataAvailable() )
       
   535 		{
       
   536 		isDeviceUnavailableDisplayed = EFalse;
       
   537 		if( iView.CBAPtr() )
       
   538 			{
       
   539 			iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS );
       
   540 			iView.CBAPtr()->DrawDeferred();
       
   541 			}			    
       
   542 		TInt satCount = 0;
       
   543 		iLocation->GetNumOfSatellitesL( satCount );
       
   544 		DisplaySatelliteSignalStrength( satCount );
       
   545 		if( !iSTripDimmed )
       
   546 			{
       
   547         	iTripLayout->SetOpacity( 1.0 );				
       
   548 			}
       
   549         iPopUpLayout->SetOpacity( 0.0 );
       
   550 		}
       
   551 	else
       
   552 		{
       
   553         TFileName imagepathname;		
       
   554 		DisplaySatelliteSignalStrength( 0 );
       
   555         iTripLayout->SetOpacity( 0.3 );
       
   556         iPopUpLayout->SetOpacity( 1.0 );
       
   557 		// for MSK enabled phone add MSK        
       
   558 		if( iView.CBAPtr() )
       
   559 			{
       
   560 			iView.CBAPtr()->SetCommandSetL( R_BLID_OPTION_INFO_EXIT );
       
   561 			iView.CBAPtr()->DrawDeferred();
       
   562 			}
       
   563 		if( iPeriodic )
       
   564 		        {
       
   565 		        delete iPeriodic;
       
   566 		        iPeriodic = NULL;
       
   567 		        }				    
       
   568 		if( iLocation->WaitingGPSData() )
       
   569 		    {
       
   570 		    isSatelliteInfoLaunch = ETrue;
       
   571 		    if(KNumOfSearchIcon != iPopupTextures.Count())
       
   572 		    	CreatePopUpVisualL( );
       
   573 			HBufC* noteText = StringLoader::LoadLC( R_BLID_STARTUP_NAVITEXT_SEARCHING_GPS_SATELLITES, CEikonEnv::Static() );	
       
   574 			iPopUpMsg->SetTextL( *noteText );
       
   575             iDisplayIcon = 1;
       
   576 		    iPeriodic = CPeriodic::NewL(0); // neutral priority 
       
   577             iPeriodic->Start( TTimeIntervalMicroSeconds32( KTimerInterval ),
       
   578                               TTimeIntervalMicroSeconds32( KTimerInterval ),
       
   579                               TCallBack(Tick, this));
       
   580             UpdateVisualImage();   
       
   581 			CleanupStack::PopAndDestroy(noteText); //noteText
       
   582 		    }
       
   583         else
       
   584             {
       
   585             isSatelliteInfoLaunch = EFalse;
       
   586 		    HBufC* noteText = StringLoader::LoadLC( R_BLID_ERROR_NO_GPS_DEVICE, CEikonEnv::Static() );	
       
   587 			iPopUpMsg->SetTextL( *noteText );
       
   588 	    	iPopImage->SetImage(TAlfImage( *iPopupImgTexture ) );
       
   589 			CleanupStack::PopAndDestroy(noteText); //noteText        	
       
   590 				if(!isDeviceUnavailableDisplayed)
       
   591 				{
       
   592 					CHWRMLight* aHWRMLight = CHWRMLight::NewL();
       
   593 					isDeviceUnavailableDisplayed = ETrue;
       
   594 					if(aHWRMLight->LightStatus(CHWRMLight::EPrimaryDisplay) != CHWRMLight::ELightOn)
       
   595 					{
       
   596 						User::ResetInactivityTime();
       
   597 						aHWRMLight->LightOnL(CHWRMLight::EPrimaryDisplay);
       
   598 						aHWRMLight->ReleaseLight(CHWRMLight::EPrimaryDisplay);
       
   599             }		    
       
   600 		        	delete aHWRMLight;	
       
   601 				}
       
   602             }	       	
       
   603 		}	   	
       
   604 		
       
   605 	if( iLocation->HasTripStarted() ||
       
   606 		iLocation->IsTripCleared() ||
       
   607 		iLocation->IsTripReset() )
       
   608 		{
       
   609 	    SetTRipMeterValueL();
       
   610 	    SetOdoMeterValueL();
       
   611 	    SetTripTimeL();
       
   612 	    SetTripSpeed();
       
   613 		}
       
   614     // logic for rotating the dial
       
   615     if( iLocation->HasTripStarted() && 
       
   616     	!iLocation->IsTripCleared() && 
       
   617         !iLocation->IsTripReset() && 
       
   618         iLocation->IsGPSDataAvailable() )
       
   619 	    {
       
   620 	    // Calculate Current Speed
       
   621 	    if ( iSettingsModel->UnitOfMeasurement() == EUnitsMetric )
       
   622 		    {
       
   623 	    	iCurrSpeed = ( iLocation->GetTripMaxSpeed() ) * KSpeedConvertion;
       
   624 		    }
       
   625 		else
       
   626 			{
       
   627 			iCurrSpeed = ( iLocation->GetTripMaxSpeed() ) * KSpeedConvertion;
       
   628 			iCurrSpeed *= KKilometreToMiles;
       
   629 			}		    
       
   630 		// Check if scale has to be changed
       
   631 		if( iCurrSpeed > 40 && iMaxScale == 40 )
       
   632 			{
       
   633 			ChangeSpeedometerScaleL();			
       
   634 			}
       
   635 		if( iCurrSpeed <= 40 && iMaxScale == 200 )
       
   636 			{
       
   637 			ChangeSpeedometerScaleL();			
       
   638 			}
       
   639 		// Calculate Next Angle	
       
   640 		iNextAngle = -( ( 240.0 / iMaxScale ) * iCurrSpeed ) + 30;
       
   641 		// Rotate dial  	
       
   642 		RotateSpeedDialL( iPrevAngle, iNextAngle );
       
   643 		// Set prev angle
       
   644 		iPrevAngle = iNextAngle;
       
   645 				
       
   646 	    }
       
   647     }
       
   648 
       
   649 // ---------------------------------------------------------
       
   650 // CHtkTripMeterControl::Tick()
       
   651 // ---------------------------------------------------------
       
   652 //
       
   653 TInt CHtkTripMeterControl::Tick(TAny* aObject)
       
   654     {
       
   655     ((CHtkTripMeterControl*)aObject)->UpdateVisualImage(); // cast, and call non-static function
       
   656 
       
   657     return KErrNone;
       
   658     }
       
   659 
       
   660 // ---------------------------------------------------------
       
   661 // CHtkTripMeterControl::UpdateVisualImage
       
   662 // ---------------------------------------------------------
       
   663 //
       
   664 void CHtkTripMeterControl::UpdateVisualImage()
       
   665 	{
       
   666 	if( isSatelliteInfoLaunch )
       
   667 		{
       
   668 	    if(KNumOfSearchIcon > iDisplayIcon)
       
   669 	        {
       
   670 	        iDisplayIcon++;
       
   671 	        }
       
   672 	    else
       
   673 	        {
       
   674 	        iDisplayIcon = 1;
       
   675 	        } 
       
   676 	    //iPopImage->SetSize( animationRect.Size() );
       
   677 	    iPopImage->SetImage( TAlfImage( *iPopupTextures[iDisplayIcon-1] ) );//N  
       
   678 		}
       
   679 	}
       
   680 	
       
   681 // ---------------------------------------------------------
       
   682 // CHtkTripMeterControl::DisplayInfoPopUpMsgL
       
   683 // ---------------------------------------------------------
       
   684 //
       
   685 void CHtkTripMeterControl::DisplayInfoPopUpMsgL()
       
   686 	{
       
   687 	if( isSatelliteInfoLaunch )
       
   688 		{
       
   689 		iView.LaunchSatelliteInfoDlgL();
       
   690 		}
       
   691 	else
       
   692 		{
       
   693 		LaunchInfoQueryDlgL();	
       
   694 		}						
       
   695 	}
       
   696 	
       
   697 // ---------------------------------------------------------
       
   698 // CHtkTripMeterControl::LaunchDeviceNotAvlNoteL
       
   699 // ---------------------------------------------------------
       
   700 //
       
   701 void CHtkTripMeterControl::LaunchDeviceNotAvlNoteL( )
       
   702     {
       
   703 	TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknHighestLogicalFont, EAlfTextStyleNormal); 
       
   704     CAlfTextStyle* style1 = iEnv.TextStyleManager().TextStyle( typefaceStyleId );
       
   705 
       
   706     iPopUpLayout = CAlfAnchorLayout::AddNewL( *this );
       
   707     
       
   708     iPopupDeck = CAlfDeckLayout::AddNewL( *this, iPopUpLayout );
       
   709     
       
   710     iPopUpLayout->SetAnchor(EAlfAnchorTopLeft, 0, 
       
   711         EAlfAnchorOriginHCenter, EAlfAnchorOriginTop,
       
   712         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   713         TAlfTimedPoint( -0.05, 0.05));
       
   714     iPopUpLayout->SetAnchor(EAlfAnchorBottomRight, 0, 
       
   715         EAlfAnchorOriginHCenter, EAlfAnchorOriginTop,
       
   716         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   717         TAlfTimedPoint( 0.4, 0.38));
       
   718 
       
   719 	iPopupDeck->EnableBrushesL();
       
   720 
       
   721     TAlfXYMetric edgeoffset(TAlfMetric( 0.01, EAlfUnitNormalized ));
       
   722     iFrameBrush = CAlfFrameBrush::NewL(iEnv, KAknsIIDQsnFrPopup, edgeoffset);
       
   723     iFrameBrush->SetFrameRectsL(TRect(12,12,167,167), TRect(11,11,170,170));
       
   724     iFrameBrush->SetEdgeOffset(edgeoffset);
       
   725     iPopupDeck->Brushes()->AppendL( iFrameBrush, EAlfHasOwnership );
       
   726 	
       
   727     iPopUpAnchor = CAlfAnchorLayout::AddNewL( *this, iPopupDeck );
       
   728     
       
   729 	iPopUpAnchor->EnableBrushesL();
       
   730     
       
   731     iPopUpMsg = CAlfTextVisual::AddNewL( *this, iPopUpAnchor );
       
   732     iPopImage = CAlfImageVisual::AddNewL( *this, iPopUpAnchor );
       
   733     style1->SetTextSizeInPixels(20, ETrue );
       
   734     style1->SetBold( EFalse );
       
   735     
       
   736 	TRgb rgb;
       
   737 	AknsUtils::GetCachedColor ( AknsUtils::SkinInstance(),
       
   738 								rgb,
       
   739 								KAknsIIDQsnTextColors,
       
   740 								EAknsCIQsnTextColorsCG1 
       
   741 							   );
       
   742 	
       
   743 	iPopUpMsg->SetColor( rgb );
       
   744 	iPopUpMsg->SetTextL( KText1 );
       
   745 	iPopUpMsg->SetTextStyle( style1->Id() );
       
   746 	iPopUpMsg->SetPadding(TAlfBoxMetric(TAlfMetric(.1, EAlfUnitNormalized)));
       
   747 	iPopUpMsg->SetWrapping( CAlfTextVisual::ELineWrapBreak );
       
   748 	iPopUpMsg->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter );
       
   749 	
       
   750     iPopUpAnchor->SetAnchor(EAlfAnchorTopLeft, 0, 
       
   751         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
   752         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   753         TAlfTimedPoint( 0.02, 0.02));
       
   754     iPopUpAnchor->SetAnchor(EAlfAnchorBottomRight, 0, 
       
   755         EAlfAnchorOriginHCenter, EAlfAnchorOriginTop,
       
   756         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   757         TAlfTimedPoint( 0.47, 0.3));
       
   758 
       
   759     iPopUpAnchor->SetAnchor(EAlfAnchorTopLeft, 1, 
       
   760         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
   761         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   762         TAlfTimedPoint( 0.28, 0.4 ));
       
   763     iPopUpAnchor->SetAnchor(EAlfAnchorBottomRight, 1, 
       
   764         EAlfAnchorOriginHCenter, EAlfAnchorOriginBottom,
       
   765         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
   766         TAlfTimedPoint( 0.22, -0.16 ) );
       
   767 
       
   768     iPopUpLayout->SetOpacity( 0.0 );        
       
   769     }
       
   770     
       
   771 // ---------------------------------------------------------
       
   772 // CHtkTripMeterControl::DisplaySatelliteSignalStrength
       
   773 // ---------------------------------------------------------
       
   774 //
       
   775 void CHtkTripMeterControl::DisplaySatelliteSignalStrength( TInt aSatCount ) 
       
   776 	{
       
   777 	TFileName imagepathname;
       
   778 	imagepathname.Zero();
       
   779 	iImageVisual->SetImage(TAlfImage(*iSignalTextures[aSatCount]));
       
   780 	}
       
   781 	
       
   782 // ---------------------------------------------------------
       
   783 // CHtkTripMeterControl::LaunchInfoQueryDlgL
       
   784 // ---------------------------------------------------------
       
   785 //
       
   786 void CHtkTripMeterControl::LaunchInfoQueryDlgL()
       
   787 	{
       
   788     CAknNoteDialog* dlg;
       
   789     dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::EConfirmationTone,CAknNoteDialog::ENoTimeout);
       
   790     TInt result = dlg->ExecuteLD( R_INFO_POPUP_MSG_QUERY );
       
   791     if( result == EAknSoftkeyExit )
       
   792 	    {
       
   793 	    iView.ExitMainApplicationL( EEikCmdExit );
       
   794 	    }
       
   795 	dlg = NULL;	    
       
   796 	}
       
   797 		
       
   798 // ---------------------------------------------------------
       
   799 // CHtkTripMeterControl::HasTripStarted
       
   800 // ---------------------------------------------------------
       
   801 //
       
   802 TBool CHtkTripMeterControl::HasTripStarted()
       
   803     {
       
   804     return iLocation->HasTripStarted();
       
   805     }
       
   806 
       
   807 // ---------------------------------------------------------
       
   808 // CHtkTripMeterControl::WasGPSDataLost
       
   809 // ---------------------------------------------------------
       
   810 //
       
   811 TBool CHtkTripMeterControl::WasGPSDataLost(void)
       
   812     {
       
   813     return iLocation->WasGPSDataLost();
       
   814     }
       
   815         
       
   816 // ---------------------------------------------------------
       
   817 // CHtkTripMeterControl::SetGPSDataAvailability
       
   818 // ---------------------------------------------------------
       
   819 //
       
   820 void CHtkTripMeterControl::SetGPSDataAvailability(TBool aAvailability)
       
   821     {
       
   822     iLocation->SetGPSDataAvailability(aAvailability);
       
   823     }
       
   824 
       
   825 // ---------------------------------------------------------
       
   826 // CHtkTripMeterControl::ProcessCommandL
       
   827 // ---------------------------------------------------------
       
   828 //
       
   829 void CHtkTripMeterControl::ProcessCommandL(TInt aCommand)
       
   830     {
       
   831     ReChangeTripFocus();
       
   832 	switch(aCommand)
       
   833 		{
       
   834 		case EBlidCmdTripStart:
       
   835 			{
       
   836 			/**
       
   837 			 * Start the calculations for the current trip
       
   838 			 */
       
   839 			iLocation->SetTripStartL();
       
   840 			break;
       
   841 			}
       
   842         case EBlidCmdTripStop:
       
   843         	{
       
   844         	/**
       
   845 			* Stop the calculations for the current trip
       
   846 			*/        	
       
   847         	iLocation->SetTripStop();
       
   848         	break;
       
   849 			}
       
   850         case EBlidCmdTripResume:
       
   851         	{
       
   852         	/**
       
   853 			* Resume the calculations for the current trip after stopping
       
   854 			*/			
       
   855 			iLocation->SetTripResumeL();
       
   856 			break;
       
   857 			}
       
   858         case EBlidCmdTripReset:
       
   859         	{
       
   860         	/**
       
   861 			* Reset the items only for the current trip
       
   862 			*/
       
   863         	iLocation->ResetTrip();
       
   864         	break;
       
   865 			}
       
   866         case EBlidCmdTripClear:
       
   867         	{
       
   868          	/**
       
   869 			* Reset all the items in the trip when it is stopped
       
   870 			*/
       
   871 			RotateSpeedDialL( iPrevAngle, 30 );    
       
   872 			iLocation->SetTripClear();
       
   873 	        break;
       
   874 			}
       
   875 		default:
       
   876 			{
       
   877 			break;
       
   878 			}
       
   879 		}
       
   880 		UpdateL();
       
   881     }
       
   882     
       
   883 
       
   884 // ----------------------------------------------------
       
   885 // CHtkTripMeterControl::CreateNaviPaneL
       
   886 // ----------------------------------------------------
       
   887 //
       
   888 void CHtkTripMeterControl::CreateNaviPaneL( TBool aDefaultNaviPane )
       
   889     {    
       
   890     CEikStatusPane* sp = StatusPane();
       
   891     // Fetch pointer to the default navi pane control
       
   892     CAknNavigationControlContainer* naviPane = 
       
   893         static_cast<CAknNavigationControlContainer*>(sp->ControlL( 
       
   894         TUid::Uid(EEikStatusPaneUidNavi)));
       
   895  
       
   896     if( iDecoratedTabGroup )
       
   897 	    {
       
   898 	    delete iDecoratedTabGroup;
       
   899 	    iDecoratedTabGroup = NULL;	
       
   900 	    }
       
   901    
       
   902     if ( aDefaultNaviPane ) // dummy tab
       
   903         {        
       
   904         naviPane->PushDefaultL(EFalse);
       
   905         }
       
   906     else
       
   907         {              
       
   908         iDecoratedTabGroup = naviPane->CreateTabGroupL();
       
   909         iDecoratedTabGroup->SetControlType( CAknNavigationDecorator::ETabGroup );
       
   910         CAknTabGroup* tabGroup = 
       
   911         static_cast< CAknTabGroup* > ( iDecoratedTabGroup->DecoratedControl() );        
       
   912         AddTabsL( *tabGroup );        
       
   913         }
       
   914     }
       
   915 
       
   916 
       
   917 // ----------------------------------------------------
       
   918 // CHtkTripMeterControl::GetNiviDecorator
       
   919 // ----------------------------------------------------
       
   920 //
       
   921 CAknNavigationDecorator* CHtkTripMeterControl::GetNiviDecorator( )
       
   922 	{
       
   923 	return iDecoratedTabGroup;	
       
   924 	}
       
   925 	
       
   926 	    
       
   927 // ----------------------------------------------------
       
   928 // CHtkTripMeterControl::ActivateTabL
       
   929 // ----------------------------------------------------
       
   930 //
       
   931 void CHtkTripMeterControl::ActivateTabL( 
       
   932                          CAknNavigationDecorator& aNaviDecorator,
       
   933                          TInt aTabId )
       
   934     {
       
   935     CEikStatusPane* sp = StatusPane();    
       
   936     CAknNavigationControlContainer* naviPane =
       
   937         static_cast<CAknNavigationControlContainer*>(
       
   938         sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
       
   939     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( 
       
   940         aNaviDecorator.DecoratedControl() );
       
   941     tabGroup->SetActiveTabById( aTabId );
       
   942     naviPane->PushL( aNaviDecorator );
       
   943     }
       
   944 
       
   945 
       
   946 // ----------------------------------------------------
       
   947 // CHtkTripMeterControl::StatusPane
       
   948 // ----------------------------------------------------
       
   949 //
       
   950 CEikStatusPane* CHtkTripMeterControl::StatusPane()
       
   951     {
       
   952     return CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
   953     }
       
   954 
       
   955 
       
   956 // ----------------------------------------------------
       
   957 // CHtkTripMeterControl::MakeTitleL
       
   958 // ----------------------------------------------------
       
   959 //
       
   960 void CHtkTripMeterControl::MakeTitleL( TInt aResourceText )
       
   961     {
       
   962     HBufC* buf = StringLoader::LoadLC(aResourceText);       
       
   963     CAknTitlePane* title = static_cast<CAknTitlePane*>( StatusPane()->
       
   964                             ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   965     CleanupStack::Pop(); //buf
       
   966     title->SetText(buf); // Takes ownership of buf
       
   967     }
       
   968 
       
   969 
       
   970 // ----------------------------------------------------
       
   971 // CHtkTripMeterControl::AddTabsL
       
   972 // ----------------------------------------------------
       
   973 //
       
   974 void CHtkTripMeterControl::AddTabsL(CAknTabGroup& aTabGroup)
       
   975     {
       
   976     aTabGroup.SetTabFixedWidthL(EAknTabWidthWithTwoTabs);
       
   977 
       
   978     MAknsSkinInstance* skin = AknsUtils::SkinInstance(); 
       
   979     HBufC* filename = BlidUtils::GetBitmapFilenameLC();        
       
   980     CFbsBitmap* bitmap = NULL;
       
   981     CFbsBitmap* bitmapMask = NULL;
       
   982         
       
   983     //Add tab icon 1
       
   984     AknsUtils::CreateIconLC( skin,
       
   985                             KAknsIIDQgnPropBlidNavigationTab3,
       
   986                             bitmap,
       
   987                             bitmapMask,
       
   988                             *filename,
       
   989                             EMbmBlidQgn_prop_blid_navigation_tab3,
       
   990                             EMbmBlidQgn_prop_blid_navigation_tab3_mask );             
       
   991     aTabGroup.AddTabL( EBlidNavigationView, bitmap, bitmapMask );
       
   992     CleanupStack::Pop(2); //bitmap, bitmapmask
       
   993 
       
   994     //Add tab icon 2
       
   995     AknsUtils::CreateIconLC( skin,
       
   996                             KAknsIIDQgnPropBlidTripTab3,
       
   997                             bitmap,
       
   998                             bitmapMask,
       
   999                             *filename,
       
  1000                             EMbmBlidQgn_prop_blid_trip_tab3,
       
  1001                             EMbmBlidQgn_prop_blid_trip_tab3_mask );             
       
  1002     aTabGroup.AddTabL( EBlidTripMeterView, bitmap, bitmapMask );
       
  1003     CleanupStack::Pop(2); //bitmap, bitmapmask
       
  1004 
       
  1005     
       
  1006     
       
  1007     CleanupStack::PopAndDestroy(); //filename
       
  1008     }
       
  1009 
       
  1010 // ----------------------------------------------------
       
  1011 // CHtkTripMeterControl::OfferEventL
       
  1012 // ----------------------------------------------------
       
  1013 //
       
  1014 TBool CHtkTripMeterControl::OfferEventL(const TAlfEvent& aEvent)
       
  1015 	{
       
  1016     if(aEvent.IsKeyEvent() && aEvent.Code() == EEventKey)
       
  1017         {
       
  1018         CEikStatusPane* sp = StatusPane();
       
  1019 	    // Fetch pointer to the default navi pane control
       
  1020 	    CAknNavigationControlContainer* naviPane = 
       
  1021 	        static_cast<CAknNavigationControlContainer*>(sp->ControlL( 
       
  1022 	        TUid::Uid(EEikStatusPaneUidNavi)));
       
  1023 	    CAknNavigationDecorator* naviDecorator = naviPane->Top();
       
  1024 
       
  1025 	    // Check if navigation pane controls exists, because decorator does 
       
  1026 	    // not exist in every cases. E.g. after contact fetch in "new rule" 
       
  1027 	    // command operation naviDecorator is null. 
       
  1028 	    if ( naviDecorator && naviDecorator->ControlType() == 
       
  1029 	        CAknNavigationDecorator::ETabGroup )
       
  1030 	        {
       
  1031 	        if ( naviDecorator->DecoratedControl()->OfferKeyEventL( 
       
  1032 	            aEvent.KeyEvent(), aEvent.Code() ) == EKeyWasConsumed )
       
  1033 	            {
       
  1034 	            CAknTabGroup* tabGroup = static_cast< CAknTabGroup* > ( naviDecorator->DecoratedControl() );
       
  1035 	            TInt tabIndex = tabGroup->ActiveTabIndex();
       
  1036 				iView.ActivateCorrectViewL( tabIndex );
       
  1037 	            return ETrue;
       
  1038 	            }
       
  1039 	        }    
       
  1040 		}
       
  1041 	else if( aEvent.IsPointerEvent() )
       
  1042 		{
       
  1043 		if ( aEvent.PointerDown() )
       
  1044 			{
       
  1045 			iIsDownPressed = ETrue;
       
  1046 			return ETrue;
       
  1047 			}
       
  1048 		if ( aEvent.PointerUp() && iIsDownPressed )
       
  1049 			{	
       
  1050 			if( iLocation->IsGPSDataAvailable() )
       
  1051 				{
       
  1052 				iView.LaunchTripContextMenuL();
       
  1053 				return ETrue;				
       
  1054 				}
       
  1055 			else
       
  1056 				{
       
  1057 				if( aEvent.Visual() == iPopUpAnchor ||
       
  1058 					aEvent.Visual() == iPopUpMsg ||
       
  1059 					aEvent.Visual() == iPopImage )					  
       
  1060 					{
       
  1061 					if( isSatelliteInfoLaunch )
       
  1062 						{
       
  1063 						iView.LaunchSatelliteInfoDlgL();
       
  1064 						return ETrue;
       
  1065 						}
       
  1066 					else
       
  1067 						{
       
  1068 						LaunchInfoQueryDlgL();	
       
  1069 						return ETrue;						
       
  1070 						}						
       
  1071 					}
       
  1072 				}
       
  1073 			return EFalse;
       
  1074 			}
       
  1075 		}
       
  1076 	return EFalse;
       
  1077 	}
       
  1078 	
       
  1079 
       
  1080 // ----------------------------------------------------------------------------
       
  1081 // CHtkTripMeterControl::RotateSpeedDialL()
       
  1082 // ----------------------------------------------------------------------------
       
  1083 //
       
  1084 void CHtkTripMeterControl::RotateSpeedDialL( int aThetaPrevious, int aThetaFinal )
       
  1085     {
       
  1086 	iTripDialVisual->EnableTransformationL(ETrue);
       
  1087 	CAlfTransformation& aXf = iTripDialVisual->Transformation();
       
  1088 	aXf.LoadIdentity();
       
  1089 	TAlfTimedValue angle;
       
  1090 	angle.SetValueNow( aThetaPrevious );
       
  1091 	angle.SetTarget( aThetaFinal, 8000 );
       
  1092 	aXf.Rotate(angle); 
       
  1093     }
       
  1094 
       
  1095 // ----------------------------------------------------------------------------
       
  1096 // CHtkTripMeterControl::SetTRipMeterValueL
       
  1097 // ----------------------------------------------------------------------------
       
  1098 //
       
  1099 void CHtkTripMeterControl::SetTRipMeterValueL( )
       
  1100     {
       
  1101 	// set the tripmeter distance
       
  1102 	TBuf<128> tripmeterString;	
       
  1103 	TripmeterFormatL( tripmeterString );
       
  1104 	iTripMeter->SetTextL( *iTripDistance );
       
  1105     }
       
  1106     
       
  1107 // ----------------------------------------------------------------------------
       
  1108 // CHtkTripMeterControl::SetOdoMeterValueL
       
  1109 // ----------------------------------------------------------------------------
       
  1110 //
       
  1111 void CHtkTripMeterControl::SetOdoMeterValueL( )
       
  1112     {
       
  1113 	// set the odometer distance
       
  1114 	TBuf<128> odometerString;	
       
  1115 	OdometerFormat( odometerString );
       
  1116 	iOdoMeter->SetTextL( *iOdometerDistance );
       
  1117     }
       
  1118 
       
  1119 // ----------------------------------------------------------------------------
       
  1120 // CHtkTripMeterControl::SetTripTimeL
       
  1121 // ----------------------------------------------------------------------------
       
  1122 //
       
  1123 void CHtkTripMeterControl::SetTripTimeL( )
       
  1124     {
       
  1125 	// set the odometer distance
       
  1126 	TBuf<128> odometerString;	
       
  1127 	TotalTimeFormat( odometerString );
       
  1128 	iTriptime->SetTextL( odometerString );
       
  1129     }
       
  1130 
       
  1131 // ----------------------------------------------------------------------------
       
  1132 // CHtkTripMeterControl::SetTripSpeed
       
  1133 // ----------------------------------------------------------------------------
       
  1134 //
       
  1135 void CHtkTripMeterControl::SetTripSpeed( )
       
  1136     {
       
  1137     // Nothing to do now
       
  1138     }
       
  1139 
       
  1140 // ----------------------------------------------------------------------------
       
  1141 // CHtkTripMeterControl::FormatOdometerDistance
       
  1142 // ----------------------------------------------------------------------------
       
  1143 //
       
  1144 void CHtkTripMeterControl::FormatOdometerDistance( TReal aLastodometerValue )    
       
  1145 	{
       
  1146     TInt result(0);        
       
  1147     if ( BlidUtils::TRealToTInt(aLastodometerValue, result) != KErrNone )
       
  1148         {
       
  1149         iOdometerDistance->Des().Copy( *iDataBlank );
       
  1150         return;
       
  1151         }
       
  1152     aLastodometerValue = result;        
       
  1153     TReal temp;
       
  1154                     
       
  1155     // metric or imperial
       
  1156     if ( iSettingsModel->UnitOfMeasurement() == EUnitsMetric )
       
  1157         {
       
  1158 
       
  1159         if ( aLastodometerValue >= KKilometerToMeters )
       
  1160             {
       
  1161             TReal distanceInKm = aLastodometerValue / KKilometerToMeters;
       
  1162             Math::Round(temp, distanceInKm, 1);
       
  1163             distanceInKm = temp;
       
  1164             TBuf<KBlidLBItemMaxLen> temp;        
       
  1165             temp.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1166             iOdometerDistance->Des().Copy( temp );
       
  1167             }
       
  1168     	else
       
  1169         	{
       
  1170             if ( BlidUtils::TRealToTInt(aLastodometerValue, result) != KErrNone )
       
  1171             	{
       
  1172                 iOdometerDistance->Des().Copy( *iDataBlank );
       
  1173             	}
       
  1174             else
       
  1175             	{
       
  1176             	Math::Mod(temp, result, 10);        	
       
  1177 		        if( temp >= 5 )
       
  1178 		        	{
       
  1179 		            result += (10 - temp);
       
  1180 		            }
       
  1181 		        else
       
  1182 		        	{
       
  1183 		            result -= temp; 
       
  1184 		        	}
       
  1185 		        	
       
  1186 		        if ( result >= KKilometerToMeters )
       
  1187 	            	{
       
  1188 	            	aLastodometerValue = result;
       
  1189 	            	TReal distanceInKm = aLastodometerValue / KKilometerToMeters;
       
  1190 	                Math::Round(temp, distanceInKm, 1);
       
  1191 	                distanceInKm = temp;
       
  1192 	                TBuf<KBlidLBItemMaxLen> temp;        
       
  1193 	                temp.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1194 	                iOdometerDistance->Des().Copy( temp );
       
  1195 	            	}
       
  1196 	            else
       
  1197 	            	{
       
  1198 	            	iOdometerDistance->Des().Zero();
       
  1199 	                iOdometerDistance->Des().AppendNum( result );
       
  1200 	            	}				
       
  1201             	}
       
  1202         	}
       
  1203         }
       
  1204     else
       
  1205     	{
       
  1206     	TReal32 distanceImperial = aLastodometerValue*KMetreToFoot;
       
  1207             
       
  1208     	if ( distanceImperial >= KMileToFeets ) 
       
  1209         	{
       
  1210         	distanceImperial /= KMileToFeets;
       
  1211         	Math::Round(temp, distanceImperial, 1);
       
  1212         	distanceImperial = temp;
       
  1213         	TBuf<KBlidLBItemMaxLen> tempstring;
       
  1214             tempstring.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1215             iOdometerDistance->Des().Copy( tempstring );
       
  1216         	}
       
  1217     	else
       
  1218     		{                
       
  1219             if ( BlidUtils::TRealToTInt(
       
  1220                      distanceImperial, result) != KErrNone )
       
  1221             	{
       
  1222                 iOdometerDistance->Des().Copy( *iDataBlank );
       
  1223                 }
       
  1224             else
       
  1225             	{
       
  1226             	Math::Mod(temp, result, 10);        	
       
  1227 	            if( temp >= 5 )
       
  1228 	                {
       
  1229 	                result += (10 - temp);
       
  1230 	                }
       
  1231 	            else
       
  1232 	                {
       
  1233 	                result -= temp; 
       
  1234 	                }
       
  1235 	                
       
  1236 	            if ( result >= KMileToFeets )
       
  1237 	            	{
       
  1238 	            	distanceImperial = result;
       
  1239 	            	distanceImperial /= KMileToFeets;
       
  1240 	            	Math::Round(temp, distanceImperial, 1);
       
  1241 	            	distanceImperial = temp;
       
  1242 	            	TBuf<KBlidLBItemMaxLen> temp;
       
  1243 	                temp.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1244 	                iOdometerDistance->Des().Copy( temp );
       
  1245 	            	}
       
  1246 	            else
       
  1247 	            	{
       
  1248 	            	iOdometerDistance->Des().Zero();
       
  1249 	                iOdometerDistance->Des().AppendNum( result );
       
  1250 	            	}                	
       
  1251                 }
       
  1252             }
       
  1253     	}
       
  1254         		
       
  1255 	}
       
  1256 
       
  1257 // ----------------------------------------------------------------------------
       
  1258 // CHtkTripMeterControl::OdometerFormat
       
  1259 // ----------------------------------------------------------------------------
       
  1260 //
       
  1261 void CHtkTripMeterControl::OdometerFormat( TDes& aOdometerString )
       
  1262     {
       
  1263     aOdometerString.Zero();
       
  1264    
       
  1265     if ( iLocation->IsTotalDistanceTravelled() &&
       
  1266     	 iLocation->IsGPSDataAvailable() )
       
  1267         {
       
  1268         TReal32 totalDistance;
       
  1269         iLocation->GetTotalDistance( totalDistance );
       
  1270         totalDistance = totalDistance + iLastodometerValue;
       
  1271         iOdoValueToStore = totalDistance;
       
  1272         TInt result(0);        
       
  1273         if ( BlidUtils::TRealToTInt(totalDistance, result) != KErrNone )
       
  1274             {
       
  1275             aOdometerString = *iDataBlank;
       
  1276             iOdometerDistance->Des().Copy( aOdometerString );
       
  1277             return;
       
  1278             }
       
  1279         totalDistance = result;        
       
  1280         TReal temp;
       
  1281                         
       
  1282         // metric or imperial
       
  1283         if ( iSettingsModel->UnitOfMeasurement() == EUnitsMetric )
       
  1284             {
       
  1285  
       
  1286             if ( totalDistance >= KKilometerToMeters )
       
  1287                 {
       
  1288                 TReal distanceInKm = totalDistance / KKilometerToMeters;
       
  1289                 Math::Round(temp, distanceInKm, 1);
       
  1290                 distanceInKm = temp;
       
  1291                 TBuf<KBlidLBItemMaxLen> temp;        
       
  1292                 temp.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1293                 iOdometerDistance->Des().Copy( temp );
       
  1294                 }
       
  1295         	else
       
  1296             	{
       
  1297                 if ( BlidUtils::TRealToTInt(totalDistance, result) != KErrNone )
       
  1298                 	{
       
  1299                     aOdometerString = *iDataBlank;
       
  1300                     iOdometerDistance->Des().Copy( aOdometerString );
       
  1301                 	}
       
  1302                 else
       
  1303                 	{
       
  1304                 	Math::Mod(temp, result, 10);        	
       
  1305 			        if( temp >= 5 )
       
  1306 			        	{
       
  1307 			            result += (10 - temp);
       
  1308 			            }
       
  1309 			        else
       
  1310 			        	{
       
  1311 			            result -= temp; 
       
  1312 			        	}
       
  1313 			        	
       
  1314 			        if ( result >= KKilometerToMeters )
       
  1315 		            	{
       
  1316 		            	totalDistance = result;
       
  1317 		            	TReal distanceInKm = totalDistance / KKilometerToMeters;
       
  1318 		                Math::Round(temp, distanceInKm, 1);
       
  1319 		                distanceInKm = temp;
       
  1320 		                TBuf<KBlidLBItemMaxLen> temp;        
       
  1321 		                temp.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1322 		                iOdometerDistance->Des().Copy( temp );
       
  1323 		            	}
       
  1324 		            else
       
  1325 		            	{
       
  1326 		            	iOdometerDistance->Des().Zero();
       
  1327 		                iOdometerDistance->Des().AppendNum( result );
       
  1328 		            	}				
       
  1329                 	}
       
  1330             	}
       
  1331             }
       
  1332         else
       
  1333         	{
       
  1334         	TReal32 distanceImperial = totalDistance*KMetreToFoot;
       
  1335                 
       
  1336         	if ( distanceImperial >= KMileToFeets ) 
       
  1337             	{
       
  1338             	distanceImperial /= KMileToFeets;
       
  1339             	Math::Round(temp, distanceImperial, 1);
       
  1340             	distanceImperial = temp;
       
  1341             	TBuf<KBlidLBItemMaxLen> tempstring;
       
  1342                 tempstring.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1343                 iOdometerDistance->Des().Copy( tempstring );
       
  1344             	}
       
  1345         	else
       
  1346         		{                
       
  1347                 if ( BlidUtils::TRealToTInt(
       
  1348                          distanceImperial, result) != KErrNone )
       
  1349                 	{
       
  1350                     aOdometerString = *iDataBlank;
       
  1351                     iOdometerDistance->Des().Copy( aOdometerString );
       
  1352                     }
       
  1353                 else
       
  1354                 	{
       
  1355                 	Math::Mod(temp, result, 10);        	
       
  1356 		            if( temp >= 5 )
       
  1357 		                {
       
  1358 		                result += (10 - temp);
       
  1359 		                }
       
  1360 		            else
       
  1361 		                {
       
  1362 		                result -= temp; 
       
  1363 		                }
       
  1364 		                
       
  1365 		            if ( result >= KMileToFeets )
       
  1366 		            	{
       
  1367 		            	distanceImperial = result;
       
  1368 		            	distanceImperial /= KMileToFeets;
       
  1369 		            	Math::Round(temp, distanceImperial, 1);
       
  1370 		            	distanceImperial = temp;
       
  1371 		            	TBuf<KBlidLBItemMaxLen> temp;
       
  1372 		                temp.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1373 		                iOdometerDistance->Des().Copy( temp );
       
  1374 		            	}
       
  1375 		            else
       
  1376 		            	{
       
  1377 		            	iOdometerDistance->Des().Zero();
       
  1378 		                iOdometerDistance->Des().AppendNum( result );
       
  1379 		            	}                	
       
  1380                     }
       
  1381                 }
       
  1382         	}
       
  1383         }
       
  1384     }
       
  1385 
       
  1386 // ----------------------------------------------------------------------------
       
  1387 // CHtkTripMeterControl::TotalTimeFormat
       
  1388 // ----------------------------------------------------------------------------
       
  1389 //
       
  1390 void CHtkTripMeterControl::TotalTimeFormat( TDes& aTotalTimeString )
       
  1391     {
       
  1392     TInt error(0);
       
  1393     TTimeIntervalSeconds timeInterval;
       
  1394     TTime totaltime;
       
  1395     iLocation->GetTotalTime(timeInterval);
       
  1396     TBuf<KBlidLBItemMaxLen> totaltimeString;
       
  1397     if ( BlidUtils::FormatTimeToString( totaltimeString, (TReal)(timeInterval.Int()))
       
  1398          != KErrNone )
       
  1399         {
       
  1400         return;
       
  1401         }
       
  1402     totaltime.Set( totaltimeString );
       
  1403     TRAP( error, totaltime.FormatL( 
       
  1404           aTotalTimeString , *iDurationFormatLong ));
       
  1405           
       
  1406     if(error!=KErrNone)
       
  1407 	    {
       
  1408 	    CEikonEnv::Static()->HandleError( error );
       
  1409 	    aTotalTimeString .Zero();
       
  1410 	    }
       
  1411     }
       
  1412 
       
  1413 // ----------------------------------------------------------------------------
       
  1414 // CHtkTripMeterControl::TripmeterFormatL
       
  1415 // ----------------------------------------------------------------------------
       
  1416 //
       
  1417 void CHtkTripMeterControl::TripmeterFormatL( TDes& aTripmeterString )
       
  1418     {
       
  1419     aTripmeterString.Zero();
       
  1420     TInt result(0);
       
  1421     TReal temp;    
       
  1422   
       
  1423 	if ( iLocation->IsTripDistanceTravelled()  &&
       
  1424     	 iLocation->IsGPSDataAvailable() )
       
  1425 	    {
       
  1426 	    TReal32 distanceTravelled;
       
  1427 	    iLocation->GetTripDistance(distanceTravelled);        
       
  1428 	    // metric or imperial
       
  1429 	    if ( iSettingsModel->UnitOfMeasurement() == EUnitsMetric )
       
  1430 	        {
       
  1431 	        iSpeedFormatVisual->SetTextL( *iSpeedFormatKmph );
       
  1432 	        if ( BlidUtils::TRealToTInt(distanceTravelled, result) != KErrNone )
       
  1433 	        	{
       
  1434 	            aTripmeterString = *iDataBlank;
       
  1435 	            iTripDistance->Des().Copy( aTripmeterString );
       
  1436 	            }
       
  1437 	        else
       
  1438 	        	{            	
       
  1439 	        	distanceTravelled = result;
       
  1440 	                
       
  1441 	            if ( distanceTravelled >= KKilometerToMeters )
       
  1442 	            	{
       
  1443 	            	TReal distanceInKm = distanceTravelled / KKilometerToMeters;
       
  1444 	            	Math::Round(temp, distanceInKm, 1);
       
  1445 	            	distanceInKm = temp;
       
  1446 	                TBuf<KBlidLBItemMaxLen> tempstring;        
       
  1447 	                tempstring.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1448 	            	iTripDistance->Des().Copy( tempstring );
       
  1449 	               	}
       
  1450 	            else
       
  1451 	            	{	            	
       
  1452 	            	Math::Mod(temp, distanceTravelled, 10);        	
       
  1453 			        if( temp >= 5 )
       
  1454 			        	{
       
  1455 			            distanceTravelled += (10 - temp);
       
  1456 			            }
       
  1457 			        else
       
  1458 			        	{
       
  1459 			            distanceTravelled -= temp; 
       
  1460 			        	}
       
  1461 			        
       
  1462 			        if(distanceTravelled >= KKilometerToMeters )
       
  1463 			        	{
       
  1464 			        	TReal distanceInKm = distanceTravelled / KKilometerToMeters;
       
  1465 		            	Math::Round(temp, distanceInKm, 1);
       
  1466 	                	distanceInKm = temp;
       
  1467 		                TBuf<KBlidLBItemMaxLen> tempstring;   
       
  1468 		                tempstring.Format( KDistanceFormat, Abs(distanceInKm) );
       
  1469 		                iTripDistance->Des().Copy( tempstring );
       
  1470 			        	}
       
  1471 			        else
       
  1472 			        	{
       
  1473 		                iTripDistance->Des().Zero();
       
  1474 		                iTripDistance->Des().AppendNum( distanceTravelled );
       
  1475 			        	}
       
  1476 	            	}
       
  1477 	            }
       
  1478 	        }
       
  1479 	    else
       
  1480 	    	{
       
  1481 	    	iSpeedFormatVisual->SetTextL( *iSpeedFormatMph );
       
  1482 	        TReal32 distanceImperial = distanceTravelled*KMetreToFoot; 
       
  1483 	        
       
  1484 	        if ( distanceImperial >= KMileToFeets ) 
       
  1485 	        	{
       
  1486 	        	distanceImperial /= KMileToFeets;
       
  1487 	        	Math::Round(temp, distanceImperial, 1);
       
  1488 	        	distanceImperial = temp;
       
  1489 	        	TBuf<KBlidLBItemMaxLen> temp;
       
  1490 	            temp.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1491                 iTripDistance->Des().Copy( temp );
       
  1492 	        	}
       
  1493 	        else
       
  1494 	        	{
       
  1495 	        	if ( BlidUtils::TRealToTInt(
       
  1496 	                 distanceImperial, result) != KErrNone )
       
  1497 	            	{
       
  1498 	                aTripmeterString = *iDataBlank;
       
  1499 	                iTripDistance->Des().Copy( aTripmeterString );
       
  1500 	                }
       
  1501 	            else
       
  1502 	            	{
       
  1503 	            	Math::Mod(temp, distanceImperial, 10);        	
       
  1504 		            if( temp >= 5 )
       
  1505 		                {
       
  1506 		                distanceImperial += (10 - temp);
       
  1507 		                }
       
  1508 		            else
       
  1509 		                {
       
  1510 		                distanceImperial -= temp; 
       
  1511 		                }
       
  1512 		                
       
  1513 		            if ( distanceImperial >= KMileToFeets )
       
  1514 		            	{
       
  1515 		            	distanceImperial /= KMileToFeets;
       
  1516 		            	Math::Round(temp, distanceImperial, 1);
       
  1517 		            	distanceImperial = temp;
       
  1518 		            	TBuf<KBlidLBItemMaxLen> temp;
       
  1519 		                temp.Format( KDistanceFormat, Abs(distanceImperial) );
       
  1520 		                iTripDistance->Des().Copy( temp );
       
  1521 		            	}
       
  1522 		            else
       
  1523 		            	{
       
  1524 		                iTripDistance->Des().Zero();
       
  1525 		                iTripDistance->Des().AppendNum( distanceImperial );
       
  1526 		            	}
       
  1527 	                }
       
  1528 	        	}            
       
  1529 	        }
       
  1530    		}    
       
  1531    }
       
  1532 
       
  1533 // ----------------------------------------------------------------------------
       
  1534 // CHtkTripMeterControl::SaveOdometerValue
       
  1535 // ----------------------------------------------------------------------------
       
  1536 //
       
  1537 void CHtkTripMeterControl::SaveOdometerValue( )
       
  1538 	{
       
  1539 	if( iRepository )
       
  1540 		{
       
  1541 	    iRepository->Set(KBlidOdometerSettingsValue, iOdoValueToStore);		
       
  1542 		}
       
  1543 	}
       
  1544 	
       
  1545 // ----------------------------------------------------------------------------
       
  1546 // CHtkTripMeterControl::ResetOdometerDistanceL
       
  1547 // ----------------------------------------------------------------------------
       
  1548 //
       
  1549 void CHtkTripMeterControl::ResetOdometerDistanceL( )
       
  1550 	{
       
  1551 	if( iOdometerDistance )
       
  1552 		{
       
  1553 		iOdometerDistance->Des().Zero();
       
  1554 		iOdometerDistance->Des().AppendNum( 0 );
       
  1555 		iOdoMeter->SetTextL( *iOdometerDistance );			
       
  1556 		}
       
  1557 	iLocation->ResetOdometerValue();		
       
  1558 	iOdoValueToStore = 0.0;
       
  1559 	iLastodometerValue = 0.0;	
       
  1560 	}
       
  1561 
       
  1562 // ----------------------------------------------------------------------------
       
  1563 // CHtkTripMeterControl::SaveOdometerValue
       
  1564 // ----------------------------------------------------------------------------
       
  1565 //
       
  1566 void CHtkTripMeterControl::ChangeTripFocus( TBool aSTripDimmed )
       
  1567 	{
       
  1568 	iSTripDimmed = aSTripDimmed;
       
  1569 	if( iTripLayout )
       
  1570 		{
       
  1571 		TAlfTimedValue opecity;
       
  1572 		opecity.SetTarget( 0.3, 0 );
       
  1573 		iTripLayout->SetOpacity( opecity );				
       
  1574 		}
       
  1575 	}
       
  1576 	
       
  1577 // ----------------------------------------------------------------------------
       
  1578 // CHtkTripMeterControl::SaveOdometerValue
       
  1579 // ----------------------------------------------------------------------------
       
  1580 //
       
  1581 void CHtkTripMeterControl::ReChangeTripFocus( )
       
  1582 	{
       
  1583 	iSTripDimmed = EFalse;
       
  1584 	if( iTripLayout )
       
  1585 		{
       
  1586 		TAlfTimedValue opecity;
       
  1587 		opecity.SetTarget( 1.0, 0 );
       
  1588 		iTripLayout->SetOpacity( opecity );				
       
  1589 		}
       
  1590 	}
       
  1591 
       
  1592 // ----------------------------------------------------------------------------
       
  1593 // CHtkTripMeterControl::UpdateLayoutL
       
  1594 // ----------------------------------------------------------------------------
       
  1595 //
       
  1596 void CHtkTripMeterControl::UpdateLayoutL( )
       
  1597 	{
       
  1598 	// Call all the root label setanchor and adjust the new LAyout rectangle.
       
  1599 	CalculateRects();	
       
  1600 	SetAnchors();
       
  1601 	}
       
  1602 
       
  1603 // ----------------------------------------------------------------------------
       
  1604 // CHtkTripMeterControl::UpdateLayoutL
       
  1605 // ----------------------------------------------------------------------------
       
  1606 //
       
  1607 void CHtkTripMeterControl::CalculateRects( )
       
  1608 	{
       
  1609 	TAknLayoutRect mainPane;
       
  1610 	TAknLayoutRect mainBlid2Pane;
       
  1611 	TAknLayoutRect layoutWindow;
       
  1612 	TAknLayoutText textLayout;
       
  1613 	TRect mainRect;
       
  1614 	TRect mainBlidRect;
       
  1615 	TRect tripMeterRect;
       
  1616 	TRect valueRect;
       
  1617 	TInt variety;
       
  1618 	TInt mainvariety;
       
  1619 
       
  1620 	if( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1621 	    {
       
  1622 	    variety = 1;
       
  1623 	    mainvariety = 4;
       
  1624 	    }
       
  1625 	 else
       
  1626 	 	{
       
  1627 	 	variety = 0;
       
  1628 	    mainvariety = 0;
       
  1629 	 	}
       
  1630 	// 	
       
  1631     mainPane.LayoutRect( iView.ApplicationRect(),
       
  1632     							AknLayoutScalable_Apps::main_pane(mainvariety).LayoutLine() );
       
  1633     							
       
  1634 	mainRect = mainPane.Rect(); 
       
  1635 	
       
  1636     mainBlid2Pane.LayoutRect( mainRect,
       
  1637     							AknLayoutScalable_Apps::main_blid2_pane().LayoutLine() );
       
  1638     							
       
  1639 	mainBlidRect = mainBlid2Pane.Rect(); 							
       
  1640     																				   
       
  1641     layoutWindow.LayoutRect( mainBlidRect, 
       
  1642     							AknLayoutScalable_Apps::blid2_tripm_pane( 0 ).LayoutLine() );
       
  1643     							
       
  1644 	tripMeterRect =  layoutWindow.Rect();   							
       
  1645 	// Since the Hitchcock does draw at main pane, we take the reference to
       
  1646 	// Tripmeter(main) pane's.
       
  1647 	tripMeterRect.Move(tripMeterRect.iTl.iX,-tripMeterRect.iTl.iY);  							
       
  1648 	 	
       
  1649 	// Bg rect
       
  1650     layoutWindow.LayoutRect( tripMeterRect, 
       
  1651     							AknLayoutScalable_Apps::blid2_tripm_pane_g1( variety ).LayoutLine() );
       
  1652     							
       
  1653 	iBigTripRect =  layoutWindow.Rect();
       
  1654 	
       
  1655 	// Trip dial rect
       
  1656     layoutWindow.LayoutRect( tripMeterRect, 
       
  1657     							AknLayoutScalable_Apps::blid2_tripm_pane_g2( variety ).LayoutLine() );
       
  1658     							
       
  1659 	iTripDialRect =  layoutWindow.Rect();
       
  1660 
       
  1661 	// Since the LAF Rect for Dial is 90 degree wrt image, we calculate the rect for 90 degree rotation
       
  1662 	TAlfRealPoint topPoint = iTripDialRect.iTl;
       
  1663 	TAlfRealPoint bottomPoint = iTripDialRect.iBr;
       
  1664 	TReal32 topX 		= topPoint.iX;
       
  1665 	TReal32 topY  		= topPoint.iY;
       
  1666 	TReal32 bottomX 	= bottomPoint.iX;
       
  1667 	TReal32 bottomY  	= bottomPoint.iY;
       
  1668 	TReal32 wt			= bottomX - topX;
       
  1669 	TReal32 ht			= bottomY - topY;	
       
  1670 
       
  1671 	TReal32 tX 		= topX+(wt/2)-(ht/2);
       
  1672 	TReal32 tY  	= topY+(ht/2)-(wt/2);
       
  1673 	TReal32 bX		= topX+(wt/2)+(ht/2);
       
  1674 	TReal32 bY		= topY+(ht/2)+(wt/2);
       
  1675 
       
  1676 	iTripDialRect.SetRect( tX, tY, bX, bY );
       
  1677 	
       
  1678 	// Trip deck image rect
       
  1679     layoutWindow.LayoutRect( tripMeterRect, 
       
  1680     							AknLayoutScalable_Apps::blid2_tripm_pane_g3( variety ).LayoutLine() );
       
  1681     							
       
  1682 	iTripDeckRect =  layoutWindow.Rect();
       
  1683 
       
  1684 	// Odo meter image rect
       
  1685     layoutWindow.LayoutRect( tripMeterRect, 
       
  1686     							AknLayoutScalable_Apps::blid2_tripm_pane_g4( variety ).LayoutLine() );
       
  1687     							
       
  1688 	iOdoDeckRect =  layoutWindow.Rect();
       
  1689 
       
  1690 	// Trip meter text rect
       
  1691     textLayout.LayoutText( tripMeterRect, 
       
  1692     							AknLayoutScalable_Apps::blid2_tripm_pane_t1( variety ).LayoutLine() );
       
  1693     							
       
  1694 	iTripMeterRect =  textLayout.TextRect();
       
  1695 	
       
  1696 	// Odo meter text rect
       
  1697     textLayout.LayoutText( tripMeterRect, 
       
  1698     							AknLayoutScalable_Apps::blid2_tripm_pane_t2( variety ).LayoutLine() );
       
  1699     							
       
  1700 	iOdoMeterRect =  textLayout.TextRect();
       
  1701 	
       
  1702 	// Time text rect
       
  1703     textLayout.LayoutText( tripMeterRect, 
       
  1704     							AknLayoutScalable_Apps::blid2_tripm_pane_t3( variety ).LayoutLine() );
       
  1705     							
       
  1706 	iTripTimeRect =  textLayout.TextRect();
       
  1707 	
       
  1708 	// Speed Format text rect
       
  1709     textLayout.LayoutText( tripMeterRect, 
       
  1710     							AknLayoutScalable_Apps::blid2_tripm_pane_t3( variety ).LayoutLine() );
       
  1711     							
       
  1712 	iSpeedFormatRect =  textLayout.TextRect();
       
  1713 	// since we donot have the LAF for Speed Format, we calculate it based on Dial Layout
       
  1714 	iSpeedFormatRect.SetRect( topX, topY+ht/4, bottomX, topY+ht/3 );
       
  1715 
       
  1716 	// Clock image rect
       
  1717     layoutWindow.LayoutRect( tripMeterRect, 
       
  1718     							AknLayoutScalable_Apps::blid2_tripm_pane_g5( variety ).LayoutLine() );
       
  1719     							
       
  1720 	iClockImageRect =  layoutWindow.Rect();
       
  1721 
       
  1722 	// Speeds Value rect
       
  1723     layoutWindow.LayoutRect( tripMeterRect, 
       
  1724     							AknLayoutScalable_Apps::blid2_tripm_values_pane( variety ).LayoutLine() );
       
  1725     							
       
  1726 	valueRect =  layoutWindow.Rect();
       
  1727 	
       
  1728 	// Speed Value 1 rect
       
  1729     textLayout.LayoutText( valueRect, 
       
  1730     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t1( 0 ).LayoutLine() );
       
  1731     							
       
  1732 	iValueRect1 =  textLayout.TextRect();
       
  1733 	
       
  1734 	// Speed Value 2 rect
       
  1735     textLayout.LayoutText( valueRect, 
       
  1736     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t2( 0 ).LayoutLine() );
       
  1737     							
       
  1738 	iValueRect2 =  textLayout.TextRect();
       
  1739 	
       
  1740 	// Speed Value 3 rect
       
  1741     textLayout.LayoutText( valueRect, 
       
  1742     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t3( 0 ).LayoutLine() );
       
  1743     							
       
  1744 	iValueRect3 =  textLayout.TextRect();
       
  1745 	
       
  1746 	// Speed Value 4 rect
       
  1747     textLayout.LayoutText( valueRect, 
       
  1748     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t4( 0 ).LayoutLine() );
       
  1749     							
       
  1750 	iValueRect4 =  textLayout.TextRect();
       
  1751 	
       
  1752 	// Speed Value 5 rect
       
  1753     textLayout.LayoutText( valueRect, 
       
  1754     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t5( 0 ).LayoutLine() );
       
  1755     							
       
  1756 	iValueRect5 =  textLayout.TextRect();
       
  1757 	
       
  1758 	// Speed Value 6 rect
       
  1759     textLayout.LayoutText( valueRect, 
       
  1760     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t6( 0 ).LayoutLine() );
       
  1761     							
       
  1762 	iValueRect6 =  textLayout.TextRect();
       
  1763 	
       
  1764 	// Speed Value 7 rect
       
  1765     textLayout.LayoutText( valueRect, 
       
  1766     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t7( 0 ).LayoutLine() );
       
  1767     							
       
  1768 	iValueRect7 =  textLayout.TextRect();
       
  1769 	
       
  1770 	// Speed Value 8 rect
       
  1771     textLayout.LayoutText( valueRect, 
       
  1772     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t8( 0 ).LayoutLine() );
       
  1773     							
       
  1774 	iValueRect8 =  textLayout.TextRect();
       
  1775 	
       
  1776 	// Speed Value 9 rect
       
  1777     textLayout.LayoutText( valueRect, 
       
  1778     							AknLayoutScalable_Apps::blid2_tripm_values_pane_t9( 0 ).LayoutLine() );
       
  1779     							
       
  1780 	iValueRect9 =  textLayout.TextRect();
       
  1781 	
       
  1782 	// Signal Strength
       
  1783     layoutWindow.LayoutRect( tripMeterRect, 
       
  1784     							AknLayoutScalable_Apps::blid2_tripm_pane_g6( variety ).LayoutLine() );
       
  1785     							
       
  1786 	iSignalStrengthRect =  layoutWindow.Rect();
       
  1787 	
       
  1788 	
       
  1789 	}
       
  1790 
       
  1791 
       
  1792 // ----------------------------------------------------------------------------
       
  1793 // CHtkTripMeterControl::SetAnchors
       
  1794 // ----------------------------------------------------------------------------
       
  1795 //
       
  1796 void CHtkTripMeterControl::SetAnchors( )
       
  1797 	{	
       
  1798 	// Anchor for Big trip visual
       
  1799 	TAlfRealPoint topPoint( iBigTripRect.iTl );
       
  1800 	TAlfRealPoint bottomPoint( iBigTripRect.iBr );
       
  1801 	
       
  1802     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 0, 
       
  1803         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1804         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1805         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1806     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 0, 
       
  1807         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1808         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1809         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1810 	       
       
  1811 	// Anchor for trip box image visual
       
  1812 	topPoint =  iTripDeckRect.iTl;
       
  1813 	bottomPoint = iTripDeckRect.iBr;
       
  1814 	
       
  1815     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 1, 
       
  1816         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1817         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1818         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1819     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 1, 
       
  1820         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1821         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1822         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1823         
       
  1824 	// Anchor for tripmeter text visual
       
  1825 	topPoint =  iTripMeterRect.iTl;
       
  1826 	bottomPoint = iTripMeterRect.iBr;
       
  1827     
       
  1828     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 2, 
       
  1829         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1830         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1831         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1832     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 2, 
       
  1833         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1834         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1835         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1836         
       
  1837 	// Anchor for odometer box image visual
       
  1838 	topPoint =  iOdoDeckRect.iTl;
       
  1839 	bottomPoint = iOdoDeckRect.iBr;
       
  1840 	
       
  1841     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 3, 
       
  1842         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1843         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1844         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1845     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 3, 
       
  1846         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1847         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1848         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1849         
       
  1850 	// Anchor for odometer text visual
       
  1851 	topPoint =  iOdoMeterRect.iTl;
       
  1852 	bottomPoint = iOdoMeterRect.iBr;
       
  1853 	
       
  1854     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 4, 
       
  1855         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1856         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1857         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1858     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 4, 
       
  1859         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1860         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1861         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1862         
       
  1863 	// Anchor for Speed Format visual
       
  1864 	topPoint =  iSpeedFormatRect.iTl;
       
  1865 	bottomPoint = iSpeedFormatRect.iBr;
       
  1866 
       
  1867     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 5, 
       
  1868         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1869         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1870         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1871     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 5, 
       
  1872         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1873         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1874         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1875 
       
  1876     // Anchor for Speed format
       
  1877 	topPoint =  iTripDialRect.iTl;
       
  1878 	bottomPoint = iTripDialRect.iBr;
       
  1879 	
       
  1880     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 6, 
       
  1881         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1882         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1883         TAlfTimedPoint( topPoint.iX, topPoint.iY ) );
       
  1884     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 6, 
       
  1885         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1886         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1887         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) );
       
  1888         
       
  1889 	// Anchor for clock image visual
       
  1890 	topPoint =  iClockImageRect.iTl;
       
  1891 	bottomPoint = iClockImageRect.iBr;
       
  1892 	
       
  1893     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 7, 
       
  1894         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1895         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1896         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1897     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 7, 
       
  1898         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1899         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1900         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1901         
       
  1902 	// Anchor for trip time text visual
       
  1903 	topPoint =  iTripTimeRect.iTl;
       
  1904 	bottomPoint = iTripTimeRect.iBr;
       
  1905 	   
       
  1906     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 8, 
       
  1907         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1908         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1909         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1910     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 8, 
       
  1911         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1912         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1913         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1914 
       
  1915     // Anchors for iMileVisuals (8 to 16)
       
  1916         
       
  1917 	// Anchor for Mile Value 1
       
  1918 	topPoint =  iValueRect1.iTl;
       
  1919 	bottomPoint = iValueRect1.iBr;
       
  1920 
       
  1921     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 9, 
       
  1922         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1923         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1924         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1925     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 9, 
       
  1926         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1927         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1928         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1929         
       
  1930 	// Anchor for Mile Value 2
       
  1931 	topPoint =  iValueRect2.iTl;
       
  1932 	bottomPoint = iValueRect2.iBr;
       
  1933 
       
  1934     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 10, 
       
  1935         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1936         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1937         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1938     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 10, 
       
  1939         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1940         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1941         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1942         
       
  1943 	// Anchor for Mile Value 3
       
  1944 	topPoint =  iValueRect3.iTl;
       
  1945 	bottomPoint = iValueRect3.iBr;
       
  1946 
       
  1947     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 11, 
       
  1948         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1949         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1950         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1951     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 11, 
       
  1952         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1953         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1954         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1955         
       
  1956 	// Anchor for Mile Value 4
       
  1957 	topPoint =  iValueRect4.iTl;
       
  1958 	bottomPoint = iValueRect4.iBr;
       
  1959 
       
  1960     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 12, 
       
  1961         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1962         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1963         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1964     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 12, 
       
  1965         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1966         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1967         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1968         
       
  1969 	// Anchor for Mile Value 5
       
  1970 	topPoint =  iValueRect5.iTl;
       
  1971 	bottomPoint = iValueRect5.iBr;
       
  1972 
       
  1973     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 13, 
       
  1974         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1975         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1976         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1977     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 13, 
       
  1978         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1979         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1980         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1981         
       
  1982 	// Anchor for Mile Value 6
       
  1983 	topPoint =  iValueRect6.iTl;
       
  1984 	bottomPoint = iValueRect6.iBr;
       
  1985 
       
  1986     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 14, 
       
  1987         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1988         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1989         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  1990     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 14, 
       
  1991         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1992         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1993         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  1994         
       
  1995 	// Anchor for Mile Value 7
       
  1996 	topPoint =  iValueRect7.iTl;
       
  1997 	bottomPoint = iValueRect7.iBr;
       
  1998 
       
  1999     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 15, 
       
  2000         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2001         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2002         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  2003     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 15, 
       
  2004         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2005         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2006         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  2007         
       
  2008 	// Anchor for Mile Value 8
       
  2009 	topPoint =  iValueRect8.iTl;
       
  2010 	bottomPoint = iValueRect8.iBr;
       
  2011 
       
  2012     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 16, 
       
  2013         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2014         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2015         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  2016     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 16, 
       
  2017         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2018         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2019         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  2020         
       
  2021 	// Anchor for Mile Value 9
       
  2022 	topPoint =  iValueRect9.iTl;
       
  2023 	bottomPoint = iValueRect9.iBr;
       
  2024 
       
  2025     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 17, 
       
  2026         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2027         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2028         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  2029     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 17, 
       
  2030         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2031         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2032         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  2033     
       
  2034     // Anchor for Satellite Status image visual   (18) 
       
  2035 	topPoint =  iSignalStrengthRect.iTl;
       
  2036 	bottomPoint = iSignalStrengthRect.iBr;
       
  2037 
       
  2038     iTripLayout->SetAnchor( EAlfAnchorTopLeft, 18,   
       
  2039         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,  
       
  2040         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2041         TAlfTimedPoint( topPoint.iX, topPoint.iY  ) );
       
  2042     iTripLayout->SetAnchor( EAlfAnchorBottomRight, 18, 
       
  2043         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  2044         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  2045         TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY  ) );
       
  2046 
       
  2047 	}
       
  2048 	
       
  2049 // ----------------------------------------------------------------------------
       
  2050 // CHtkTripMeterControl::CreateSignalTexturesL
       
  2051 // ----------------------------------------------------------------------------
       
  2052 //
       
  2053 void CHtkTripMeterControl::CreateSignalTexturesL( )
       
  2054 	{
       
  2055 	MAlfBitmapProvider* provider = NULL;	
       
  2056 	
       
  2057     // then create the bitmap provider
       
  2058     iView.ImageLoaderUtils()->SetSize( iSignalStrengthRect.Size() ); 
       
  2059     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal01, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2060     												 			iView.ImagePathName(),        // mif file name with path.
       
  2061     												 			EMbmBlidQgn_graf_blid_sat_signal_01, // bitmap id defiened in mbg file
       
  2062     												 			EMbmBlidQgn_graf_blid_sat_signal_01_mask ); // bitmap mask id defiened in mbg file
       
  2063     												 
       
  2064 	    												 
       
  2065 	// now using that bitmap provider create the texture.
       
  2066 	CAlfTexture & thumbTexture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2067                                                                 provider,
       
  2068                                                                 EAlfTextureFlagDefault );
       
  2069 	iSignalTextures.Append( &thumbTexture1 );// At 0
       
  2070 	
       
  2071 
       
  2072     // then create the bitmap provider
       
  2073     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal02, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2074     												 			iView.ImagePathName(),        // mif file name with path.
       
  2075     												 			EMbmBlidQgn_graf_blid_sat_signal_02, // bitmap id defiened in mbg file
       
  2076     												 			EMbmBlidQgn_graf_blid_sat_signal_02_mask ); // bitmap mask id defiened in mbg file
       
  2077     												 
       
  2078 	    												 
       
  2079 	// now using that bitmap provider create the texture.
       
  2080 	CAlfTexture & thumbTexture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2081                                                                 provider,
       
  2082                                                                 EAlfTextureFlagDefault ); 	
       
  2083 
       
  2084 	iSignalTextures.Append( &thumbTexture2 );// At 1			                                                                  
       
  2085     // then create the bitmap provider
       
  2086     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal03, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2087     												 			iView.ImagePathName(),        // mif file name with path.
       
  2088     												 			EMbmBlidQgn_graf_blid_sat_signal_03, // bitmap id defiened in mbg file
       
  2089     												 			EMbmBlidQgn_graf_blid_sat_signal_03_mask ); // bitmap mask id defiened in mbg file
       
  2090     												 
       
  2091 	    												 
       
  2092 	// now using that bitmap provider create the texture.
       
  2093 	CAlfTexture & thumbTexture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2094                                                                 provider,
       
  2095                                                                 EAlfTextureFlagDefault );
       
  2096 
       
  2097 	iSignalTextures.Append( &thumbTexture3 );// At 2  
       
  2098 	
       
  2099     // then create the bitmap provider
       
  2100     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal04, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2101     												 			iView.ImagePathName(),        // mif file name with path.
       
  2102     												 			EMbmBlidQgn_graf_blid_sat_signal_04, // bitmap id defiened in mbg file
       
  2103     												 			EMbmBlidQgn_graf_blid_sat_signal_04_mask ); // bitmap mask id defiened in mbg file
       
  2104     												 
       
  2105 	    												 
       
  2106 	// now using that bitmap provider create the texture.
       
  2107 	CAlfTexture & thumbTexture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2108                                                                 provider,
       
  2109                                                                 EAlfTextureFlagDefault );
       
  2110 
       
  2111 	iSignalTextures.Append( &thumbTexture4 );// At 3  
       
  2112 	
       
  2113     // then create the bitmap provider
       
  2114     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal05, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2115     												 			iView.ImagePathName(),        // mif file name with path.
       
  2116     												 			EMbmBlidQgn_graf_blid_sat_signal_05, // bitmap id defiened in mbg file
       
  2117     												 			EMbmBlidQgn_graf_blid_sat_signal_05_mask ); // bitmap mask id defiened in mbg file
       
  2118     												 
       
  2119 	    												 
       
  2120 	// now using that bitmap provider create the texture.
       
  2121 	CAlfTexture & thumbTexture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2122                                                                 provider,
       
  2123                                                                 EAlfTextureFlagDefault );
       
  2124 
       
  2125 	iSignalTextures.Append( &thumbTexture5 );// At 4
       
  2126 	}
       
  2127 	
       
  2128 // ----------------------------------------------------------------------------
       
  2129 // CHtkTripMeterControl::CreatePopupImgTextureL
       
  2130 // ----------------------------------------------------------------------------
       
  2131 //
       
  2132 void CHtkTripMeterControl::CreatePopupImgTextureL( )
       
  2133 	{
       
  2134 	MAlfBitmapProvider* provider = NULL;			
       
  2135     provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidUnavail, // svg icon skin constant id defiened in Aknsconstant.h file
       
  2136     												 iView.ImagePathName(),        // mif file name with path.
       
  2137     												 EMbmBlidQgn_graf_blid_unavail, // bitmap id defiened in mbg file
       
  2138     												 EMbmBlidQgn_graf_blid_unavail_mask ); // bitmap mask id defiened in mbg file
       
  2139 	
       
  2140 	// now using that bitmap provider create the texture.
       
  2141 	CAlfTexture & thumbTexture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId,
       
  2142 	                                                                provider,
       
  2143 	                                                                EAlfTextureFlagDefault ); 
       
  2144 		                                                                
       
  2145 	iPopupImgTexture = &thumbTexture;
       
  2146 	}	
       
  2147 		
       
  2148 //End Of File
       
  2149