common/tools/ats/smoketest/graphics/wserv/AnimPlugin/src/T_TWinAnim.cpp
changeset 833 6ffc235847d0
child 872 17498133d9ad
equal deleted inserted replaced
832:9b2bf01d4d36 833:6ffc235847d0
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 // 
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "T_TWinAnim.h"
       
    17 #include "T_TestAnimDll.h"
       
    18 #include "txtfrmat.h" 
       
    19 #include "bitdev.h" 
       
    20 #include "T_AnimDef.h"
       
    21 #include "w32adll.h" 
       
    22 
       
    23 // Implementation of CTimeoutTimer.
       
    24 CTimeOutTimer::CTimeOutTimer(const TInt aPriority,
       
    25 		MTimeoutNotify& aTimeOutNotify) :
       
    26 	CTimer(aPriority), iNotify(aTimeOutNotify)
       
    27 	{
       
    28 	// No implementation required
       
    29 	}
       
    30 
       
    31 CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority, 
       
    32 		MTimeoutNotify& aTimeOutNotify)
       
    33 	{
       
    34 	CTimeOutTimer *self = new ( ELeave ) CTimeOutTimer( aPriority, aTimeOutNotify );
       
    35 	CleanupStack::PushL(self);
       
    36 	self->ConstructL();
       
    37 	CleanupStack::Pop();
       
    38 	return self;
       
    39 	}
       
    40 
       
    41 CTimeOutTimer::~CTimeOutTimer()
       
    42 	{
       
    43 	Cancel();
       
    44 	}
       
    45 
       
    46 void CTimeOutTimer::ConstructL()
       
    47 	{
       
    48 	CTimer::ConstructL();
       
    49 	CActiveScheduler::Add( this);
       
    50 	}
       
    51 
       
    52 void CTimeOutTimer::RunL()
       
    53 	{
       
    54 	iNotify.TimedOut();
       
    55 	}
       
    56 
       
    57 //Implementation of CTWinAnim
       
    58 CTWinAnim::CTWinAnim(CTestAnimDll* aDll, TInt aType) :
       
    59 	CAnimProc(aDll, aType)
       
    60 	{
       
    61 	// No implementation required
       
    62 	}
       
    63 
       
    64 CTWinAnim::~CTWinAnim()
       
    65 	{
       
    66 	WriteLog(_L("~CTWinAnim"));
       
    67 	if (iServerTimer)
       
    68 		{
       
    69 		iServerTimer->Cancel();
       
    70 		}
       
    71 
       
    72 	// Then delete the timer object
       
    73 	delete iServerTimer;
       
    74 	iServerTimer = NULL;
       
    75 
       
    76 	if (iIntervalTimeStamp)
       
    77 		delete [] iIntervalTimeStamp;
       
    78 
       
    79 	if (iDuplicateBitmap)
       
    80 		delete iDuplicateBitmap;
       
    81 
       
    82 	if (iMemArray.Count() > 0)
       
    83 		FreeMemory();
       
    84 	}
       
    85 
       
    86 void CTWinAnim::ConstructL(TAny *aArgs, TBool /*aHasFocus*/)
       
    87 	{
       
    88 	WriteLog(_L("CTWinAnim::ConstructL"));
       
    89 	ConstructWinL(aArgs, iFunctions);
       
    90 
       
    91 	// Store the screen size
       
    92 	iScreenSize = iWindowFunctions->WindowSize();
       
    93 
       
    94 	TBuf<50> buf;
       
    95 	buf.Format(_L("Screen width=%d height=%d"),iScreenSize.Width(),iScreenSize.Height());
       
    96 	WriteLog(buf);
       
    97 
       
    98 	// Set the screen visible
       
    99 	iWindowFunctions->SetVisible(ETrue);
       
   100 	//just for start heartbeat
       
   101 	iWindowFunctions->SetRect(TRect(0, 0, 1, 1));
       
   102 	iServerTimer = CTimeOutTimer::NewL(EPriorityHigh, *this);
       
   103 	}
       
   104 
       
   105 void CTWinAnim::Redraw()
       
   106 	{
       
   107 	WriteLog(_L("CTWinAnim::Redraw"));
       
   108 	iResult=ETrue;
       
   109 
       
   110 	Draw();
       
   111 	}
       
   112 
       
   113 void CTWinAnim::Draw()
       
   114 	{
       
   115 	// get the background colour
       
   116 	TLogicalRgb backgroundColour(TLogicalRgb::ESystemBackgroundColor);
       
   117 
       
   118 	// Clear the old image.
       
   119 	iGc->SetPenSize(iPenSize);
       
   120 	iGc->SetPenColor(backgroundColour);
       
   121 	iGc->DrawRect(TRect(iLastPoint, iSize) );
       
   122 
       
   123 	// Draw a shape at the new position
       
   124 	iGc->SetPenSize(iPenSize);
       
   125 	iGc->SetPenColor(iColor);
       
   126 	iGc->DrawRect(TRect(iNewPoint, iSize) );
       
   127 
       
   128 	if (iDuplicateBitmap)
       
   129 		{
       
   130 		TRect rect;
       
   131 		rect.SetRect(0, 0, 200, 200);
       
   132 		iGc->DrawBitmap(rect, iDuplicateBitmap);
       
   133 		}
       
   134 
       
   135 	// signal that the current position has been drawn
       
   136 	iDrawn = ETrue;
       
   137 	}
       
   138 
       
   139 void CTWinAnim::HandleNotification(const TWsEvent &aEvent)
       
   140 	{
       
   141 	if (aEvent.Type() == iExpectEventCode)
       
   142 		{
       
   143 		iResult = ETrue;
       
   144 		}
       
   145 	}
       
   146 
       
   147 void CTWinAnim::FocusChanged(TBool /*aState*/)
       
   148 	{
       
   149 
       
   150 	}
       
   151 
       
   152 void CTWinAnim::TimedOut()
       
   153 	{
       
   154 	switch (iCurrentCommand)
       
   155 		{
       
   156 		case ECmdGeneralSetInterval:
       
   157 			{
       
   158 			TInt64 interval=iIntervalTimeStamp[1]-iIntervalTimeStamp[0];
       
   159 			TInt expectInterval=0;
       
   160 			if(iInterval>0)
       
   161 				expectInterval = iInterval * 1000000 / 2;
       
   162 
       
   163 			if (interval == expectInterval)
       
   164 				iResult=ETrue;
       
   165 			else
       
   166 				iResult=EFalse;
       
   167 
       
   168 			break;
       
   169 			}
       
   170 
       
   171 		case ECmdGeneralSetNextInterval:
       
   172 			{
       
   173 			TInt64 interval1=iIntervalTimeStamp[1]-iIntervalTimeStamp[0];
       
   174 			TInt64 interval2=iIntervalTimeStamp[2]-iIntervalTimeStamp[1];
       
   175 			TInt expectInterval = iInterval * 1000000 / 2;
       
   176 			TInt expectNextInterval = 0;
       
   177 			
       
   178 			//If the value is less than 1, it automatically gets set to 1. 
       
   179 			if(iNextInterval > 0)
       
   180 				{
       
   181 				expectNextInterval = iNextInterval * 1000000 / 2;
       
   182 				}
       
   183 			else
       
   184 				{
       
   185 				expectNextInterval = 1000000 / 2;
       
   186 				}
       
   187 			
       
   188 			if ((expectNextInterval*5/12)<=interval1 && interval1<=1000000
       
   189 					&& interval2==expectInterval)
       
   190 				iResult=ETrue;
       
   191 			else
       
   192 				iResult=EFalse;
       
   193 			break;
       
   194 			}
       
   195 		}
       
   196 	}
       
   197 
       
   198 TInt CTWinAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
       
   199 	{
       
   200 	if (aOpcode != ECmdRetrieveResult)
       
   201 		{
       
   202 		iCurrentCommand=aOpcode;
       
   203 		}
       
   204 	TInt nReturn=KErrNone;
       
   205 	switch (aOpcode)
       
   206 		{
       
   207 		case ECmdWindowActivateGc:
       
   208 			iWindowFunctions->ActivateGc();
       
   209 			break;
       
   210 		case ECmdWindowSetRect:
       
   211 			nReturn=DoCmdSetRect();
       
   212 			break;
       
   213 		case ECmdWindowIsStarted:
       
   214 			iResult=EFalse;
       
   215 			iSyncMode=iFunctions->Sync();
       
   216 			iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
       
   217 			break;
       
   218 		case ECmdRetrieveResult:
       
   219 			nReturn=iResult;
       
   220 			break;
       
   221 		case ECmdWindowWindowSize:
       
   222 			nReturn=DoCmdWindowSize();
       
   223 			break;
       
   224 		case ECmdWindowIsHidden:
       
   225 			nReturn=iWindowFunctions->IsHidden();
       
   226 			break;
       
   227 		case ECmdWindowSetVisible:
       
   228 			nReturn=DoCmdSetVisible();
       
   229 			break;
       
   230 		case ECmdWindowInvalidate:
       
   231 			nReturn=DoCmdInvalidate();
       
   232 			break;
       
   233 		case ECmdWindowParameters:
       
   234 			nReturn=DoCmdParameters();
       
   235 			break;
       
   236 		case ECmdWindowVisibleRegion:
       
   237 			nReturn=DoCmdVisibleRegion();
       
   238 			break;
       
   239 
       
   240 		case ECmdGfweScreens:
       
   241 			nReturn=iFunctions->WindowExtension()->Screens();
       
   242 			break;
       
   243 		case ECmdGfweFocusScreens:
       
   244 			nReturn=iFunctions->WindowExtension()->FocusScreens();
       
   245 			break;
       
   246 		case ECmdGfweSetFocusScreen:
       
   247 			nReturn=DoCmdSetFocusScreen();
       
   248 			break;
       
   249 		case ECmdGfweWindowGroups:
       
   250 			nReturn=DoCmdWindowGroups();
       
   251 			break;
       
   252 		case ECmdGfweWindowGroupInfo:
       
   253 			nReturn=DoCmdWindowGroupInfo();
       
   254 			break;
       
   255 		case ECmdGfweWindowGroupName:
       
   256 			nReturn=DoCmdWindowGroupName();
       
   257 			break;
       
   258 		case ECmdGfweSetOrdinalPosition:
       
   259 			nReturn=DoCmdSetOrdinalPosition();
       
   260 			break;
       
   261 		case ECmdGfweIsFocusable:
       
   262 			nReturn=DoCmdIsFocusable();
       
   263 			break;
       
   264 
       
   265 		case ECmdGeneralDuplicateBitmapL:
       
   266 			nReturn = DoCmdDuplicateBitmapL();
       
   267 			break;
       
   268 		case ECmdGeneralDuplicateFontL:
       
   269 			nReturn = DoCmdDuplicateFontL();
       
   270 			break;
       
   271 		case ECmdGeneralCloseFont:
       
   272 			nReturn = DoCmdCloseFontL();
       
   273 			break;
       
   274 		case ECmdGeneralSetInterval:
       
   275 			nReturn = DoCmdSetIntervalL();
       
   276 			break;
       
   277 		case ECmdGeneralSetNextInterval:
       
   278 			nReturn = DoCmdSetNextIntervalL();
       
   279 			break;
       
   280 		case ECmdGeneralSystemTime:
       
   281 			nReturn = DoCmdSystemTimeL();
       
   282 			break;
       
   283 		case ECmdGeneralRegisterForNotis:
       
   284 			nReturn = DoCmdRegisterForNotisL();
       
   285 			break;
       
   286 		case ECmdGeneralMessage:
       
   287 			nReturn = DoCmdMessageL();
       
   288 			break;
       
   289 		case ECmdGeneralAnimate:
       
   290 			nReturn = DoCmdAnimateL();
       
   291 			break;
       
   292 		case ECmdGeneralFlashStateOn:
       
   293 			nReturn = DoCmdFlashStateOn();
       
   294 			break;
       
   295 		case ECmdGeneralPanic:
       
   296 			nReturn = DoCmdPanic();
       
   297 			break;
       
   298 		case ECmdGeneralScreenDevice:
       
   299 			nReturn = DoCmdScreenDevice();
       
   300 			break;
       
   301 		case ECmdGeneralWindowExtension:
       
   302 			nReturn = DoCmdWindowExtension();
       
   303 			break;
       
   304 		case ECmdGeneralEventExtension:
       
   305 			nReturn = DoCmdEventExtension();
       
   306 			break;
       
   307 		case ECmdGeneralExtendedInterface:
       
   308 			nReturn = DoCmdExtendedInterfaceL();
       
   309 			break;
       
   310 		case ECmdGeneralNumOfExtInterfaces:
       
   311 			nReturn = DoCmdNumOfExtInterfaces();
       
   312 			break;
       
   313 		case ECmdGeneralSetSync:
       
   314 			nReturn = DoCmdSetSyncL();
       
   315 			break;
       
   316 		case ECmdGeneralSync:
       
   317 			nReturn = DoCmdSync();
       
   318 			break;
       
   319 		case ECmdGeneralGetRawEvents:
       
   320 			nReturn = DoCmdGetRawEventsL();
       
   321 			break;
       
   322 		case ECmdGeneralPostRawEvent:
       
   323 			nReturn = DoCmdPostRawEventL();
       
   324 			break;
       
   325 		case ECmdGeneralPostKeyEvent:
       
   326 			nReturn = DoCmdPostKeyEventL();
       
   327 			break;
       
   328 		case ECmdGeneralClient:
       
   329 			nReturn = DoCmdClient();
       
   330 			break;
       
   331 		case ECmdGeneralReplyBuf8:
       
   332 			nReturn = DoCmdGeneralReplyBuf8L();
       
   333 			break;
       
   334 		case ECmdGeneralReplyBuf16:
       
   335 			nReturn = DoCmdGeneralReplyBuf16L();
       
   336 			break;
       
   337 		case ECmdUtilEatupMemory:
       
   338 			nReturn = DoCmdEatupMemory();
       
   339 			break;
       
   340 		case ECmdUtilFreeEatenMemory:
       
   341 			nReturn = DoCmdFreeEatenMemory();
       
   342 			break;
       
   343 		default:
       
   344 			nReturn=CmdReply(iFunctions, aOpcode, aArgs);
       
   345 		}
       
   346 
       
   347 	return nReturn;
       
   348 	}
       
   349 
       
   350 void CTWinAnim::Command(TInt aOpcode, TAny *aArgs)
       
   351 	{
       
   352 	CmdReply(iFunctions, aOpcode, aArgs);
       
   353 	}
       
   354 
       
   355 void CTWinAnim::Animate(TDateTime *aDateTime)
       
   356 	{
       
   357 	//Set iAnimateTime.
       
   358 	TTime now;
       
   359 	now.HomeTime();
       
   360 	iAnimateTime = now.DateTime();
       
   361 
       
   362 	switch (iCurrentCommand)
       
   363 		{
       
   364 		case ECmdGeneralAnimate:
       
   365 			iDateTime = *aDateTime;
       
   366 			break;
       
   367 		case ECmdGeneralSetInterval:
       
   368 			{
       
   369 			if (iIntervalTimeStamp[0]==0)
       
   370 				{
       
   371 				iIntervalTimeStamp[0]=now.Int64();
       
   372 				}
       
   373 			else
       
   374 				if (iIntervalTimeStamp[1]==0)
       
   375 					{
       
   376 					iIntervalTimeStamp[1]=now.Int64();
       
   377 					}
       
   378 			break;
       
   379 			}
       
   380 
       
   381 		case ECmdGeneralSetNextInterval:
       
   382 			{
       
   383 			if (iIntervalTimeStamp[1]==0)
       
   384 				{
       
   385 				iIntervalTimeStamp[1]=now.Int64();
       
   386 				}
       
   387 			else
       
   388 				if (iIntervalTimeStamp[2]==0)
       
   389 					{
       
   390 					iIntervalTimeStamp[2]=now.Int64();
       
   391 					}
       
   392 			break;
       
   393 			}
       
   394 		}
       
   395 
       
   396 	iResult=ETrue;
       
   397 	//if MAnimGeneralFunctions::Sync() not equal to CWindowAnim::iSyncMode then call CWindowAnim::SetSync(CWindowAnim::iSyncMode)
       
   398 	if (iFunctions->Sync()!=iSyncMode && iCurrentCommand==ECmdWindowIsStarted)
       
   399 		{
       
   400 		iFunctions->SetSync(iSyncMode);
       
   401 		}
       
   402 	// if the last position has been drawn, update the position
       
   403 	if (iDrawn)
       
   404 		{
       
   405 		// this position has not been drawn, so clear the flag
       
   406 		iDrawn = EFalse;
       
   407 
       
   408 		if (iLastPoint != iNewPoint)
       
   409 			Compare();
       
   410 
       
   411 		// Save the current position, so we can rub it out later
       
   412 		iLastPoint = iNewPoint;
       
   413 
       
   414 		TInt nextpoint=iNewPoint.iX + iStepX;
       
   415 		TInt right=iNewPoint.iX + iSize.iWidth;
       
   416 
       
   417 		if (right> iScreenSize.iBr.iX ||nextpoint >= iScreenSize.iBr.iX
       
   418 				||iNewPoint.iX<iScreenSize.iTl.iX)
       
   419 			iStepX = -iStepX;
       
   420 
       
   421 		TInt nexty=iNewPoint.iY + iStepY;
       
   422 		TInt bottom=nexty + iSize.iHeight;
       
   423 
       
   424 		if (bottom> iScreenSize.iBr.iY ||nexty >= iScreenSize.iBr.iY
       
   425 				||iNewPoint.iY<iScreenSize.iTl.iY || nexty
       
   426 				<= iScreenSize.iTl.iY)
       
   427 			iStepY = -iStepY;
       
   428 
       
   429 		iNewPoint.iX += iStepX;
       
   430 		iNewPoint.iY += iStepY;
       
   431 
       
   432 		// Force a draw to be performed by declaring the screen invalid
       
   433 		iWindowFunctions->Invalidate(iScreenSize);
       
   434 		}
       
   435 
       
   436 	RecordAnimTime();
       
   437 
       
   438 	TInt interval=(iAnimTime[KAnimTimeSize-1]-iAnimTime[KAnimTimeSize-2])/1000;
       
   439 
       
   440 	TBuf<100> buf;
       
   441 	buf.Format(_L("CTWinAnim::Animate interval=%d x=%d y=%d"),
       
   442 	interval,iNewPoint.iX,iNewPoint.iY);
       
   443 
       
   444 	WriteLog(buf);
       
   445 	}
       
   446 
       
   447 void CTWinAnim::Compare()
       
   448 	{
       
   449 	// compare     	
       
   450 	const CFbsScreenDevice* scdev=iFunctions->ScreenDevice();
       
   451 
       
   452 	TBool compare=scdev->RectCompare(TRect(iNewPoint, iSize), *scdev, TRect(
       
   453 			TPoint(0, 0), iSize));
       
   454 	TBuf<50> buf;
       
   455 	buf.Format(_L("CTWinAnim::Compare res %d"),
       
   456 	compare);
       
   457 	iDll->WriteLog(buf);
       
   458 	}
       
   459 TBool CTWinAnim::OfferRawEvent(const TRawEvent& aRawEvent)
       
   460 	{
       
   461 	WriteLog(_L("CTWinAnim::OfferRawEvent has been called"));
       
   462 	TBuf<10> event;
       
   463 	event.AppendNum(aRawEvent.Type());
       
   464 	WriteLog(event);
       
   465 	iResult = ETrue;
       
   466 	return ETrue;
       
   467 	}
       
   468 
       
   469 //for MAnimWindowFunctions
       
   470 TInt CTWinAnim::DoCmdSetRect()
       
   471 	{
       
   472 	const RMessagePtr2 *msg=iFunctions->Message();
       
   473 	TPckgBuf<TRect> arg;
       
   474 	TRect rect(0, 0, 0, 0);
       
   475 	TInt nReturn=KErrNotFound;
       
   476 
       
   477 	if (msg && !msg->IsNull())
       
   478 		{
       
   479         nReturn=msg->Read(1, arg);
       
   480 		if (KErrNone==nReturn)
       
   481 			{
       
   482 			rect=arg();
       
   483 			iWindowFunctions->SetRect(rect);
       
   484 			}
       
   485 		}
       
   486 	return nReturn;
       
   487 	}
       
   488 
       
   489 TInt CTWinAnim::DoCmdWindowSize()
       
   490 	{
       
   491 	TSize size=iWindowFunctions->WindowSize();
       
   492 	TPckgBuf<TSize> pckg(size);
       
   493 	TInt nReturn=KErrNone;
       
   494 	const RMessagePtr2 *msg=iFunctions->Message();
       
   495 
       
   496 	if (msg)
       
   497 		{
       
   498 		nReturn=msg->Write(1, pckg);
       
   499 		}
       
   500 
       
   501 	return nReturn;
       
   502 	}
       
   503 
       
   504 TInt CTWinAnim::DoCmdSetVisible()
       
   505 	{
       
   506 	TInt nReturn=KErrNotFound;
       
   507 	TPckgBuf<TBool> arg;
       
   508 	const RMessagePtr2 *msg=iFunctions->Message();
       
   509 
       
   510 	if (msg)
       
   511 		{
       
   512         nReturn=msg->Read(1, arg);
       
   513 		if (KErrNone==nReturn)
       
   514 			{
       
   515 			iWindowFunctions->SetVisible(arg());
       
   516 			}
       
   517 		}
       
   518 
       
   519 	return nReturn;
       
   520 	}
       
   521 
       
   522 TInt CTWinAnim::DoCmdInvalidate()
       
   523 	{
       
   524 	const RMessagePtr2 *msg=iFunctions->Message();
       
   525 	TPckgBuf<TRect> arg;
       
   526 	TRect rect(0, 0, 0, 0);
       
   527 	TInt nReturn=KErrNotFound;
       
   528 
       
   529 	if (msg && !msg->IsNull())
       
   530 		{
       
   531         nReturn=msg->Read(1, arg);
       
   532 		if (KErrNone==nReturn)
       
   533 			{
       
   534 			rect=arg();
       
   535 			iResult=EFalse;
       
   536 			iWindowFunctions->Invalidate(rect);
       
   537 			iWindowFunctions->ActivateGc();
       
   538 			iGc->DrawRect(rect);
       
   539 			}
       
   540 		}
       
   541 	return nReturn;
       
   542 	}
       
   543 
       
   544 TInt CTWinAnim::DoCmdParameters()
       
   545 	{
       
   546 	TWindowInfo data;
       
   547 	iWindowFunctions->Parameters(data);
       
   548 
       
   549 	TPckgBuf<TRect> pckgScreenPos(data.iScreenPos);
       
   550 	TPckgBuf<TInt> pckgMode((TInt)data.iMode);
       
   551 
       
   552 	TInt nReturn=KErrNone;
       
   553 	const RMessagePtr2 *msg=iFunctions->Message();
       
   554 
       
   555 	if (msg)
       
   556 		{
       
   557 		nReturn=msg->Write(1, pckgScreenPos);
       
   558 		nReturn=msg->Write(2, pckgMode);
       
   559 		}
       
   560 
       
   561 	return nReturn;
       
   562 	}
       
   563 
       
   564 TInt CTWinAnim::DoCmdVisibleRegion()
       
   565 	{
       
   566 	RRegion region;
       
   567 	iWindowFunctions->VisibleRegion(region);
       
   568 	return region.Count();
       
   569 	}
       
   570 
       
   571 //for MAnimGeneralFunctionsWindowExtension
       
   572 TInt CTWinAnim::DoCmdSetFocusScreen()
       
   573 	{
       
   574 	const RMessagePtr2 *msg=iFunctions->Message();
       
   575 	TPckgBuf<TInt> arg;
       
   576     TInt nReturn=KErrNotFound;
       
   577     
       
   578 	if (msg && !msg->IsNull())
       
   579 		{
       
   580         nReturn=msg->Read(1, arg);
       
   581 		if (KErrNone==nReturn)
       
   582 			{
       
   583 			iFunctions->WindowExtension()->SetFocusScreen(arg());
       
   584 			}
       
   585 		}
       
   586     return nReturn;
       
   587 	}
       
   588 
       
   589 TInt CTWinAnim::DoCmdWindowGroups()
       
   590 	{
       
   591 	const RMessagePtr2 *msg=iFunctions->Message();
       
   592 	TPckgBuf<TInt> arg;
       
   593 	TInt nReturn=KErrNotFound;
       
   594 
       
   595 	if (msg && !msg->IsNull())
       
   596 		{
       
   597         nReturn=msg->Read(1, arg);
       
   598 		if (KErrNone==nReturn)
       
   599 			{
       
   600 			nReturn=iFunctions->WindowExtension()->WindowGroups(arg());
       
   601 			}
       
   602 		}
       
   603 	return nReturn;
       
   604 	}
       
   605 
       
   606 TBool CTWinAnim::DoCmdWindowGroupInfo()
       
   607 	{
       
   608 	const RMessagePtr2 *msg=iFunctions->Message();
       
   609 	TPckgBuf<TInt> argScrNumber;
       
   610 	TPckgBuf<TInt> argPosition;
       
   611 
       
   612 	TBool nReturn=EFalse;
       
   613 	MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo aInfo;
       
   614 
       
   615 	if (msg && !msg->IsNull())
       
   616 		{
       
   617 		if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
       
   618 			{
       
   619 			nReturn=iFunctions->WindowExtension()->WindowGroupInfo(aInfo, argScrNumber(), argPosition());
       
   620 
       
   621 			if (nReturn)
       
   622 				{
       
   623 				TPckgBuf<TInt> pckgInfo(aInfo.iId);
       
   624 				msg->Write(3, pckgInfo);
       
   625 				}
       
   626 			}
       
   627 		}
       
   628 	return nReturn;
       
   629 	}
       
   630 
       
   631 TBool CTWinAnim::DoCmdWindowGroupName()
       
   632 	{
       
   633 	const RMessagePtr2 *msg=iFunctions->Message();
       
   634 	TPckgBuf<TInt> argScrNumber;
       
   635 	TPckgBuf<TInt> argPosition;
       
   636 
       
   637 	TBool nReturn=EFalse;
       
   638 
       
   639 	if (msg && !msg->IsNull())
       
   640 		{
       
   641 		if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
       
   642 			{
       
   643 			TPtrC name;
       
   644 			nReturn=iFunctions->WindowExtension()->WindowGroupName(name, argScrNumber(), argPosition());
       
   645 			if (nReturn)
       
   646 				{
       
   647 				msg->Write(3, name);
       
   648 				}
       
   649 			}
       
   650 		}
       
   651 
       
   652 	return nReturn;
       
   653 	}
       
   654 
       
   655 TInt CTWinAnim::DoCmdSetOrdinalPosition()
       
   656 	{
       
   657 	const RMessagePtr2 *msg=iFunctions->Message();
       
   658 	TPckgBuf<TInt> argGroupId;
       
   659 	TPckgBuf<TInt> argPosition;
       
   660 	TPckgBuf<TInt> argPriority;
       
   661 
       
   662 	TInt nReturn=KErrNotFound;
       
   663 
       
   664 	if (msg && !msg->IsNull())
       
   665 		{
       
   666 		if (KErrNone==msg->Read(1, argGroupId) && KErrNone==msg->Read(2, argPosition)
       
   667 				&& KErrNone==msg->Read(3, argPriority))
       
   668 			{
       
   669 			nReturn=iFunctions->WindowExtension()->SetOrdinalPosition(argGroupId(), argPosition(),
       
   670 					argPriority());
       
   671 			}
       
   672 		}
       
   673 
       
   674 	return nReturn;
       
   675 	}
       
   676 
       
   677 TBool CTWinAnim::DoCmdIsFocusable()
       
   678 	{
       
   679 	const RMessagePtr2 *msg=iFunctions->Message();
       
   680 	TPckgBuf<TInt> argScrNumber;
       
   681 	TPckgBuf<TInt> argPosition;
       
   682 
       
   683 	TBool nReturn=EFalse;
       
   684 	MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo aInfo;
       
   685 
       
   686 	if (msg && !msg->IsNull())
       
   687 		{
       
   688 		if (KErrNone==msg->Read(1, argScrNumber) && KErrNone==msg->Read(2, argPosition))
       
   689 			{
       
   690 			if (iFunctions->WindowExtension()->WindowGroupInfo(aInfo, argScrNumber(), argPosition()))
       
   691 				{
       
   692 				nReturn=aInfo.IsFocusable();
       
   693 				}
       
   694 			}
       
   695 		}
       
   696 	return nReturn;
       
   697 	}
       
   698 
       
   699 TInt CTWinAnim::DoCmdDuplicateBitmapL()
       
   700 	{
       
   701 	TInt result = 0;
       
   702 	TInt handle;
       
   703 	TPtr8 ptr1((TUint8*)&handle, sizeof(TInt));
       
   704 	const RMessagePtr2 *msg=iFunctions->Message();
       
   705 		
       
   706 	if(msg && !msg->IsNull())
       
   707 		{
       
   708 		msg->ReadL(1,ptr1);
       
   709 		iDuplicateBitmap = iFunctions->DuplicateBitmapL(handle);
       
   710 		if (iDuplicateBitmap)
       
   711 			{
       
   712 			TRect rect;
       
   713 			iWindowFunctions->ActivateGc();
       
   714 			rect.SetRect(0, 0, 200, 200);
       
   715 			iGc->DrawBitmap(rect, iDuplicateBitmap);
       
   716 			}
       
   717 		}
       
   718 	else
       
   719 		{
       
   720 		result = -1;
       
   721 		}
       
   722 	return result;
       
   723 	}
       
   724 
       
   725 TInt CTWinAnim::DoCmdDuplicateFontL()
       
   726 	{
       
   727 	TInt result = 0;
       
   728 	TInt handle;
       
   729 	TPtr8 ptr1((TUint8*)&handle, sizeof(TInt));
       
   730 	const RMessagePtr2 *msg=iFunctions->Message();
       
   731 			
       
   732 	if(msg && !msg->IsNull())
       
   733 		{
       
   734 		msg->ReadL(1,ptr1);
       
   735 		iDuplicateFont = iFunctions->DuplicateFontL(handle);
       
   736 		TInt id =0;
       
   737 		if (iDuplicateFont)
       
   738 			{
       
   739 			id = iDuplicateFont->TypeUid().iUid;
       
   740 			TPtr8 ptr2((TUint8*)&id, sizeof(TInt), sizeof(TInt));
       
   741 			msg->Write(2, ptr2);
       
   742 			}
       
   743 		}
       
   744 	else
       
   745 		{
       
   746 		return -1;
       
   747 		}
       
   748 		
       
   749 	return result;
       
   750 	}
       
   751 
       
   752 TInt CTWinAnim::DoCmdCloseFontL()
       
   753 	{
       
   754 	DoCmdDuplicateFontL();
       
   755 	iFunctions->CloseFont(iDuplicateFont);
       
   756 	return 0;
       
   757 	}
       
   758 
       
   759 TInt CTWinAnim::DoCmdSetIntervalL()
       
   760 	{
       
   761 	TInt result = 0;
       
   762 	TPtr8 ptr1((TUint8*)&iInterval, sizeof(TInt));
       
   763 	const RMessagePtr2 *msg=iFunctions->Message();
       
   764 			
       
   765 	if(msg && !msg->IsNull())
       
   766 		{
       
   767 		msg->ReadL(1,ptr1);
       
   768 		if (iIntervalTimeStamp)
       
   769 		delete [] iIntervalTimeStamp;
       
   770 		iIntervalTimeStamp=new (ELeave) TInt64[3];
       
   771 		iIntervalTimeStamp[0]=0;
       
   772 		iIntervalTimeStamp[1]=0;
       
   773 		iIntervalTimeStamp[2]=0;
       
   774 		iFunctions->SetInterval(iInterval);
       
   775 		iServerTimer->After( 5000000); // delay 5 second
       
   776 		}
       
   777 	else
       
   778 		{
       
   779 		result = -1;
       
   780 		}	
       
   781 
       
   782 	return result;
       
   783 	}
       
   784 
       
   785 TInt CTWinAnim::DoCmdSetNextIntervalL()
       
   786 	{
       
   787 	TInt result = 0;
       
   788 	TPtr8 ptr1((TUint8*)&iInterval, sizeof(TInt));
       
   789 	TPtr8 ptr2((TUint8*)&iNextInterval, sizeof(TInt));
       
   790 	const RMessagePtr2 *msg=iFunctions->Message();
       
   791 			
       
   792 	if(msg && !msg->IsNull())
       
   793 		{
       
   794 		msg->ReadL(1,ptr1);
       
   795 		msg->ReadL(2,ptr2);
       
   796 		if (iIntervalTimeStamp)
       
   797 			delete [] iIntervalTimeStamp;
       
   798 		
       
   799 		iIntervalTimeStamp=new (ELeave) TInt64[3];
       
   800 		iIntervalTimeStamp[0]=0;
       
   801 		iIntervalTimeStamp[1]=0;
       
   802 		iIntervalTimeStamp[2]=0;
       
   803 		iFunctions->SetInterval(iInterval);
       
   804 		iFunctions->SetNextInterval(iNextInterval);//2 flash = 1 second
       
   805 		if (iIntervalTimeStamp[0]==0)
       
   806 			{
       
   807 			TTime now;
       
   808 			now.HomeTime();
       
   809 			iIntervalTimeStamp[0]=now.Int64();
       
   810 			}
       
   811 
       
   812 		iServerTimer->After( 5000000); //delay 5 second
       
   813 		}
       
   814 	else
       
   815 		{
       
   816 		result = -1;
       
   817 		}
       
   818 		
       
   819 	return result;
       
   820 	}
       
   821 
       
   822 TInt CTWinAnim::DoCmdSystemTimeL()
       
   823 	{
       
   824 	TBool result = DoCmdSetSyncL();
       
   825 	if (result)
       
   826 		{
       
   827 		return result;
       
   828 		}
       
   829 	iFunctions->Animate(NULL);
       
   830 
       
   831 	TDateTime time = iFunctions->SystemTime();
       
   832 	MAnimGeneralFunctions::TAnimSync syncType = iFunctions->Sync();
       
   833 	switch (syncType)
       
   834 		{
       
   835 		case MAnimGeneralFunctions::ESyncDay:
       
   836 			if (time.Day() == iAnimateTime.Day())
       
   837 				{
       
   838 				result = ETrue;
       
   839 				}
       
   840 			else
       
   841 				{
       
   842 				result = EFalse;
       
   843 				}
       
   844 			break;
       
   845 		case MAnimGeneralFunctions::ESyncMinute:
       
   846 			if (time.Minute() == iAnimateTime.Minute() && time.Day()
       
   847 					== iAnimateTime.Day())
       
   848 				{
       
   849 				result = ETrue;
       
   850 				}
       
   851 			else
       
   852 				{
       
   853 				result = EFalse;
       
   854 				}
       
   855 			break;
       
   856 		case MAnimGeneralFunctions::ESyncFlash:
       
   857 		case MAnimGeneralFunctions::ESyncNone:
       
   858 		case MAnimGeneralFunctions::ESyncSecond:
       
   859 			if (time.Day() == iAnimateTime.Day() && time.Minute()
       
   860 					== iAnimateTime.Minute() && time.Second()
       
   861 					== iAnimateTime.Second())
       
   862 				{
       
   863 				result = ETrue;
       
   864 				}
       
   865 			else
       
   866 				{
       
   867 				result = EFalse;
       
   868 				}
       
   869 			break;
       
   870 		}
       
   871 	return result;
       
   872 	}
       
   873 
       
   874 TInt CTWinAnim::DoCmdRegisterForNotisL()
       
   875 	{
       
   876 	iResult = EFalse;
       
   877 	TUint32 notice;
       
   878 	TInt result = 0;
       
   879 	TPtr8 ptr1((TUint8*)&notice, sizeof(TUint32));
       
   880 	TPtr8 ptr2((TUint8*)&iExpectEventCode, sizeof(TEventCode));
       
   881 	const RMessagePtr2 *msg=iFunctions->Message();
       
   882 			
       
   883 	if(msg && !msg->IsNull())
       
   884 		{
       
   885 		msg->ReadL(1, ptr1);
       
   886 		msg->ReadL(2, ptr2);
       
   887 		iFunctions->RegisterForNotifications(notice);		
       
   888 		}
       
   889 	else
       
   890 		{
       
   891 		return -1;
       
   892 		}
       
   893 	
       
   894 	return result;
       
   895 	}
       
   896 
       
   897 TInt CTWinAnim::DoCmdMessageL()
       
   898 	{
       
   899 	TInt result;
       
   900 	TBuf<KBufMessage> message;
       
   901 	const RMessagePtr2 *msg=iFunctions->Message();
       
   902 			
       
   903 	if(msg && !msg->IsNull())
       
   904 		{
       
   905 		msg->ReadL(1,message);
       
   906 		msg->Write(2, message);
       
   907 		}
       
   908 	else
       
   909 		{
       
   910 		result = -1;
       
   911 		}
       
   912 	
       
   913 	return result;
       
   914 	}
       
   915 
       
   916 TInt CTWinAnim::DoCmdAnimateL()
       
   917 	{
       
   918 	TInt result = 0;
       
   919 	TDateTime time;
       
   920 	TPtr8 ptr1((TUint8*)&time, sizeof(TDateTime));
       
   921 	const RMessagePtr2 *msg=iFunctions->Message();
       
   922 			
       
   923 	if(msg && !msg->IsNull())
       
   924 		{
       
   925 		msg->ReadL(1,ptr1);
       
   926 		iResult = EFalse;
       
   927 		iFunctions->Animate(&time);
       
   928 		if (iDateTime.MicroSecond() == time.MicroSecond() && iDateTime.Minute()
       
   929 				== time.Minute() && iDateTime.Second() == time.Second())
       
   930 			{
       
   931 			iResult = ETrue;
       
   932 			}
       
   933 		else
       
   934 			{
       
   935 			iResult = EFalse;
       
   936 			}
       
   937 	
       
   938 		}
       
   939 	
       
   940 	return iResult;
       
   941 	}
       
   942 
       
   943 TInt CTWinAnim::DoCmdFlashStateOn()
       
   944 	{
       
   945 	TBool status = EFalse;
       
   946 	TTime time;
       
   947 	time.HomeTime();
       
   948 	TBool result = iFunctions->FlashStateOn();
       
   949 	TInt ms = time.DateTime().MicroSecond();
       
   950 	TInt H1Limit = 16000; //0.016 * 100000 = 1/64 * 1000000;
       
   951 	TInt H2Limit = 567000; // (7/12 - 1/64) * 1000000;
       
   952 	TInt H3Limit = 599000; // (7/12 + 1/64) * 1000000;
       
   953 	TInt H4Limit = 984000; // (1 - 0.016) * 1000000;
       
   954 	
       
   955 	if(ms < H1Limit || 
       
   956 			(ms > H2Limit && ms < H3Limit) ||
       
   957 			ms > H4Limit)
       
   958 		{
       
   959 		return -1;
       
   960 		}
       
   961 	
       
   962 	if (time.DateTime().MicroSecond() < 1000000 * 7/12)
       
   963 		{
       
   964 		status = ETrue;
       
   965 		}
       
   966 	else
       
   967 		{
       
   968 		status = EFalse;
       
   969 		}
       
   970 	if (result == status)
       
   971 		{
       
   972 		status = ETrue;
       
   973 		}
       
   974 	else
       
   975 		{
       
   976 		status = EFalse;
       
   977 		}
       
   978 
       
   979 	return status;
       
   980 	}
       
   981 
       
   982 TInt CTWinAnim::DoCmdPanic()
       
   983 	{
       
   984 	iFunctions->Panic();
       
   985 	return 0;
       
   986 	}
       
   987 
       
   988 TInt CTWinAnim::DoCmdScreenDevice()
       
   989 	{
       
   990 	TDisplayMode mode = iFunctions->ScreenDevice()->DisplayMode();
       
   991 	return 0;
       
   992 	}
       
   993 
       
   994 TInt CTWinAnim::DoCmdWindowExtension()
       
   995 	{
       
   996 	MAnimGeneralFunctionsWindowExtension* ext = iFunctions->WindowExtension();
       
   997 	TInt screen = ext->FocusScreens();
       
   998 	return 0;
       
   999 	}
       
  1000 
       
  1001 TInt CTWinAnim::DoCmdEventExtension()
       
  1002 	{
       
  1003 	MAnimGeneralFunctionsEventExtension* ext = iFunctions->EventExtension();
       
  1004 	TKeyEvent event;
       
  1005 	event.iCode = EEventKeyDown;
       
  1006 	ext->PostKeyEvent(event, 1);
       
  1007 	return 0;
       
  1008 	}
       
  1009 
       
  1010 TInt CTWinAnim::DoCmdExtendedInterfaceL()
       
  1011 	{
       
  1012 	TInt result = 0;
       
  1013 	TInt interface;
       
  1014 	TPtr8 ptr1((TUint8*)&interface, sizeof(TInt));
       
  1015 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1016 				
       
  1017 	if(msg && !msg->IsNull())
       
  1018 		{
       
  1019 		msg->ReadL(1,ptr1);
       
  1020 		TAny* any = iFunctions->ExtendedInterface(interface);
       
  1021 		if (interface == 0)
       
  1022 			{
       
  1023 			//Zhang Yue modified.for the return result is a Int value, not a pointer address.
       
  1024 			result = (TInt)any;
       
  1025 			}
       
  1026 		else
       
  1027 			{
       
  1028 			if (interface == 1)
       
  1029 				{
       
  1030 				((MAnimGeneralFunctionsWindowExtension*) any)->FocusScreens();
       
  1031 				}
       
  1032 			else
       
  1033 				{
       
  1034 				if (interface == 2)
       
  1035 					{
       
  1036 					TKeyEvent event;
       
  1037 					event.iCode = EEventKeyDown;
       
  1038 					((MAnimGeneralFunctionsEventExtension*) any)->PostKeyEvent(
       
  1039 							event, 1);
       
  1040 					}
       
  1041 				else
       
  1042 					{
       
  1043 					if (any)
       
  1044 						{
       
  1045 						result = -1;
       
  1046 						}
       
  1047 					else
       
  1048 						{
       
  1049 						result = 0;
       
  1050 						}//end if (any)
       
  1051 					}//end if(interface 2)
       
  1052 				}//end if(interface)
       
  1053 			}//end if(interface)
       
  1054 	
       
  1055 		} //end if(msg)		
       
  1056 	else
       
  1057 		{
       
  1058 		result = -1;
       
  1059 		}
       
  1060 	
       
  1061 	return result;
       
  1062 	}
       
  1063 
       
  1064 TInt CTWinAnim::DoCmdNumOfExtInterfaces()
       
  1065 	{
       
  1066 	return iFunctions->NumberOfExtendedInterfaces();
       
  1067 	}
       
  1068 
       
  1069 TInt CTWinAnim::DoCmdSetSyncL()
       
  1070 	{
       
  1071 	TInt result = 0;
       
  1072 	MAnimGeneralFunctions::TAnimSync mode;
       
  1073 	TPtr8 ptr1((TUint8*)&mode, sizeof(MAnimGeneralFunctions::TAnimSync));
       
  1074 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1075 	if(msg && !msg->IsNull())
       
  1076 		{
       
  1077 		msg->ReadL(1,ptr1);
       
  1078 		iFunctions->SetSync(mode);		
       
  1079 		}
       
  1080 	else
       
  1081 		{
       
  1082 		return -1;
       
  1083 		}
       
  1084 	return result;
       
  1085 	}
       
  1086 
       
  1087 TInt CTWinAnim::DoCmdSync()
       
  1088 	{
       
  1089 	MAnimGeneralFunctions::TAnimSync mode = iFunctions->Sync();
       
  1090 	return mode;
       
  1091 	}
       
  1092 
       
  1093 TInt CTWinAnim::DoCmdGetRawEventsL()
       
  1094 	{
       
  1095 	TInt result = 0;
       
  1096 	TBool getevent;
       
  1097 	TPtr8 ptr1((TUint8*)&getevent, sizeof(TBool));
       
  1098 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1099 	if(msg && !msg->IsNull())
       
  1100 		{
       
  1101 		msg->ReadL(1,ptr1);
       
  1102 		iFunctions->GetRawEvents(getevent);
       
  1103 			
       
  1104 		}
       
  1105 	else
       
  1106 		{
       
  1107 		return -1;
       
  1108 		}
       
  1109 
       
  1110 	return result;
       
  1111 	}
       
  1112 
       
  1113 TInt CTWinAnim::DoCmdPostRawEventL()
       
  1114 	{
       
  1115 	iResult = EFalse;
       
  1116 	TInt result = 0;
       
  1117 	TRawEvent event;
       
  1118 	TPtr8 ptr1((TUint8*)&event, sizeof(TRawEvent));
       
  1119 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1120 	
       
  1121 	if(msg && !msg->IsNull())
       
  1122 		{
       
  1123 		msg->ReadL(1,ptr1);
       
  1124 		iFunctions->PostRawEvent(event);		
       
  1125 		}
       
  1126 	else
       
  1127 		{
       
  1128 		return -1;
       
  1129 		}
       
  1130 
       
  1131 	return result;
       
  1132 	}
       
  1133 
       
  1134 TInt CTWinAnim::DoCmdPostKeyEventL()
       
  1135 	{
       
  1136 	iResult = EFalse;
       
  1137 	TInt result = 0;
       
  1138 	TKeyEvent event;
       
  1139 	TPtr8 ptr1((TUint8*)&event, sizeof(TKeyEvent));
       
  1140 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1141 	
       
  1142 	if(msg && !msg->IsNull())
       
  1143 		{
       
  1144 		msg->ReadL(1,ptr1);
       
  1145 		iFunctions->PostKeyEvent(event);
       
  1146 		}
       
  1147 	else
       
  1148 		{
       
  1149 		result = -1;
       
  1150 		}
       
  1151 	return result;
       
  1152 	}
       
  1153 
       
  1154 TInt CTWinAnim::DoCmdClient()
       
  1155 	{
       
  1156 	return iFunctions->Client().Id();
       
  1157 	}
       
  1158 
       
  1159 TInt CTWinAnim::DoCmdGeneralReplyBuf8L()
       
  1160 	{
       
  1161 	TInt result;
       
  1162 	TBuf8<KBufMessage> message;
       
  1163 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1164 	if(msg && !msg->IsNull())
       
  1165 		{
       
  1166 		msg->ReadL(3,message);
       
  1167 		iFunctions->ReplyBuf(message);		
       
  1168 		}
       
  1169 	else
       
  1170 		{
       
  1171 		result = -1;
       
  1172 		}
       
  1173 	
       
  1174 	return result;
       
  1175 	}
       
  1176 
       
  1177 TInt CTWinAnim::DoCmdGeneralReplyBuf16L()
       
  1178 	{
       
  1179 	TInt result;
       
  1180 	TBuf<KBufMessage> message;
       
  1181 	const RMessagePtr2 *msg=iFunctions->Message();
       
  1182 	if(msg && !msg->IsNull())
       
  1183 		{
       
  1184 		msg->ReadL(3,message);
       
  1185 		iFunctions->ReplyBuf(message);
       
  1186 		}
       
  1187 	else
       
  1188 		{
       
  1189 		result = -1;
       
  1190 		}
       
  1191 	return result;
       
  1192 	}
       
  1193 
       
  1194 TInt CTWinAnim::DoCmdEatupMemory()
       
  1195 	{
       
  1196 	TInt leftsize=20;
       
  1197 
       
  1198 	// eat memory until fail to avaiable memory is less than is left size  
       
  1199 	TInt nTotalSize=User::Heap().Size();
       
  1200 	TAny* mem=User::AllocZ(nTotalSize);
       
  1201 
       
  1202 	if (mem)
       
  1203 		iMemArray.Append(mem);
       
  1204 
       
  1205 	do
       
  1206 		{
       
  1207 		mem=User::AllocZ(leftsize);
       
  1208 		if (mem)
       
  1209 			{
       
  1210 			iMemArray.Append(mem);
       
  1211 			}
       
  1212 		}
       
  1213 	while (mem);
       
  1214 
       
  1215 	iAvaiableSpace=User::Available(iBiggestBlock);
       
  1216 	return 0;
       
  1217 	}
       
  1218 
       
  1219 TInt CTWinAnim::DoCmdFreeEatenMemory()
       
  1220 	{
       
  1221 	FreeMemory();
       
  1222 	return 0;
       
  1223 	}
       
  1224 
       
  1225 void CTWinAnim::FreeMemory()
       
  1226 	{
       
  1227 	for (TInt i=0; i<iMemArray.Count(); i++)
       
  1228 		{
       
  1229 		TAny* mem=iMemArray[i];
       
  1230 		User::Free(mem);
       
  1231 		}
       
  1232 
       
  1233 	iMemArray.Reset();
       
  1234 	}