graphicsapitest/graphicssvs/bitgdi/src/T_DataFbsBitGc.cpp
changeset 111 29ddb8a72f0e
parent 110 7f25ef56562d
child 113 f3c3c510a760
child 152 9f1c3fea0f87
equal deleted inserted replaced
110:7f25ef56562d 111:29ddb8a72f0e
     1 /*
       
     2 * Copyright (c) 2005-2009 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:
       
    15 *
       
    16 */
       
    17 #include <e32cmn.h>
       
    18 #include <e32property.h>
       
    19 #include "T_DataFbsBitGc.h"
       
    20 #include "T_GraphicsUtil.h"
       
    21 
       
    22 /*@{*/
       
    23 ///	Commands
       
    24 _LIT(KCmdNewL,						"NewL");
       
    25 _LIT(KCmdDestructor,				"~");
       
    26 _LIT(KCmdActivate,					"Activate");
       
    27 _LIT(KCmdActivateNoJustAutoUpdate,	"ActivateNoJustAutoUpdate");
       
    28 _LIT(KCmdAlphaBlendBitmaps,			"AlphaBlendBitmaps");
       
    29 _LIT(KCmdDisown,                    "disown");
       
    30 _LIT(KCmdDrawPolyLineNoEndPoint,    "DrawPolyLineNoEndPoint");
       
    31 
       
    32 _LIT(KCmdCancelClipping,            "CancelClipping");
       
    33 _LIT(KCmdCopySettings,              "CopySettings");
       
    34 _LIT(KCmdBitBlt,                    "BitBlt");
       
    35 
       
    36 _LIT(KCmdDrawText,					"DrawText");
       
    37 _LIT(KCmdDrawTextVertical,			"DrawTextVertical");
       
    38 _LIT(KCmdUpdateJustification,		"UpdateJustification");
       
    39 _LIT(KCmdUpdateJustificationVertical,"UpdateJustificationVertical");
       
    40 
       
    41 _LIT(KCmdFadeArea,                   "FadeArea");
       
    42 _LIT(KCmdIsBrushPatternUsed,         "IsBrushPatternUsed");
       
    43 _LIT(KCmdIsFontUsed,                 "IsFontUsed");
       
    44 _LIT(KCmdOrientationsAvailable,      "OrientationsAvailable");
       
    45 _LIT(KCmdRectDrawnTo,                "RectDrawnTo");
       
    46 _LIT(KCmdResized,                    "Resized");
       
    47 _LIT(KCmdSetDitherOrigin,            "SetDitherOrigin");
       
    48 _LIT(KCmdSetFadeMode,                "SetFadeMode");
       
    49 _LIT(KCmdSetFadingParameters,        "SetFadingParameters");
       
    50 _LIT(KCmdSetOrientation,             "SetOrientation");
       
    51 _LIT(KCmdSetShadowMode,              "SetShadowMode");
       
    52 _LIT(KCmdSetUserDisplayMode,         "SetUserDisplayMode");
       
    53 _LIT(KCmdShadowArea,                 "ShadowArea");
       
    54 _LIT(KCmdUseBrushPattern,            "UseBrushPattern");
       
    55 _LIT(KCmdUseFont,                    "UseFont");
       
    56 _LIT(KCmdUseFontNoDuplicate,         "UseFontNoDuplicate");
       
    57 _LIT(KCmdGetAvailableOrientation,    "GetAvailableOrientation");
       
    58 _LIT(KCmdPromptMessage,				 "PromptMessage");
       
    59 ///	Fields
       
    60 _LIT(KFldAlphaBmp,					"alphabmp");
       
    61 _LIT(KFldAlphaPt,					"alphapt");
       
    62 _LIT(KFldDestPt,					"destpt");
       
    63 _LIT(KFldDevice,					"device");
       
    64 _LIT(KFldSrcBmp1,					"srcbmp1");
       
    65 _LIT(KFldSrcBmp2,					"srcbmp2");
       
    66 _LIT(KFldSrcPt,						"srcpt");
       
    67 _LIT(KFldSrcRect,					"srcrect");
       
    68 _LIT(KFldNumPoints,					"numpoints");
       
    69 _LIT(KFldPointList,					"pointlist");
       
    70 
       
    71 _LIT(KFldFbsBitGc,                  "fbsBitGc");
       
    72 _LIT(KFldPoint,                     "point");
       
    73 
       
    74 _LIT(KFldRect,						"rect");
       
    75 _LIT(KFldTextAlign,					"textalign");
       
    76 _LIT(KFldText,						"text");
       
    77 _LIT(KFldLeftMargin,				"leftmargin");
       
    78 _LIT(KFldBaselineOffset,			"baselineoffset");
       
    79 _LIT(KFldTextWidth,					"textwidth");
       
    80 _LIT(KFldUp,						"up");
       
    81 _LIT(KFldParam,						"param");
       
    82 
       
    83 _LIT(KFldRegion,					"region");
       
    84 _LIT(KFldFadeMode,                  "fademode");
       
    85 _LIT(KFldBlackMap,					"blackmap");
       
    86 _LIT(KFldWhiteMap,					"whitemap");
       
    87 _LIT(KFldGraphicsOrientation,       "orientation");
       
    88 _LIT(KFldShadowMode,                "shadowmode");
       
    89 _LIT(KFldDisplayMode,               "displaymode");
       
    90 _LIT(KFldHandle,                    "handle");
       
    91 _LIT(KFldFont,                      "font");
       
    92 _LIT(KFldBitmap,					"bitmap");
       
    93 _LIT(KFldUseHandle,					"usehandle");
       
    94 _LIT(KFldPromptText,				"message");
       
    95 _LIT(KFldExpectedKey,				"keyCode");
       
    96 
       
    97 _LIT(KFldExpect,                    "expect");
       
    98 _LIT(KFormatFieldNumber,	        "Orientation_%d=%d");
       
    99 ///	Logging
       
   100 _LIT(KLogError,						"Error=%d");
       
   101 _LIT(KLogMissingParameter,			"Missing parameter '%S'");
       
   102 _LIT(KLogNotExpectedValue,			"Not expected value,get %d, expectd %d");
       
   103 /*@}*/
       
   104 _LIT(KPromptProcess,				"t_prompt.exe");
       
   105 
       
   106 
       
   107 /**
       
   108 * Two phase constructor
       
   109 */
       
   110 CT_DataFbsBitGc* CT_DataFbsBitGc::NewL()
       
   111 	{
       
   112 	CT_DataFbsBitGc*	ret=new (ELeave) CT_DataFbsBitGc();
       
   113 	CleanupStack::PushL(ret);
       
   114 	ret->ConstructL();
       
   115 	CleanupStack::Pop(ret);
       
   116 	return ret;
       
   117 	}
       
   118 
       
   119 /**
       
   120 * Protected constructor. First phase construction
       
   121 */
       
   122 CT_DataFbsBitGc::CT_DataFbsBitGc()
       
   123 :	CT_DataBitmapContext()
       
   124 ,	iFbsBitGc(NULL)
       
   125 	{
       
   126 	}
       
   127 
       
   128 /**
       
   129 * Protected second phase construction
       
   130 */
       
   131 void CT_DataFbsBitGc::ConstructL()
       
   132 	{
       
   133 	
       
   134 	}
       
   135 
       
   136 /**
       
   137 * Destructor.
       
   138 */
       
   139 CT_DataFbsBitGc::~CT_DataFbsBitGc()
       
   140 	{
       
   141 
       
   142 	DestroyData();
       
   143 	}
       
   144 
       
   145 void CT_DataFbsBitGc::SetObjectL(TAny* aAny)
       
   146 	{
       
   147 	DestroyData();
       
   148 	iFbsBitGc	= static_cast<CFbsBitGc*> (aAny);
       
   149 	}
       
   150 
       
   151 void CT_DataFbsBitGc::DisownObjectL()
       
   152 	{
       
   153 	iFbsBitGc = NULL;
       
   154 	}
       
   155 
       
   156 void CT_DataFbsBitGc::DestroyData()
       
   157 	{
       
   158 	delete iFbsBitGc;
       
   159 	iFbsBitGc=NULL;
       
   160 	}
       
   161 
       
   162 /**
       
   163 * Return a pointer to the object that the data wraps
       
   164 *
       
   165 * @return pointer to the object that the data wraps
       
   166 */
       
   167 TAny* CT_DataFbsBitGc::GetObject()
       
   168 	{
       
   169 	return iFbsBitGc;
       
   170 	}
       
   171 
       
   172 //	CT_DataBitmapContext implementation
       
   173 CBitmapContext* CT_DataFbsBitGc::GetBitmapContext() const
       
   174 	{
       
   175 	return iFbsBitGc;
       
   176 	}
       
   177 
       
   178 //	CT_DataGraphicsContext implementation
       
   179 CGraphicsContext* CT_DataFbsBitGc::GetGraphicsContext() const
       
   180 	{
       
   181 	return iFbsBitGc;
       
   182 	}
       
   183 
       
   184 /**
       
   185 * Process a command read from the ini file
       
   186 *
       
   187 * @param aCommand			the command to process
       
   188 * @param aSection			the entry in the ini file requiring the command to be processed
       
   189 * @param aAsyncErrorIndex	index of command. used for async calls
       
   190 *
       
   191 * @return ETrue if the command is processed
       
   192 */
       
   193 TBool CT_DataFbsBitGc::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
   194 	{
       
   195 	/* Another work package will complete the implement of this */
       
   196 	TBool	ret = ETrue;
       
   197 
       
   198 	if ( aCommand==KCmdNewL )
       
   199 		{
       
   200 		DoCmdNewL();
       
   201 		}
       
   202 	else if ( aCommand==KCmdDestructor )
       
   203 		{
       
   204 		DoCmdDestructor();
       
   205 		}
       
   206 	else if ( aCommand==KCmdActivate )
       
   207 		{
       
   208 		DoCmdActivateL(aSection);
       
   209 		}
       
   210 	else if ( aCommand == KCmdDisown )
       
   211 		{
       
   212 		DisownObjectL();
       
   213 		}
       
   214 	else if ( aCommand==KCmdActivateNoJustAutoUpdate )
       
   215 		{
       
   216 		DoCmdActivateNoJustAutoUpdateL(aSection);
       
   217 		}
       
   218 	else if ( aCommand==KCmdAlphaBlendBitmaps )
       
   219 		{
       
   220 		if ( !DoCmdAlphaBlendBitmapsL(aSection) )
       
   221 			{
       
   222 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   223 			}
       
   224 		}
       
   225 	else if ( aCommand==KCmdDrawPolyLineNoEndPoint )
       
   226 		{
       
   227 		DoCmdDrawPolyLineNoEndPointL(aSection);
       
   228 		}
       
   229 	else if ( aCommand==KCmdCancelClipping)
       
   230 		{
       
   231 		DoCmdCancelClipping(aSection);
       
   232 		}
       
   233 	else if ( aCommand==KCmdCopySettings)
       
   234 		{
       
   235 		DoCmdCopySettingsL(aSection);
       
   236 		}
       
   237 	else if ( aCommand==KCmdBitBlt)
       
   238 		{
       
   239 		if(!DoCmdBitBltL(aSection))
       
   240 			{
       
   241 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   242 			}
       
   243 		}
       
   244 	else if(aCommand==KCmdDrawText)
       
   245 		{
       
   246 		DoCmdDrawTextL(aSection);
       
   247 		}
       
   248 	else if(aCommand==KCmdDrawTextVertical)
       
   249 		{
       
   250 		DoCmdDrawTextVerticalL(aSection);
       
   251 		}
       
   252 	else if(aCommand==KCmdUpdateJustification)
       
   253 		{
       
   254 		DoCmdUpdateJustificationL(aSection);
       
   255 		}
       
   256 	else if(aCommand==KCmdUpdateJustificationVertical)
       
   257 		{
       
   258 		DoCmdUpdateJustificationVerticalL(aSection);
       
   259 		}
       
   260 	else if(aCommand==KCmdFadeArea)
       
   261 		{
       
   262 		DoCmdFadeArea(aSection);
       
   263 		}
       
   264 	else if(aCommand==KCmdIsBrushPatternUsed)
       
   265 		{
       
   266 		DoCmdIsBrushPatternUsed(aSection);
       
   267 		}
       
   268 	else if(aCommand==KCmdIsFontUsed)
       
   269 		{
       
   270 		DoCmdIsFontUsed(aSection);
       
   271 		}
       
   272 	else if(aCommand==KCmdOrientationsAvailable)
       
   273 		{
       
   274 		DoCmdOrientationsAvailable(aSection);
       
   275 		}
       
   276 	else if(aCommand==KCmdRectDrawnTo)
       
   277 		{
       
   278 		DoCmdRectDrawnTo(aSection);
       
   279 		}
       
   280 	else if(aCommand==KCmdResized)
       
   281 		{
       
   282 		DoCmdResized(aSection);
       
   283 		}
       
   284 	else if(aCommand==KCmdSetDitherOrigin)
       
   285 		{
       
   286 		DoCmdSetDitherOrigin(aSection);
       
   287 		}
       
   288 	else if(aCommand==KCmdSetFadeMode)
       
   289 		{
       
   290 		DoCmdSetFadeMode(aSection);
       
   291 		}
       
   292 	else if(aCommand==KCmdSetFadingParameters)
       
   293 		{
       
   294 		if(!DoCmdSetFadingParameters(aSection))
       
   295 			{
       
   296 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   297 			}
       
   298 		}
       
   299 	else if(aCommand==KCmdSetOrientation)
       
   300 		{
       
   301 		DoCmdSetOrientation(aSection);
       
   302 		}
       
   303 	else if(aCommand==KCmdSetShadowMode)
       
   304 		{
       
   305 		DoCmdSetShadowMode(aSection);
       
   306 		}
       
   307 	else if(aCommand==KCmdSetUserDisplayMode)
       
   308 		{
       
   309 		DoCmdSetUserDisplayMode(aSection);
       
   310 		}
       
   311 	else if(aCommand==KCmdShadowArea)
       
   312 		{
       
   313 		DoCmdShadowArea(aSection);
       
   314 		}
       
   315 	else if(aCommand==KCmdUseBrushPattern)
       
   316 		{
       
   317 		DoCmdUseBrushPatternL(aSection);
       
   318 		}
       
   319 	else if(aCommand==KCmdUseFont)
       
   320 		{
       
   321 		DoCmdUseFontL(aSection);
       
   322 		}
       
   323 	else if(aCommand==KCmdUseFontNoDuplicate)
       
   324 		{
       
   325 		DoCmdUseFontNoDuplicateL(aSection);
       
   326 		}
       
   327 	else if(aCommand==KCmdPromptMessage)
       
   328 		{
       
   329 		DoCmdPromptMessageL(aSection);
       
   330 		}
       
   331 	else
       
   332 		{
       
   333 		ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   334 		}
       
   335 
       
   336 	return ret;
       
   337 	}
       
   338 
       
   339 void CT_DataFbsBitGc::DoCmdNewL()
       
   340 	{
       
   341 	DestroyData();
       
   342 
       
   343 	INFO_PRINTF1(_L("execute CFbsBitGc::NewL"));
       
   344 	TRAPD( err, iFbsBitGc = CFbsBitGc::NewL() );
       
   345 	if ( err!=KErrNone )
       
   346 		{
       
   347 		ERR_PRINTF2(KLogError, err);
       
   348 		SetError(err);
       
   349 		}
       
   350 	}
       
   351 
       
   352 void CT_DataFbsBitGc::DoCmdDestructor()
       
   353 	{
       
   354 	DestroyData();
       
   355 	}
       
   356 
       
   357 void CT_DataFbsBitGc::DoCmdActivateL(const TDesC& aSection)
       
   358 	{
       
   359 	CFbsDevice*	device=NULL;
       
   360 	if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
       
   361 		{
       
   362 		ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
       
   363 		SetBlockResult(EFail);
       
   364 		}
       
   365 	else
       
   366 		{
       
   367 		// Execute command and log parameters
       
   368 		INFO_PRINTF1(_L("execute Activate(CFbsDevice*)"));
       
   369 		iFbsBitGc->Activate(device);
       
   370 		}
       
   371 	}
       
   372 
       
   373 void CT_DataFbsBitGc::DoCmdActivateNoJustAutoUpdateL(const TDesC& aSection)
       
   374 	{
       
   375 	CFbsDevice*	device=NULL;
       
   376 	if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
       
   377 		{
       
   378 		ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
       
   379 		SetBlockResult(EFail);
       
   380 		}
       
   381 	else
       
   382 		{
       
   383 		// Execute command and log parameters
       
   384 		INFO_PRINTF1(_L("execute ActivateNoJustAutoUpdate(CFbsDevice*)"));
       
   385 		iFbsBitGc->ActivateNoJustAutoUpdate(device);
       
   386 		}
       
   387 	}
       
   388 
       
   389 TBool CT_DataFbsBitGc::DoCmdAlphaBlendBitmapsL(const TDesC& aSection)
       
   390 	{
       
   391 	CFbsBitmap*	fbsBitmap1=NULL;
       
   392 	TBool		ret=CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp1, fbsBitmap1);
       
   393 	if ( ret )
       
   394 		{
       
   395 		TBool		dataOk=ETrue;
       
   396 
       
   397 		CFbsBitmap*	fbsBitmap2=NULL;
       
   398 		if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp2, fbsBitmap2) )
       
   399 			{
       
   400 			dataOk=EFalse;
       
   401 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcBmp2());
       
   402 			SetBlockResult(EFail);
       
   403 			}
       
   404 
       
   405 		CFbsBitmap*	alphaBitmap=NULL;
       
   406 		if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldAlphaBmp, alphaBitmap) )
       
   407 			{
       
   408 			dataOk=EFalse;
       
   409 			ERR_PRINTF2(KLogMissingParameter, &KFldAlphaBmp());
       
   410 			SetBlockResult(EFail);
       
   411 			}
       
   412 
       
   413 		TPoint	destinationPoint;
       
   414 		if ( !GetPointFromConfig(aSection, KFldDestPt, destinationPoint) )
       
   415 			{
       
   416 			dataOk=EFalse;
       
   417 			ERR_PRINTF2(KLogMissingParameter, &KFldDestPt());
       
   418 			SetBlockResult(EFail);
       
   419 			}
       
   420 
       
   421 		TRect	sourceRect;
       
   422 		if ( !GetRectFromConfig(aSection, KFldSrcRect, sourceRect) )
       
   423 			{
       
   424 			dataOk=EFalse;
       
   425 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcRect());
       
   426 			SetBlockResult(EFail);
       
   427 			}
       
   428 
       
   429 		TPoint	sourcePoint;
       
   430 		if ( !GetPointFromConfig(aSection, KFldSrcPt, sourcePoint) )
       
   431 			{
       
   432 			dataOk=EFalse;
       
   433 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcPt());
       
   434 			SetBlockResult(EFail);
       
   435 			}
       
   436 
       
   437 		TPoint	alphaPoint;
       
   438 		if ( !GetPointFromConfig(aSection, KFldAlphaPt, alphaPoint) )
       
   439 			{
       
   440 			dataOk=EFalse;
       
   441 			ERR_PRINTF2(KLogMissingParameter, &KFldAlphaPt());
       
   442 			SetBlockResult(EFail);
       
   443 			}
       
   444 
       
   445 		if ( dataOk )
       
   446 			{
       
   447 			INFO_PRINTF1(_L("execute AlphaBlendBitmaps(const TPoint&,const CFbsBitmap*,const CFbsBitmap*,const TRect&,const TPoint&,const CFbsBitmap*,const TPoint&"));
       
   448 			TInt	err=iFbsBitGc->AlphaBlendBitmaps(destinationPoint, fbsBitmap1, fbsBitmap2, sourceRect, sourcePoint, alphaBitmap, alphaPoint);
       
   449 			if ( err!=KErrNone )
       
   450 				{
       
   451 				ERR_PRINTF2(KLogError, err);
       
   452 				SetError(err);
       
   453 				}
       
   454 			}
       
   455 		}
       
   456 
       
   457 	return ret;
       
   458 	}
       
   459 
       
   460 void CT_DataFbsBitGc::DoCmdDrawPolyLineNoEndPointL(const TDesC& aSection)
       
   461 	{
       
   462 	TInt	datNumPoints;
       
   463 	if ( GetIntFromConfig(aSection, KFldNumPoints, datNumPoints) )
       
   464 		{
       
   465 		TPoint*	points=new (ELeave) TPoint[datNumPoints];
       
   466 		
       
   467 		if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, points) )
       
   468 			{
       
   469 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   470 			SetBlockResult(EFail);
       
   471 			}
       
   472 		else
       
   473 			{
       
   474 			// Execute command and log parameters
       
   475 			INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(TPoint*, TInt)"));
       
   476 			iFbsBitGc->DrawPolyLineNoEndPoint(points, datNumPoints);
       
   477 			}
       
   478 		delete [] points;
       
   479 		}
       
   480 	else
       
   481 		{
       
   482 		CArrayFix<TPoint>*	points=new (ELeave) CArrayFixFlat<TPoint>(1);
       
   483 		CleanupStack::PushL(points);
       
   484 		TBool	hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
       
   485 
       
   486 		if ( !hasPointList )
       
   487 			{
       
   488 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   489 			SetBlockResult(EFail);
       
   490 			}
       
   491 		else
       
   492 			{
       
   493 			// Execute command and log parameters
       
   494 			INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(CArrayFix<TPoint>*)"));
       
   495 			iFbsBitGc->DrawPolyLineNoEndPoint(points);
       
   496 			}
       
   497 		CleanupStack::PopAndDestroy(points);
       
   498 		}
       
   499 	}
       
   500 
       
   501 void CT_DataFbsBitGc::DoCmdCancelClipping(const TDesC& /*aSection*/)
       
   502 	{
       
   503 	INFO_PRINTF1(_L("execute CancelClipping()"));
       
   504 	iFbsBitGc->CancelClipping();
       
   505 	}
       
   506 
       
   507 void CT_DataFbsBitGc::DoCmdCopySettingsL(const TDesC& aSection)
       
   508 	{
       
   509 	CFbsBitGc* fbsBitGc=NULL;
       
   510 
       
   511 	if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
       
   512 		{
       
   513 		ERR_PRINTF2(KLogMissingParameter, &KFldFbsBitGc());
       
   514 		SetBlockResult(EFail);
       
   515 		}
       
   516 	else
       
   517 		{
       
   518 		// Execute command and log parameters
       
   519 		INFO_PRINTF1(_L("execute CopySettings(CFbsBitGc&)"));
       
   520 		iFbsBitGc->CopySettings(*fbsBitGc);
       
   521 		}
       
   522 	}
       
   523 
       
   524 TBool CT_DataFbsBitGc::DoCmdBitBltL(const TDesC& aSection)
       
   525 	{
       
   526 	TBool ret=ETrue;
       
   527 	CFbsBitGc* fbsBitGc=NULL;
       
   528 	
       
   529 	if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
       
   530 		{
       
   531 		ret=EFalse;
       
   532 		}
       
   533 	else
       
   534 		{
       
   535 		// Execute command and log parameters
       
   536 		TPoint	point;
       
   537 		if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
   538 			{
       
   539 			ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   540 			SetBlockResult(EFail);
       
   541 			//Case failed, needn't execute other step.
       
   542 			return ret;
       
   543 			}
       
   544 		
       
   545 		TRect	sourceRect;
       
   546 		if(!GetRectFromConfig(aSection, KFldSrcRect, sourceRect))
       
   547 			{
       
   548 			INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&)"));
       
   549 			iFbsBitGc->BitBlt(point,*fbsBitGc);
       
   550 			}
       
   551 		else
       
   552 			{
       
   553 			INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&,const TRect &)"));
       
   554 			iFbsBitGc->BitBlt(point,*fbsBitGc,sourceRect);
       
   555 			}
       
   556 		}
       
   557 	
       
   558 	return ret;
       
   559 	}
       
   560 
       
   561 void CT_DataFbsBitGc::DoCmdDrawTextL(const TDesC& aSection)
       
   562 	{
       
   563 	TRect rect;
       
   564 	TInt baselineOffset=0;
       
   565 	TPtrC text;
       
   566 	TInt datTextWidth;
       
   567 	CGraphicsContext::TTextParameters* param=NULL;
       
   568 	
       
   569 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   570 		{
       
   571 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   572 		SetBlockResult(EFail);
       
   573 		return;
       
   574 		}
       
   575 	
       
   576 	if (GetRectFromConfig(aSection, KFldRect, rect) )
       
   577 		{
       
   578 			if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
       
   579 				{
       
   580 				TInt datMargin=0;
       
   581 				CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
       
   582 				CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,textAlign);
       
   583 				if(!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
       
   584 					{
       
   585 					INFO_PRINTF1(_L("Using the default value aMargin=0"));
       
   586 					}
       
   587 				
       
   588 				if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
       
   589 					{
       
   590 					if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   591 						{
       
   592 						INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TTextParameters *,const TRect &,TInt,TInt,TTextAlign,TInt)"));
       
   593 						iFbsBitGc->DrawText(text, param, rect, baselineOffset, datTextWidth, textAlign, datMargin);
       
   594 						}
       
   595 					else
       
   596 						{
       
   597 						INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TInt,TTextAlign,TInt)"));
       
   598 						iFbsBitGc->DrawText(text, rect, baselineOffset, datTextWidth, textAlign, datMargin);
       
   599 						}
       
   600 
       
   601 					}
       
   602 				else
       
   603 					{
       
   604 					if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   605 						{
       
   606 						INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TTextParameters *,const TRect &,TInt,TTextAlign,TInt)"));
       
   607 						iFbsBitGc->DrawText(text, param, rect, baselineOffset, textAlign, datMargin);
       
   608 						}
       
   609 					else
       
   610 						{
       
   611 						INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TTextAlign,TInt)"));
       
   612 						iFbsBitGc->DrawText(text, rect, baselineOffset, textAlign, datMargin);
       
   613 						}
       
   614 					}
       
   615 				}
       
   616 			else
       
   617 				{
       
   618 				if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   619 					{
       
   620 					INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TTextParameters *,const TRect&)"));
       
   621 					iFbsBitGc->DrawText(text, param, rect);
       
   622 					}
       
   623 				else
       
   624 					{
       
   625 					INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TRect&)"));
       
   626 					iFbsBitGc->DrawText(text, rect);
       
   627 					}
       
   628 				}
       
   629 			}
       
   630 	else
       
   631 		{
       
   632 		TPoint	point;
       
   633 		if(!GetPointFromConfig(aSection, KFldPoint, point))
       
   634 			{
       
   635 			if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   636 				{
       
   637 				INFO_PRINTF1(_L("execute DrawText(const TDesC&, const TTextParameters *)"));
       
   638 				iFbsBitGc->DrawText(text,param);
       
   639 				}
       
   640 			else
       
   641 				{
       
   642 				INFO_PRINTF1(_L("execute DrawText(const TDesC&)"));
       
   643 				iFbsBitGc->DrawText(text);
       
   644 				}
       
   645 			}
       
   646 		else
       
   647 			{
       
   648 			if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   649 				{
       
   650 				INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TTextParameters *,const TPoint&)"));
       
   651 	            iFbsBitGc->DrawText(text,param,point);	
       
   652 				}
       
   653 			else
       
   654 				{
       
   655 				INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TPoint&)"));
       
   656 	            iFbsBitGc->DrawText(text,point);	
       
   657 				}
       
   658 			}
       
   659 		}
       
   660 	delete param;
       
   661 	}
       
   662 
       
   663 void CT_DataFbsBitGc::DoCmdDrawTextVerticalL(const TDesC& aSection)
       
   664 	{
       
   665 	TPtrC	text;
       
   666 	TInt datTextWidth;
       
   667 	TBool	up=EFalse;
       
   668 	CGraphicsContext::TTextParameters* param=NULL;
       
   669 	
       
   670 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   671 		{
       
   672 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   673 		SetBlockResult(EFail);
       
   674 		return;
       
   675 		}
       
   676 	
       
   677 	if(	!GetBoolFromConfig(aSection, KFldUp, up))
       
   678 		{
       
   679 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
       
   680 		SetBlockResult(EFail);
       
   681 		return;
       
   682 		}
       
   683 	
       
   684 	TRect	rect;
       
   685 	TInt baselineOffset=0;
       
   686 	if (GetRectFromConfig(aSection, KFldRect, rect) )
       
   687 		{
       
   688 		if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
       
   689 			{
       
   690 			TInt datMargin=0;
       
   691 			CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
       
   692 			CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,textAlign);
       
   693 			if(!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
       
   694 				{
       
   695 				INFO_PRINTF1(_L("Using the default value aMargin=0"));
       
   696 				}
       
   697 			
       
   698 			if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
       
   699 				{
       
   700 				if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   701 					{
       
   702 					INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TTextParameters *,const TRect &,TInt,TInt,TBool,TTextAlign,TInt)"));
       
   703 					iFbsBitGc->DrawTextVertical(text,param,rect,baselineOffset,datTextWidth,up,textAlign,datMargin);					
       
   704 					}
       
   705 				else
       
   706 					{
       
   707 					INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TInt,TBool,TTextAlign,TInt)"));
       
   708 					iFbsBitGc->DrawTextVertical(text,rect,baselineOffset,datTextWidth,up,textAlign,datMargin);					
       
   709 					}
       
   710 				}
       
   711 			else 
       
   712 				{
       
   713 				if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   714 					{
       
   715 					INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TTextParameters *,const TRect &,TInt,TBool,TTextAlign,TInt)"));
       
   716 					iFbsBitGc->DrawTextVertical(text,param,rect,baselineOffset,up,textAlign,datMargin);
       
   717 					}
       
   718 				else
       
   719 					{
       
   720 					INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TBool,TTextAlign,TInt)"));
       
   721 					iFbsBitGc->DrawTextVertical(text,rect,baselineOffset,up,textAlign,datMargin);					
       
   722 					}
       
   723 				}
       
   724 			}
       
   725 		else
       
   726 			{
       
   727 			if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   728 				{
       
   729 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TTextParameters *,const TRect &,TBool)"));
       
   730 				iFbsBitGc->DrawTextVertical(text,param,rect,up);
       
   731 				}
       
   732 			else
       
   733 				{
       
   734 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TBool)"));
       
   735 				iFbsBitGc->DrawTextVertical(text,rect,up);				
       
   736 				}
       
   737 			}
       
   738 		}
       
   739 	else
       
   740 		{
       
   741 		TPoint	point;
       
   742 		if(!GetPointFromConfig(aSection, KFldPoint, point))
       
   743 			{
       
   744 			if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   745 				{
       
   746 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TTextParameters *,TBool)"));
       
   747 				iFbsBitGc->DrawTextVertical(text,param,up);
       
   748 				}
       
   749 			else
       
   750 				{
       
   751 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,TBool)"));
       
   752 				iFbsBitGc->DrawTextVertical(text,up);				
       
   753 				}
       
   754 			}
       
   755 		else
       
   756 			{
       
   757 			if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   758 				{
       
   759 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TTextParameters *,const TPoint &,TBool)"));
       
   760 				iFbsBitGc->DrawTextVertical(text,param,point,up);
       
   761 				}
       
   762 			else
       
   763 				{
       
   764 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TPoint &,TBool)"));
       
   765 				iFbsBitGc->DrawTextVertical(text,point,up);
       
   766 				}
       
   767 			}
       
   768 		}
       
   769 	delete param;
       
   770 	}
       
   771 
       
   772 void CT_DataFbsBitGc::DoCmdUpdateJustificationL(const TDesC& aSection)
       
   773 	{
       
   774 	TPtrC text;
       
   775 	CGraphicsContext::TTextParameters* param=NULL;
       
   776 	if ( !GetStringFromConfig(aSection, KFldText(), text) )
       
   777 		{
       
   778 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   779 		SetBlockResult(EFail);
       
   780 		return;
       
   781 		}
       
   782 	if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   783 		{
       
   784 		INFO_PRINTF1(_L("execute UpdateJustification(const TDesC &,const TTextParameters *)"));
       
   785 		iFbsBitGc->UpdateJustification(text,param);		
       
   786 		}
       
   787 	else
       
   788 		{
       
   789 		INFO_PRINTF1(_L("execute UpdateJustification(const TDesC &)"));
       
   790 		iFbsBitGc->UpdateJustification(text);		
       
   791 		}
       
   792 	delete param;
       
   793 	}
       
   794 
       
   795 void CT_DataFbsBitGc::DoCmdUpdateJustificationVerticalL(const TDesC& aSection)
       
   796 	{
       
   797 	TPtrC	text;
       
   798 	TBool	up=EFalse;
       
   799 	CGraphicsContext::TTextParameters *param=NULL;
       
   800 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   801 		{
       
   802 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   803 		SetBlockResult(EFail);
       
   804 		return;
       
   805 		}
       
   806 	
       
   807 	if(	!GetBoolFromConfig(aSection, KFldUp, up))
       
   808 		{
       
   809 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
       
   810 		SetBlockResult(EFail);
       
   811 		return;
       
   812 		}
       
   813 	
       
   814 	if(CT_GraphicsUtil::GetTextParametersL(*this,aSection,KFldParam,param))
       
   815 		{
       
   816 		INFO_PRINTF1(_L("execute UpdateJustificationVertical(const TDesC &,const TTextParameters *,TBool)"));
       
   817 		iFbsBitGc->UpdateJustificationVertical(text,param,up);			
       
   818 		}
       
   819 	else
       
   820 		{
       
   821 		INFO_PRINTF1(_L("execute UpdateJustificationVertical(const TDesC &,TBool)"));
       
   822 		iFbsBitGc->UpdateJustificationVertical(text,up);		
       
   823 		}
       
   824 	delete param;
       
   825 	}
       
   826 
       
   827 void CT_DataFbsBitGc::DoCmdFadeArea(const TDesC& aSection)
       
   828 	{
       
   829 	RRegion reg;
       
   830 	if(GetRegionFromConfig(aSection,KFldRegion,reg))
       
   831 		{
       
   832 		INFO_PRINTF1(_L("execute FadeArea(const TRegion *)"));
       
   833 		iFbsBitGc->FadeArea(&reg);
       
   834 		}
       
   835 	else
       
   836 		{
       
   837 		INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
       
   838 		INFO_PRINTF1(_L("execute FadeArea(NULL)"));
       
   839 		iFbsBitGc->FadeArea(NULL);
       
   840 		}
       
   841 	}
       
   842 
       
   843 void CT_DataFbsBitGc::DoCmdIsBrushPatternUsed(const TDesC& aSection)
       
   844 	{
       
   845 	INFO_PRINTF1(_L("execute IsBrushPatternUsed()"));
       
   846 	TBool bUsed=iFbsBitGc->IsBrushPatternUsed();
       
   847 	
       
   848 	TBool expect;
       
   849 	if(GetBoolFromConfig(aSection,KFldExpect,expect))
       
   850 		{
       
   851 		if(expect!=bUsed)
       
   852 			{
       
   853 			ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
       
   854 			SetBlockResult(EFail);
       
   855 			}
       
   856 		}
       
   857 	}
       
   858 
       
   859 void CT_DataFbsBitGc::DoCmdIsFontUsed(const TDesC& aSection)
       
   860 	{
       
   861 	INFO_PRINTF1(_L("execute IsFontUsed()"));
       
   862 	TBool bUsed=iFbsBitGc->IsFontUsed();
       
   863 		
       
   864 	TBool expect;
       
   865 	if(GetBoolFromConfig(aSection,KFldExpect,expect))
       
   866 		{
       
   867 		if(expect!=bUsed)
       
   868 			{
       
   869 			ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
       
   870 			SetBlockResult(EFail);
       
   871 			}
       
   872 		}
       
   873 	}
       
   874 
       
   875 void CT_DataFbsBitGc::DoCmdOrientationsAvailable(const TDesC& /*aSection*/)
       
   876 	{
       
   877 	INFO_PRINTF1(_L("execute OrientationsAvailable(TBool aOrientation[4])"));
       
   878 
       
   879 	//iGraphicsOrientation defined in CDataWrapperBase
       
   880 	iFbsBitGc->OrientationsAvailable(iGraphicsOrientation);
       
   881 	
       
   882 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
       
   883 	
       
   884 	for(TInt i=0;i<4;i++)
       
   885 		{
       
   886 		tempStore.Format(KFormatFieldNumber, i+1,iGraphicsOrientation[i]);
       
   887 		INFO_PRINTF1(KFormatFieldNumber);
       
   888 		}
       
   889 	}
       
   890 
       
   891 void CT_DataFbsBitGc::DoCmdRectDrawnTo(const TDesC& aSection)
       
   892 	{
       
   893 	TRect	rect;
       
   894 	if(GetRectFromConfig(aSection, KFldRect, rect))
       
   895 		{
       
   896 		INFO_PRINTF1(_L("execute RectDrawnTo(TRect&)"));
       
   897 		iFbsBitGc->RectDrawnTo(rect);
       
   898 		}
       
   899 	else
       
   900 		{
       
   901 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
       
   902 		SetBlockResult(EFail);
       
   903 		}
       
   904 
       
   905 	}
       
   906 
       
   907 void CT_DataFbsBitGc::DoCmdResized(const TDesC& /*aSection*/)
       
   908 	{
       
   909 	INFO_PRINTF1(_L("execute Resized()"));
       
   910 	iFbsBitGc->Resized();
       
   911 	
       
   912 	}
       
   913 
       
   914 void CT_DataFbsBitGc::DoCmdSetDitherOrigin(const TDesC& aSection)
       
   915 	{
       
   916 	TPoint	point;
       
   917 	if (GetPointFromConfig(aSection, KFldPoint, point))
       
   918 		{
       
   919 		INFO_PRINTF1(_L("execute SetDitherOrigin(const TPoint &)"));
       
   920 		iFbsBitGc->SetDitherOrigin(point);
       
   921 		}
       
   922 	else
       
   923 		{
       
   924 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   925 		SetBlockResult(EFail);
       
   926 		}
       
   927 	}
       
   928 
       
   929 void CT_DataFbsBitGc::DoCmdSetFadeMode(const TDesC& aSection)
       
   930 	{
       
   931 	TBool fade;
       
   932 	if(GetBoolFromConfig(aSection,KFldFadeMode,fade))
       
   933 		{
       
   934 		INFO_PRINTF1(_L("execute SetFadeMode(TBool)"));
       
   935 		iFbsBitGc->SetFadeMode(fade);
       
   936 		}
       
   937 	else
       
   938 		{
       
   939 		INFO_PRINTF1(_L("execute SetFadeMode(TBool aFadeMode=EFalse)"));
       
   940 		iFbsBitGc->SetFadeMode();
       
   941 		}
       
   942 	}
       
   943 
       
   944 TBool CT_DataFbsBitGc::DoCmdSetFadingParameters(const TDesC& aSection)
       
   945 	{
       
   946 	TInt blackmap=0;
       
   947 	TInt whitemap=255;
       
   948 	if(GetIntFromConfig(aSection,KFldWhiteMap,whitemap))
       
   949 		{
       
   950 		//let base class handle this
       
   951 		return EFalse;
       
   952 		}
       
   953 	else
       
   954 		{
       
   955 		if(GetBoolFromConfig(aSection,KFldBlackMap,blackmap))
       
   956 			{
       
   957 			INFO_PRINTF1(_L("execute SetFadingParameters(TUint8)"));
       
   958 			iFbsBitGc->SetFadingParameters(blackmap);
       
   959 			}
       
   960 		else
       
   961 			{
       
   962 			INFO_PRINTF1(_L("execute SetFadingParameters(TUint8 aBlackMap=0)"));
       
   963 			iFbsBitGc->SetFadingParameters();
       
   964 			}
       
   965 		}
       
   966 	return ETrue;
       
   967 	}
       
   968 
       
   969 void CT_DataFbsBitGc::DoCmdSetOrientation(const TDesC& aSection)
       
   970 	{
       
   971 	CFbsBitGc::TGraphicsOrientation orientation;
       
   972 	TBool ret=EFalse;
       
   973 	if(CT_GraphicsUtil::GetGraphicsOrientation(*this,aSection,KFldGraphicsOrientation,orientation))
       
   974 		{
       
   975 		INFO_PRINTF1(_L("execute SetOrientation(TGraphicsOrientation)"));
       
   976 		ret=iFbsBitGc->SetOrientation(orientation);
       
   977 		if(ret!=iGraphicsOrientation[orientation])
       
   978 			{
       
   979 			INFO_PRINTF1(_L("SetOrientation and OrientationsAvailable return values are not match!"));
       
   980 			SetBlockResult(EFail);
       
   981 			}
       
   982 		}
       
   983 	else
       
   984 		{
       
   985 		ERR_PRINTF2(KLogMissingParameter, &KFldGraphicsOrientation());
       
   986 		SetBlockResult(EFail);
       
   987 		}
       
   988 	}
       
   989 
       
   990 void CT_DataFbsBitGc::DoCmdSetShadowMode(const TDesC& aSection)
       
   991 	{
       
   992 	TBool mode;
       
   993 	if(GetBoolFromConfig(aSection,KFldShadowMode,mode))
       
   994 		{
       
   995 		INFO_PRINTF1(_L("execute SetShadowMode(TBool)"));
       
   996 		iFbsBitGc->SetShadowMode(mode);
       
   997 		}
       
   998 	else
       
   999 		{
       
  1000 		INFO_PRINTF1(_L("execute SetShadowMode(TBool aShadowMode=EFalse)"));
       
  1001 		iFbsBitGc->SetShadowMode();
       
  1002 		}
       
  1003 	}
       
  1004 
       
  1005 void CT_DataFbsBitGc::DoCmdSetUserDisplayMode(const TDesC& aSection)
       
  1006 	{
       
  1007 	TDisplayMode mode;
       
  1008 	if(CT_GraphicsUtil::ReadDisplayMode(*this,aSection,KFldDisplayMode,mode))
       
  1009 		{
       
  1010 		INFO_PRINTF1(_L("execute SetUserDisplayMode(TDisplayMode)"));
       
  1011 		iFbsBitGc->SetUserDisplayMode(mode);
       
  1012 		}
       
  1013 	else
       
  1014 		{
       
  1015 		ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode());
       
  1016 		SetBlockResult(EFail);
       
  1017 		}
       
  1018 	}
       
  1019 
       
  1020 void CT_DataFbsBitGc::DoCmdShadowArea(const TDesC& aSection)
       
  1021 	{
       
  1022 	RRegion reg;
       
  1023 	if(GetRegionFromConfig(aSection,KFldRegion,reg))
       
  1024 		{
       
  1025 		INFO_PRINTF1(_L("execute ShadowArea(const TRegion *)"));
       
  1026 		iFbsBitGc->ShadowArea(&reg);
       
  1027 		}
       
  1028 	else
       
  1029 		{
       
  1030 		INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
       
  1031 		INFO_PRINTF1(_L("execute ShadowArea(NULL)"));
       
  1032 		iFbsBitGc->ShadowArea(NULL);
       
  1033 		}
       
  1034 	}
       
  1035 
       
  1036 void CT_DataFbsBitGc::DoCmdUseBrushPatternL(const TDesC& aSection)
       
  1037 	{
       
  1038 	TInt handle;
       
  1039 	if(GetIntFromConfig(aSection,KFldHandle,handle))
       
  1040 		{
       
  1041 		INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the specified handle."));
       
  1042 		TInt err=iFbsBitGc->UseBrushPattern(handle);
       
  1043 		if(KErrNone!=err)
       
  1044 			{
       
  1045 			ERR_PRINTF2(KLogError, err);
       
  1046 			SetError(err);
       
  1047 			}
       
  1048 		}
       
  1049 	else
       
  1050 		{
       
  1051 		CFbsBitmap*	bitmap=NULL;
       
  1052 		if (CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap))
       
  1053 			{
       
  1054 			TBool usehandle;
       
  1055 			if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
       
  1056 				{
       
  1057 				INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the bitmap object's handle."));
       
  1058 				TInt err=iFbsBitGc->UseBrushPattern(bitmap->Handle());
       
  1059 				if(KErrNone!=err)
       
  1060 					{
       
  1061 					ERR_PRINTF2(KLogError, err);
       
  1062 					SetError(err);
       
  1063 					}
       
  1064 				}
       
  1065 			else
       
  1066 				{
       
  1067 				INFO_PRINTF1(_L("execute UseBrushPattern(CFbsBitmap*)"));
       
  1068 				iFbsBitGc->UseBrushPattern(bitmap);
       
  1069 				}
       
  1070 			}
       
  1071 		else
       
  1072 			{
       
  1073 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldBitmap());
       
  1074 			SetBlockResult(EFail);
       
  1075 			}
       
  1076 		}
       
  1077 	}
       
  1078 
       
  1079 void CT_DataFbsBitGc::DoCmdUseFontL(const TDesC& aSection)
       
  1080 	{
       
  1081 	TInt handle;
       
  1082 	if(GetIntFromConfig(aSection,KFldHandle,handle))
       
  1083 		{
       
  1084 		INFO_PRINTF1(_L("execute UseFont(TInt) using the specified handle"));
       
  1085 		TInt err=iFbsBitGc->UseFont(handle);
       
  1086 		if(KErrNone!=err)
       
  1087 			{
       
  1088 			ERR_PRINTF2(KLogError, err);
       
  1089 			SetError(err);
       
  1090 			}
       
  1091 		}
       
  1092 	else
       
  1093 		{
       
  1094 		CFont* font=NULL;
       
  1095 		if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
       
  1096 			{
       
  1097 			TBool usehandle;
       
  1098 			if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
       
  1099 				{
       
  1100 				INFO_PRINTF1(_L("execute UseFont(TInt) using the font object's handle"));
       
  1101 				TInt err=iFbsBitGc->UseFont(((CFbsFont*)font)->Handle());
       
  1102 				if(KErrNone!=err)
       
  1103 					{
       
  1104 					ERR_PRINTF2(KLogError, err);
       
  1105 					SetError(err);
       
  1106 					}
       
  1107 				}
       
  1108 			else
       
  1109 				{
       
  1110 				INFO_PRINTF1(_L("execute UseFont(CFont*)"));
       
  1111 				iFbsBitGc->UseFont(font);
       
  1112 				}
       
  1113 			}
       
  1114 		else
       
  1115 			{
       
  1116 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
       
  1117 			SetBlockResult(EFail);
       
  1118 			}
       
  1119 		}
       
  1120 	}
       
  1121 
       
  1122 void CT_DataFbsBitGc::DoCmdUseFontNoDuplicateL(const TDesC& aSection)
       
  1123 	{
       
  1124 	CFont* font=NULL;
       
  1125 	if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
       
  1126 		{
       
  1127 		INFO_PRINTF1(_L("execute UseFontNoDuplicate(const CFbsBitGcFont*)"));
       
  1128 		iFbsBitGc->UseFontNoDuplicate((CFbsBitGcFont*)font);
       
  1129 		}
       
  1130 	else
       
  1131 		{
       
  1132 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
       
  1133 		SetBlockResult(EFail);
       
  1134 		}
       
  1135 	}
       
  1136 
       
  1137 void  CT_DataFbsBitGc::DoCmdPromptMessageL(const TDesC& aSection)
       
  1138 	{
       
  1139 	TPtrC text;
       
  1140 	//get prompt text to display in console in order to help user verify. 
       
  1141 	if(!GetStringFromConfig(aSection, KFldPromptText(), text))
       
  1142 		{
       
  1143 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldPromptText());
       
  1144 		SetBlockResult(EFail);
       
  1145 		}
       
  1146 	TInt expectedKey;
       
  1147 	if(!GetIntFromConfig(aSection, KFldExpectedKey(), expectedKey))
       
  1148 		{
       
  1149 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldExpectedKey());
       
  1150 		SetBlockResult(EFail);
       
  1151 		}
       
  1152 	TInt actualKey;
       
  1153 	RProperty property;
       
  1154 	const TUid KMyPropertyCat={0x10012345};
       
  1155 	TUint key=1;
       
  1156 	TSecurityPolicy read(TSecurityPolicy::EAlwaysPass); 
       
  1157 	TSecurityPolicy write(TSecurityPolicy::EAlwaysPass); 
       
  1158 	TInt err=property.Define(KMyPropertyCat,key,RProperty::EInt,read,write);
       
  1159 	if (err==KErrAlreadyExists)
       
  1160 		{
       
  1161 		ERR_PRINTF1(_L("RProperty has existed!"));
       
  1162 		SetBlockResult(EFail);
       
  1163 		User::LeaveIfError(err);
       
  1164 		}
       
  1165 	err=property.Attach(KMyPropertyCat,key);
       
  1166 	TRequestStatus substatus;
       
  1167 	//issue a request to get property change information.
       
  1168 	property.Subscribe(substatus);
       
  1169 	RProcess promptProcess;
       
  1170 	err = promptProcess.Create(KPromptProcess, text);
       
  1171 	if (err == KErrNone)
       
  1172 		{
       
  1173 		CleanupClosePushL(promptProcess);
       
  1174 		TRequestStatus promptStatus;
       
  1175 		promptProcess.Rendezvous(promptStatus);
       
  1176 		if (promptStatus == KRequestPending)
       
  1177 			{
       
  1178 			promptProcess.Resume();
       
  1179 			User::WaitForRequest(promptStatus);
       
  1180 			}
       
  1181 		else
       
  1182 			{
       
  1183 			promptProcess.RendezvousCancel(promptStatus);
       
  1184 			promptProcess.Kill(0);
       
  1185 			ERR_PRINTF2(_L("Executing of prompt process failed with error %d"), promptStatus.Int());
       
  1186 			SetBlockResult(EFail);
       
  1187 			}
       
  1188 		CleanupStack::PopAndDestroy();
       
  1189 		}
       
  1190 	else
       
  1191 		{
       
  1192 		ERR_PRINTF2(_L("Failed to create prompt process with error %d"), err);
       
  1193 		SetBlockResult(EFail);
       
  1194 		}
       
  1195 	//get property change information. 
       
  1196 	User::WaitForRequest(substatus);
       
  1197 	if (substatus!=KRequestPending)
       
  1198 		{
       
  1199 		property.Get(KMyPropertyCat,key,actualKey);
       
  1200 		INFO_PRINTF2(_L("property.Get %d"), actualKey);
       
  1201 		}
       
  1202 		err=RProperty::Delete(KMyPropertyCat,key);
       
  1203 		if (err!=KErrNotFound)
       
  1204 		User::LeaveIfError(err);
       
  1205 		property.Close();
       
  1206 		if(actualKey != expectedKey)
       
  1207 		{
       
  1208 		ERR_PRINTF3(_L("expectedKey=%d pressed key=%d"), expectedKey, actualKey);
       
  1209 		SetBlockResult(EFail);
       
  1210 		}
       
  1211 	}