os/graphics/windowing/windowserver/debuglog/DECODER.CPP
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1995-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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Decodes data into text - platform independent
    15 // 
    16 //
    17 
    18 #include "../SERVER/w32cmd.h"
    19 #include "DEBUGLOG.H"
    20 
    21 _LIT(LogCloseBracket,")");
    22 _LIT(LogComma,", ");
    23 _LIT(LogString,"%S");
    24 _LIT(LogClose,"Close()");
    25 _LIT(LogSpaces,"  ");
    26 
    27 void TDebugLogOverflow::Overflow(TDes &aDes)
    28 	{
    29 	if (!iError)		//Should never be re-entrant but just in case
    30 		{
    31 		_LIT(OverflowThreeDots,"...");
    32 		const TInt LenThreeDots=3;
    33 		iError=ETrue;
    34 		TInt length=aDes.MaxLength();
    35 		if (length>LenThreeDots)
    36 			{
    37 			length-=LenThreeDots;
    38 			if (aDes.Length()>length)
    39 				aDes.SetLength(length);
    40 			}
    41 		aDes.AppendFormat(OverflowThreeDots,this);
    42 		}
    43 	}
    44 
    45 class TRawEventX : public TRawEvent
    46 // For bypassing protected members of TRawEvent
    47 	{
    48 public:
    49 	inline TUint Ticks();
    50 	inline TInt posx();
    51 	inline TInt posy();
    52 	inline TInt scanCode();
    53 	};
    54 
    55 inline TUint TRawEventX::Ticks()
    56 	{return(iTicks);}
    57 inline TInt TRawEventX::posx()
    58 	{return(iU.pos.x);}
    59 inline TInt TRawEventX::posy()
    60 	{return(iU.pos.y);}
    61 inline TInt TRawEventX::scanCode()
    62 	{return(iU.key.scanCode __REMOVE_WINS_CHARCODE);}
    63 
    64 
    65 GLDEF_C TInt hHandleToValue(TUint32 handle)
    66 	{
    67 	return(handle&0xFFFF);
    68 	}
    69 
    70 TDesC &TWsDecoder::CommandBuf(TInt aApp)
    71 	{
    72 	iText.Format(_L("[start of command buffer from app %d]"), aApp);
    73 	return iText;
    74 	}
    75 
    76 TDesC &TWsDecoder::Command(TInt aClass, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
    77 	{
    78 	TPtrC details(commandDetails(aClass, aOpcode, aCmdData, aHandle));
    79 	iText=KNullDesC;
    80 	if (details!=KNullDesC)
    81 		iText=details;
    82 	return iText;
    83 	}
    84 
    85 TDesC &TWsDecoder::NewClient(TUint aConnectionHandle)
    86 	{
    87 	iText.Format(_L("Client Connected %d"), aConnectionHandle);
    88 	iRequestFuncClass=ENewClientClass;
    89 	return iText;
    90 	}
    91 
    92 TDesC &TWsDecoder::CommandReply(TInt aData)
    93 	{
    94 	iText.Format(_L("returns %d (0x%x)"), aData, aData);
    95 	return iText;
    96 	}
    97 
    98 TDesC &TWsDecoder::CommandReplyBuf(const TDesC8 &aDes)
    99 	{
   100 	TPtrC details(replyBufDetails(iRequestFuncClass, iPrevOpcode, &aDes, NULL));
   101 	iText=KNullDesC;
   102 	if (details!=KNullDesC)
   103 		{
   104 		iText=LogSpaces;
   105 		TDebugLogTextHandler::Append(iText, details);
   106 		}
   107 	return iText;
   108 	}
   109 
   110 TDesC &TWsDecoder::CommandReplyBuf(const TDesC16 &aDes)
   111 	{
   112 	iOverflowHandler.Reset();
   113 	TPtrC details(replyBufDetails(iRequestFuncClass, iPrevOpcode, NULL, &aDes));
   114 	iText=KNullDesC;
   115 	if (details!=KNullDesC)
   116 		{
   117 		iText=LogSpaces;
   118 		TDebugLogTextHandler::Append(iText, details);
   119 		}
   120 	return iText;
   121 	}
   122 
   123 TDesC &TWsDecoder::SignalEvent(TInt aApp)
   124 	{
   125 	iText.Format(_L("Event signalled for App %d"),aApp);
   126 	return iText;
   127 	}
   128 
   129 TDesC &TWsDecoder::Panic(TInt aApp, TInt aReason)
   130 	{
   131 	if (aApp==CDebugLogBase::EDummyConnectionId)
   132 		iText.Format(_L("WSERV Internal Panic (%d)"), aReason);
   133 	else
   134 		iText.Format(_L("App %d, Paniced (%d)"),aApp, aReason);
   135 	return iText;
   136 	}
   137 
   138 void TWsDecoder::UnKnown()
   139 	{
   140 	}
   141 
   142 void TWsDecoder::UnKnownOpcode(TBuf<LogTBufSize> &aText, TInt aOpcode)
   143 	{
   144 	aText.AppendFormat(_L("unknown function (opcode %u)"), aOpcode);
   145 	UnKnown();
   146 	}
   147 
   148 void TWsDecoder::UnKnownReplyBuf(TBuf<LogTBufSize> &aText, TInt aOpcode)
   149 	{
   150 	aText.AppendFormat(_L("unknown reply buffer (opcode %u)"), aOpcode);
   151 	UnKnown();
   152 	}
   153 
   154 TDesC &TWsDecoder::MiscMessage(const TDesC &aFormat,TInt aParam)
   155 	{
   156 	iText.Format(aFormat,aParam);
   157 	return iText;
   158 	}
   159 
   160 void TWsDecoder::AppendPoint(TBuf<LogTBufSize> &aText, const TDesC8 *aReplyDes8)
   161 	{
   162 	TShortBuf buf(TDebugLogTextHandler::FormatPoint(*((TPoint *)aReplyDes8->Ptr())));
   163 	aText.AppendFormat(LogString, &buf);
   164 	}
   165 
   166 void TWsDecoder::AppendRect(TBuf<LogTBufSize> &aText, const TDesC8 *aReplyDes8)
   167 	{
   168 	TLongBuf buf(TDebugLogTextHandler::FormatRect(*((TRect *)aReplyDes8->Ptr())));
   169 	aText.AppendFormat(LogString, &buf);
   170 	}
   171 
   172 void TWsDecoder::AppendDesc(TBuf<LogTBufSize> &aText, const TDesC8 *aReplyDes8)
   173 	{
   174 	TBuf<LogTBufSize> buf;
   175 	buf.Copy(*aReplyDes8);
   176 	aText.AppendFormat(LogString, &buf);
   177 	}
   178 
   179 void TWsDecoder::AppendDesc(TBuf<LogTBufSize> &aText, const TDesC16 *aReplyDes16)
   180 	{
   181 	aText.AppendFormat(LogString, aReplyDes16);
   182 	}
   183 
   184 void TWsDecoder::DecodeWindowGroup(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
   185 	{
   186 	aText.Format(_L("RWindowGroup[%d]::"),aHandle);
   187 	TWsWinCmdUnion pData;
   188 	pData.any=aCmdData;
   189 	switch (aOpcode)
   190 		{
   191 	case EWsWinOpReceiveFocus:
   192 		aText.AppendFormat(_L("ReceiveFocus(%d)"), *pData.Bool);
   193 		break;
   194 	case EWsWinOpAutoForeground:
   195 		aText.AppendFormat(_L("AutoForeground(%d)"), *pData.Bool);
   196 		break;
   197 	case EWsWinOpCancelCaptureKey:
   198 		aText.AppendFormat(_L("CancelCaptureKey(%d)"), *pData.UInt);
   199 		break;
   200 	case EWsWinOpCaptureKey:
   201 		aText.AppendFormat(_L("CaptureKey(%u, 0x%04x, 0x%04x)"),
   202 									pData.CaptureKey->key,
   203 									pData.CaptureKey->modifiers,
   204 									pData.CaptureKey->modifierMask);
   205 		break;
   206 	case EWsWinOpCancelCaptureKeyUpsAndDowns:
   207 		aText.AppendFormat(_L("CancelCaptureKeyUpsAndDowns(%d)"), *pData.UInt);
   208 		break;
   209 	case EWsWinOpCaptureKeyUpsAndDowns:
   210 		aText.AppendFormat(_L("CaptureKeyUpsAndDowns(%u, 0x%04x, 0x%04x)"),
   211 									pData.CaptureKey->key,
   212 									pData.CaptureKey->modifiers,
   213 									pData.CaptureKey->modifierMask);
   214 		break;
   215 	case EWsWinOpSetTextCursor:
   216 		{
   217 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.SetTextCursor->pos));
   218 		aText.AppendFormat(_L("SetTextCursor(%d, %S, {%u,%d,%d,%d,0x%08x})"),
   219 										hHandleToValue(pData.SetTextCursor->window), &buf,
   220 										pData.SetTextCursor->cursor.iType, pData.SetTextCursor->cursor.iHeight,
   221 										pData.SetTextCursor->cursor.iAscent, pData.SetTextCursor->cursor.iWidth,
   222 										pData.SetTextCursor->cursor.iFlags);
   223 		}
   224 		break;
   225 	case EWsWinOpSetTextCursorClipped:
   226 		{
   227 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.SetTextCursor->pos));
   228 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.SetTextCursor->rect));
   229 		aText.AppendFormat(_L("SetTextCursor(%d, %S, {%u,%d,%d,%d,0x%08x}, %S)"),
   230 										hHandleToValue(pData.SetTextCursor->window), &buf1,
   231 										pData.SetTextCursor->cursor.iType, pData.SetTextCursor->cursor.iHeight,
   232 										pData.SetTextCursor->cursor.iAscent, pData.SetTextCursor->cursor.iWidth,
   233 										pData.SetTextCursor->cursor.iFlags, &buf2);
   234 		}
   235 		break;
   236 	case EWsWinOpCancelTextCursor:
   237 		aText.AppendFormat(_L("CancelTextCursor()"));
   238 		break;
   239 	case EWsWinOpSetOrdinalPriorityAdjust:
   240 		aText.AppendFormat(_L("SetOrdinalPriorityAdjust(%d)"), *pData.Int);
   241 		break;
   242 	case EWsWinOpAddPriorityKey:
   243 		aText.AppendFormat(_L("AddPriorityKey(0x%x,0x%x,%d)"), pData.PriorityKey->modifiers, pData.PriorityKey->modifierMask, pData.PriorityKey->keycode);
   244 		break;
   245 	case EWsWinOpRemovePriorityKey:
   246 		aText.AppendFormat(_L("RemovePriorityKey(0x%x,0x%x,%d)"), pData.PriorityKey->modifiers, pData.PriorityKey->modifierMask, pData.PriorityKey->keycode);
   247 		break;
   248 	case EWsWinOpSetOrdinalPositionErr:
   249 		aText.AppendFormat(_L("SetOrdinalPositionErr(%d, %d)"), pData.OrdinalPos->pos, pData.OrdinalPos->ordinalPriority);	
   250 		break;
   251 	case EWsWinOpDisableKeyClick:
   252 		aText.AppendFormat(_L("DisableKeyClick(%u)"), *pData.UInt);	
   253 		break;
   254 	case EWsWinOpCaptureLongKey:
   255 		aText.AppendFormat(_L("CaptureLongKey(TTimeIntervalMicroSeconds32(%d), %u, %u, %u, %u, %d, %u)"), 
   256 								pData.CaptureLongKey->delay.Int(), pData.CaptureLongKey->inputKey, pData.CaptureLongKey->outputKey, 
   257 								pData.CaptureLongKey->modifierMask, pData.CaptureLongKey->modifiers, pData.CaptureLongKey->priority, pData.CaptureLongKey->flags);	
   258 		break;
   259 	case EWsWinOpCancelCaptureLongKey:
   260 		aText.AppendFormat(_L("CancelCaptureLongKey(%d)"), pData.CaptureKey->key);	
   261 		break;
   262 	case EWsWinOpAllowChildWindowGroup:
   263 		aText.AppendFormat(_L("AllowProcessToCreateChildWindowGroup(%d)"), *pData.Int);	
   264 		break;
   265 	case EWsWinOpClearChildGroup:
   266 		aText.AppendFormat(_L("ClearChildGroup()"));	
   267 		break;
   268 	case EWsWinOpSetChildGroup:
   269 		aText.AppendFormat(_L("SetChildGroup(%d)"), *pData.Int); 	
   270 		break;
   271 	case EWsWinOpEnableVisibilityChangeEvents:
   272 		aText.Append(_L("EnableVisibilityChangeEvents()")); 	
   273 		break;
   274 	case EWsWinOpDisableVisibilityChangeEvents:
   275 		aText.Append(_L("DisableVisibilityChangeEvents()")); 	
   276 		break;
   277 	case EWsWinOpWindowGroupId:
   278 		aText.Append(_L("WindowGroupId()")); 	
   279 		break;
   280 	case EWsWinOpEnableFocusChangeEvents:
   281 		aText.Append(_L("EnableFocusChangeEvents()")); 	
   282 		break;
   283 	case EWsWinOpDisableFocusChangeEvents:
   284 		aText.Append(_L("DisableFocusChangeEvents()")); 	
   285 		break;
   286 	default:
   287 		decodeWindow(aText,aOpcode,aCmdData);
   288 		break;
   289 		}
   290 	}
   291 
   292 void TWsDecoder::DecodeClient(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
   293 	{
   294 	TWsClCmdUnion pData;
   295 
   296 	aText.Format(_L("RWsSession[%d]::"),aHandle);
   297 	pData.any=aCmdData;
   298 	switch (aOpcode)
   299 		{
   300 	case EWsClOpDisconnect:
   301 		aText.AppendFormat(LogClose);
   302 		break;
   303 	case EWsClOpSetHotKey:
   304 		aText.AppendFormat(_L("SetHotKey(%u, %u, 0x%04x, 0x%04x)"),
   305 										pData.SetHotKey->type,
   306 										pData.SetHotKey->keycode,
   307 										pData.SetHotKey->modifiers,
   308 										pData.SetHotKey->modifierMask);
   309 		break;
   310 	case EWsClOpClearHotKeys:
   311 		aText.AppendFormat(_L("ClearHotKeys(%d)"),*pData.UInt);
   312 		break;
   313 	case EWsClOpRestoreDefaultHotKey:
   314 		aText.AppendFormat(_L("ResetDefaultHotKey(%d)"),*pData.UInt);
   315 		break;
   316 	case EWsClOpComputeMode:
   317 		aText.AppendFormat(_L("ComputeMode(%u)"),*pData.UInt);
   318 		break;
   319 	case EWsClOpEventReady:
   320 		aText.AppendFormat(_L("EventReady(TInt *stat)"));
   321 		break;
   322 	case EWsClOpRedrawReady:
   323 		aText.AppendFormat(_L("RedrawReady(TInt *stat)"));
   324 		break;
   325 	case EWsClOpPriorityKeyReady:
   326 		aText.AppendFormat(_L("PriorityKeyReady(TInt *stat)"));
   327 		break;
   328 	case EWsClOpEventReadyCancel:
   329 		aText.AppendFormat(_L("EventReadyCancel()"));
   330 		break;
   331 	case EWsClOpRedrawReadyCancel:
   332 		aText.AppendFormat(_L("RedrawReadyCancel()"));
   333 		break;
   334 	case EWsClOpPriorityKeyReadyCancel:
   335 		aText.AppendFormat(_L("PriorityKeyReadyCancel()"));
   336 		break;
   337 	case EWsClOpGetEvent:
   338 		aText.AppendFormat(_L("GetEvent(TWsEvent *aEvent)"));
   339 		break;
   340 	case EWsClOpGetRedraw:
   341 		aText.AppendFormat(_L("GetRedraw(TWsRedrawEvent *aEvent)"));
   342 		break;
   343 	case EWsClOpGetPriorityKey:
   344 		aText.AppendFormat(_L("GetPriorityKey(TWsPriorityKeyEvent *aEvent)"));
   345 		break;
   346 	case EWsClOpCreateWindow:
   347 	case EWsClOpCreateGc:
   348 	case EWsClOpCreateWindowGroup:
   349 	case EWsClOpCreateAnimDll:
   350 	case EWsClOpCreateScreenDevice:
   351 	case EWsClOpCreateSprite:
   352 	case EWsClOpCreatePointerCursor:
   353 	case EWsClOpCreateBitmap:
   354 	case EWsClOpCreateDirectScreenAccess:
   355 	case EWsClOpCreateClick:
   356 		switch(aOpcode)
   357 			{
   358 			case EWsClOpCreateWindow:
   359 				aText.AppendFormat(_L("CreateWindow(%d,%x)"),hHandleToValue(pData.CreateWindow->parent),pData.CreateWindow->clientHandle);
   360 				break;
   361 			case EWsClOpCreateGc:
   362 				aText.AppendFormat(_L("CreateGc()"));
   363 				break;
   364 			case EWsClOpCreateWindowGroup:
   365 				aText.AppendFormat(_L("CreateWindowGroup(%x)"),pData.CreateWindow->clientHandle);
   366 				break;
   367 			case EWsClOpCreateAnimDll:
   368 				TDebugLogTextHandler::Append(aText, _L("LoadAnimDll(\""));
   369 				if (pData.LoadAnimDll && (pData.LoadAnimDll->length >= 0) && (pData.LoadAnimDll->length < LogTBufSize - 22))
   370 					TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.LoadAnimDll+1), pData.LoadAnimDll->length));
   371 				else
   372 					TDebugLogTextHandler::Append(aText, _L("<INVALID DESCRIPTOR>"));
   373 				TDebugLogTextHandler::Append(aText, _L("\")"));
   374 				break;
   375 			case EWsClOpCreateScreenDevice:
   376 				aText.AppendFormat(_L("CreateScreenDevice()"));
   377 				break;
   378 			case EWsClOpCreateSprite:
   379 				aText.AppendFormat(_L("CreateSprite(...)"));
   380 				break;
   381 			case EWsClOpCreatePointerCursor:
   382 				aText.AppendFormat(_L("CreatePointerCursor(...)"));
   383 				break;
   384 			case EWsClOpCreateBitmap:
   385 				aText.AppendFormat(_L("CreateBitmap(...)"));
   386 				break;
   387 			case EWsClOpCreateDirectScreenAccess:
   388 				aText.AppendFormat(_L("CreateDirectScreenAccess()"));
   389 				break;
   390 			case EWsClOpCreateClick:
   391 				aText.AppendFormat(_L("CreateSoundPlugin()"));
   392 				break;
   393 			}
   394 		break;
   395 	case EWsClOpHeapCount:
   396 		aText.AppendFormat(_L("HeapCount()"));
   397 		break;
   398 	case EWsClOpDebugInfo:
   399 		aText.AppendFormat(_L("DebugInfo(%d,%d)"), pData.DebugInfo->iFunction, pData.DebugInfo->iParam);
   400 		break;
   401 	case EWsClOpDebugInfoReplyBuf:
   402 		aText.AppendFormat(_L("DebugInfo(%d,%d,...)"), pData.DebugInfo->iFunction, pData.DebugInfo->iParam);
   403 		break;
   404 	case EWsClOpTestInvariant:
   405 		aText.AppendFormat(_L("unimplemented opcode 'EWsClOpTestInvariant' (%u)"), aOpcode);
   406 		break;
   407 	case EWsClOpSetShadowVector:
   408 		{
   409 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
   410 		aText.AppendFormat(_L("SetShadowVector(%S)"), &buf);
   411 		break;
   412 		}
   413 	case EWsClOpShadowVector:
   414 		aText.Append(_L("ShadowVector()"));
   415 		break;
   416 	case EWsClOpResourceCount:
   417 		aText.Append(_L("ResourceCount()"));
   418 		break;
   419 	case EWsClOpSetKeyboardRepeatRate:
   420 		aText.Append(_L("SetKeyboardRepeatRate(...,...)"));
   421 		break;
   422 	case EWsClOpGetKeyboardRepeatRate:
   423 		aText.Append(_L("GetKeyboardRepeatRate(...,...)"));
   424 		break;
   425 	case EWsClOpSetDoubleClick:
   426 		aText.AppendFormat(_L("SetDoubleClickSettings(...,%d)"), pData.SetDoubleClick->distance);
   427 		break;
   428 	case EWsClOpGetDoubleClickSettings:
   429 		aText.Append(_L("GetDoubleClickSettings(...,...)"));
   430 		break;
   431 	case EWsClOpHeapSetFail:
   432 		aText.AppendFormat(_L("HeapSetFail(%d, %d)"), pData.HeapSetFail->type, pData.HeapSetFail->value);
   433 		break;
   434 	case EWsClOpNumWindowGroups:
   435 		aText.AppendFormat(_L("NumWindowGroups(%d)"),*pData.UInt);
   436 		break;
   437 	case EWsClOpNumWindowGroupsAllPriorities:
   438 		aText.Append(_L("NumWindowGroups()"));
   439 		break;
   440 	case EWsClOpWindowGroupList:
   441 		aText.AppendFormat(_L("WindowGroupList(...,%d,%d)"),pData.WindowGroupList->priority, pData.WindowGroupList->count);
   442 		break;
   443 	case EWsClOpWindowGroupListAllPriorities:
   444 		aText.AppendFormat(_L("WindowGroupList(...,%d)"),pData.WindowGroupList->count);
   445 		break;
   446 	case EWsClOpGetFocusWindowGroup:
   447 		aText.AppendFormat(_L("GetFocusWindowGroup(%d, ...)"), *pData.UInt);
   448 		break;
   449 	case EWsClOpGetDefaultOwningWindow:
   450 		aText.Append(_L("GetDefaultOwningWindow()"));
   451 		break;
   452 	case EWsClOpSetWindowGroupOrdinalPosition:
   453 		aText.AppendFormat(_L("SetWindowGroupOrdinalPosition(%d, %d)"),
   454 							pData.SetWindowGroupOrdinalPosition->identifier,
   455 							pData.SetWindowGroupOrdinalPosition->position);
   456 		break;
   457 	case EWsClOpGetWindowGroupHandle:
   458 		aText.AppendFormat(_L("GetWindowGroupHandle(%d)"),*pData.Int);
   459 		break;
   460 	case EWsClOpGetWindowGroupOrdinalPriority:
   461 		aText.AppendFormat(_L("GetWindowGroupOrdinalPriority(%d)"),*pData.Int);
   462 		break;
   463 	case EWsClOpGetWindowGroupClientThreadId:
   464 		aText.AppendFormat(_L("GetWindowGroupClientThreadId(%d)"),*pData.Int);
   465 		break;
   466 	case EWsClOpGetWindowGroupNameFromIdentifier:
   467 		aText.AppendFormat(_L("GetWindowGroupNameFromIdentifier(%d)"),pData.GetWindowGroupNameFromIdentifier->identifier);
   468 		break;
   469 	case EWsClOpFindWindowGroupIdentifier:
   470 		aText.AppendFormat(_L("FindWindowGroupIdentifier(%d,...,%d)"),pData.FindWindowGroupIdentifier->identifier,
   471 						pData.FindWindowGroupIdentifier->offset);
   472 		break;
   473 	case EWsClOpFindWindowGroupIdentifierThread:
   474 		aText.AppendFormat(_L("FindWindowGroupIdentifier(%d,0x%x)"),pData.FindWindowGroupIdentifierThread->identifier,
   475 						pData.FindWindowGroupIdentifierThread->threadId.Id());
   476 		break;
   477 	case EWsClOpSendMessageToWindowGroup:
   478 		aText.AppendFormat(_L("SendMessageToWindowGroup(0x%x,0x%x,...)"),pData.SendMessageToWindowGroup->identifierOrPriority,
   479 						pData.SendMessageToWindowGroup->uid, pData.SendMessageToWindowGroup->dataLength);
   480 		break;
   481 	case EWsClOpSendMessageToAllWindowGroups:
   482 		aText.AppendFormat(_L("SendMessageToAllWindowGroups(0x%x,...)"),pData.SendMessageToWindowGroup->uid, pData.SendMessageToWindowGroup->dataLength);
   483 		break;
   484 	case EWsClOpSendMessageToAllWindowGroupsPriority:
   485 		aText.AppendFormat(_L("SendMessageToAllWindowGroups(%d,0x%x,...)"),pData.SendMessageToWindowGroup->identifierOrPriority,
   486 						pData.SendMessageToWindowGroup->uid, pData.SendMessageToWindowGroup->dataLength);
   487 		break;
   488 	case EWsClOpFetchMessage:
   489 		aText.AppendFormat(_L("FetchMessage(...)"));
   490 		break;
   491 	case EWsClOpSetSystemPointerCursor:
   492 		aText.AppendFormat(_L("SetSystemPointerCursor(...,%d)"), pData.SetSystemPointerCursor->number);
   493 		break;
   494 	case EWsClOpClearSystemPointerCursor:
   495 		aText.AppendFormat(_L("ClearSystemPointerCursor(%d)"), *pData.UInt);
   496 		break;
   497 	case EWsClOpClaimSystemPointerCursorList:
   498 		aText.Append(_L("ClaimSystemPointerCursorList()"));
   499 		break;
   500 	case EWsClOpFreeSystemPointerCursorList:
   501 		aText.Append(_L("FreeSystemPointerCursorList()"));
   502 		break;
   503 	case EWsClOpLogMessage:
   504 		aText.Append(_L("LogMessage(...)"));
   505 		break;
   506 	case EWsClOpPasswordEntered:
   507 		aText.Append(_L("PasswordEntered()"));
   508 		break;
   509 	case EWsClOpPurgePointerEvents:
   510 		aText.Append(_L("PurgePointerEvents()"));
   511 		break;
   512 	case EWsClOpRawEvent:
   513 		aText.AppendFormat(_L("SimulateRawEvent(%d,%d,{{%d,%d},%d})"),((TRawEventX *)pData.RawEvent)->Type(),
   514 								((TRawEventX *)pData.RawEvent)->Ticks(),((TRawEventX *)pData.RawEvent)->posx(),
   515 								((TRawEventX *)pData.RawEvent)->posy(),((TRawEventX *)pData.RawEvent)->scanCode());
   516 		break;
   517 	case EWsClOpSendEventToWindowGroup:
   518 		aText.AppendFormat(_L("SendEventToWindowGroup(%d,"),pData.SendEventToWindowGroup->parameter);
   519 		aText.Append(eventDetails(&pData.SendEventToWindowGroup->event));
   520 		aText.Append(LogCloseBracket);
   521 		break;
   522 	case EWsClOpSetModifierState:
   523 		aText.AppendFormat(_L("SetModifierState(%d,%d)"), pData.SetModifierState->modifier, pData.SetModifierState->state);
   524 		break;
   525 	case EWsClOpGetModifierState:
   526 		aText.Append(_L("GetModifierState()"));
   527 		break;
   528 	case EWsClOpSendOffEventsToShell:
   529 		{
   530 		_LIT(LogClientSendOffEventsToShell,"RequestOffEvents(%u,%d)");
   531 		aText.AppendFormat(LogClientSendOffEventsToShell
   532 										,pData.OffEventsToShell->on,hHandleToValue(pData.OffEventsToShell->window));
   533 		}
   534 		break;
   535 	case EWsClOpGetDefModeMaxNumColors:
   536 		{
   537 		_LIT(LogClientGetDefModeMaxNumColors,"GetDefModeMaxNumColors()");
   538 		aText.Append(LogClientGetDefModeMaxNumColors);
   539 		}
   540 		break;
   541 	case EWsClOpGetColorModeList:
   542 		{
   543 		_LIT(LogClientGetColorModeList,"GetColorModeList()");
   544 		aText.Append(LogClientGetColorModeList);
   545 		}
   546 		break;
   547 	case EWsClOpKeyEvent:
   548 		{
   549 		_LIT(LogClientKeyEvent,"SimulateKeyEvent(%d)");
   550 		aText.AppendFormat(LogClientKeyEvent,pData.KeyEvent->iCode);
   551 		}
   552 		break;
   553 	case EWsClOpSendEventToAllWindowGroup:
   554 		{
   555 		_LIT(LogClientSendEventToAllWindowGroups,"SendEventToAllWindowGroups(");
   556 		aText.Append(LogClientSendEventToAllWindowGroups);
   557 		aText.Append(eventDetails(&pData.SendEventToWindowGroup->event));
   558 		aText.Append(LogCloseBracket);
   559 		}
   560 		break;
   561 	case EWsClOpSendEventToAllWindowGroupPriority:
   562 		{
   563 		_LIT(LogClientSendEventToAllWindowGroupPriority,"SendEventToAllWindowGroups(%d,");
   564 		aText.AppendFormat(LogClientSendEventToAllWindowGroupPriority,pData.SendEventToWindowGroup->parameter);
   565 		aText.Append(eventDetails(&pData.SendEventToWindowGroup->event));
   566 		aText.Append(LogCloseBracket);
   567 		}
   568 		break;
   569 	case EWsClOpSetPointerCursorArea:
   570 		{
   571 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.SetPointerCursorArea->area));
   572 		_LIT(LogClientSetPointerCursorArea,"SetPointerCursorArea(%d,%S)");
   573 		aText.AppendFormat(LogClientSetPointerCursorArea,pData.SetPointerCursorArea->mode,&buf);
   574 		}
   575 		break;
   576 	case EWsClOpPointerCursorArea:
   577 		{
   578 		_LIT(LogClientPointerCursorArea,"PointerCursorArea(%d)");
   579 		aText.AppendFormat(LogClientPointerCursorArea,*pData.Int);
   580 		}
   581 		break;
   582 	case EWsClOpSetPointerCursorMode:
   583 		{
   584 		_LIT(LogClientSetPointerCursorMode,"SetPointerCursorMode(%d)");
   585 		aText.AppendFormat(LogClientSetPointerCursorMode,*pData.Mode);
   586 		}
   587 		break;
   588 	case EWsClOpPointerCursorMode:
   589 		{
   590 		_LIT(LogClientPointerCursorMode,"PointerCursorMode()");
   591 		aText.Append(LogClientPointerCursorMode);
   592 		}
   593 		break;
   594 	case EWsClOpSetDefaultSystemPointerCursor:
   595 		{
   596 		_LIT(LogClientSetDefaultSystemPointerCursor,"SetDefaultSystemPointerCursor(%d)");
   597 		aText.AppendFormat(LogClientSetDefaultSystemPointerCursor,*pData.Int);
   598 		}
   599 		break;
   600 	case EWsClOpClearDefaultSystemPointerCursor:
   601 		{
   602 		_LIT(LogClientClearDefaultSystemPointerCursor,"ClearDefaultSystemPointerCursor()");
   603 		aText.Append(LogClientClearDefaultSystemPointerCursor);
   604 		}
   605 		break;
   606 	case EWsClOpSetPointerCursorPosition:
   607 		{
   608 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
   609 		_LIT(LogClientSetPointerCursorPosition,"SetPointerCursorPosition(%S)");
   610 		aText.AppendFormat(LogClientSetPointerCursorPosition,&buf);
   611 		}
   612 		break;
   613 	case EWsClOpPointerCursorPosition:
   614 		{
   615 		_LIT(LogClientPointerCursorPosition,"PointerCursorPosition()");
   616 		aText.Append(LogClientPointerCursorPosition);
   617 		}
   618 		break;
   619 	case EWsClOpSetDefaultFadingParams:
   620 		{
   621 		_LIT(LogClientSetDefaultFadingParams,"SetDefaultFadingParameters(%d,%d)");
   622 		aText.AppendFormat(LogClientSetDefaultFadingParams
   623 								,WservEncoding::ExtractFirst8BitValue(*pData.UInt),WservEncoding::ExtractSecond8BitValue(*pData.UInt));
   624 		}
   625 		break;
   626 	case EWsClOpPrepareForSwitchOff:
   627 		{
   628 		_LIT(LogClientPrepareForSwitchOff,"PrepareForSwitchOff()");
   629 		aText.Append(LogClientPrepareForSwitchOff);
   630 		}
   631 		break;
   632 	case EWsClOpSetFaded:
   633 		{
   634 		_LIT(LogWinSetFade,"SetSystemFade(%d");
   635 		aText.AppendFormat(LogWinSetFade,pData.SetSystemFaded->Faded());
   636 		if (!pData.SetSystemFaded->UseDefaultMap())
   637 			{
   638 			_LIT(LogWinSetFade2,",%d,%d");
   639 			TUint8 blackMap;
   640 			TUint8 whiteMap;
   641 			pData.SetSystemFaded->GetFadingParams(blackMap,whiteMap);
   642 			aText.AppendFormat(LogWinSetFade2,blackMap,whiteMap);
   643 			}
   644 		aText.Append(LogCloseBracket);
   645 		}
   646 		break;
   647 	case EWsClOpLogCommand:
   648 		{
   649 		_LIT(LogClientLogCommand,"LogCommand(%d)");
   650 		aText.AppendFormat(LogClientLogCommand,*pData.UInt);
   651 		}
   652 		break;
   653 	case EWsClOpSendEventToOneWindowGroupPerClient:
   654 		{
   655 		_LIT(LogClientSendEventToOneWindowGroupPerClient,"SendEventToOneWindowGroupsPerClient(");
   656 		aText.Append(LogClientSendEventToOneWindowGroupPerClient);
   657 		aText.Append(eventDetails(&pData.SendEventToWindowGroup->event));
   658 		aText.Append(LogCloseBracket);
   659 		}
   660 		break;
   661 	case EWsClOpStartSetCustomTextCursor:
   662 		{
   663 		_LIT(LogClientStartSetCustomTextCursor,"StartSetCustomTextCursorL(id=0x%08x, flags=0x%08x, align=%d)");
   664 		aText.AppendFormat(LogClientStartSetCustomTextCursor, pData.CustomTextCursorData->identifier, pData.CustomTextCursorData->flags, pData.CustomTextCursorData->alignment);
   665 		}
   666 		break;
   667 	case EWsClOpCompleteSetCustomTextCursor:
   668 		{
   669 		_LIT(LogClientCompleteSetCustomTextCursor,"CompleteSetCustomTextCursorL(err=%d)");
   670 		aText.AppendFormat(LogClientCompleteSetCustomTextCursor, *pData.Int);
   671 		}
   672 		break;
   673 #if defined(__WINS__)
   674 	case EWsClOpRemoveKeyCode:
   675 		{
   676 		_LIT(LogClientRemoveKeyCode,"RemoveKeyCode(%d)");
   677 		aText.AppendFormat(LogClientRemoveKeyCode,*pData.UInt);
   678 		}
   679 		break;
   680 	case EWsClOpSimulateXyInput:
   681 		{
   682 		_LIT(LogClientSimulateXyInput,"SimulateXyInputType(%d)");
   683 		aText.AppendFormat(LogClientSimulateXyInput,*pData.UInt);
   684 		}
   685 		break;
   686 #endif
   687 	case EWsClOpSetBackgroundColor:
   688 		{		
   689 		TShortBuf buf(TDebugLogTextHandler::FormatRgb(*pData.rgb));
   690 		_LIT(LogClientSetBackgroundColor,"SetBackgroundColor(%S)");
   691 		aText.AppendFormat(LogClientSetBackgroundColor,&buf);
   692 		}
   693 		break;
   694 	case EWsClOpGetBackgroundColor:
   695 		{		
   696 		_LIT(LogClientGetBackgroundColor,"GetBackgroundColor()");
   697 		aText.AppendFormat(LogClientGetBackgroundColor);
   698 		}
   699 		break;
   700 	case EWsClOpSystemInfo:
   701 		{		
   702 		_LIT(LogClientSystemInfo,"SystemInfo(%d, SSystemInfo &aSystemInfo)");
   703 		aText.AppendFormat(LogClientSystemInfo, *pData.UInt);
   704 		}
   705 		break;
   706 	case EWsClOpSetFocusScreen:
   707 		{		
   708 		_LIT(LogClientSetFocusScreen,"SetFocusScreen(%d)");
   709 		aText.AppendFormat(LogClientSetFocusScreen, *pData.UInt);
   710 		}
   711 		break;
   712 	case EWsClOpGetFocusScreen:
   713 		{		
   714 		_LIT(LogClientGetFocusScreen,"GetFocusScreen()");
   715 		aText.AppendFormat(LogClientGetFocusScreen);
   716 		}
   717 		break;
   718 	case EWsClOpWindowGroupListAndChain:
   719 		{		
   720 		_LIT(LogClientWindowGroupListAndChain,"WindowGroupList(%d, RArray<TWindowGroupChainInfo>* aWindowList)");
   721 		aText.AppendFormat(LogClientWindowGroupListAndChain, *pData.UInt);
   722 		}
   723 		break;
   724 	case EWsClOpWindowGroupListAndChainAllPriorities:
   725 		{		
   726 		_LIT(LogClientWindowGroupListAndChainAllPriorities,"WindowGroupListAndChainAllPriorities(RArray<TWindowGroupChainInfo>* aWindowList)");
   727 		aText.AppendFormat(LogClientWindowGroupListAndChainAllPriorities);
   728 		}
   729 		break;
   730 	case EWsClOpSetClientCursorMode:
   731 		{		
   732 		_LIT(LogClientSetClientCursorMode,"SetClientCursorMode(%d)");
   733 		aText.AppendFormat(LogClientSetClientCursorMode, *pData.UInt);
   734 		}
   735 		break;
   736 	case EWsClOpClearAllRedrawStores:
   737 		{		
   738 		_LIT(LogClientClearAllRedrawStores,"ClearAllRedrawStores()");
   739 		aText.AppendFormat(LogClientClearAllRedrawStores);
   740 		}
   741 		break;
   742 	case EWsClOpGraphicMessageReady:
   743 		{		
   744 		_LIT(LogClientGraphicMessageReady,"GraphicMessageReady(%d)");
   745 		aText.AppendFormat(LogClientGraphicMessageReady, *pData.UInt);	
   746 		}
   747 		break;
   748 	case EWsClOpGetGraphicMessage:
   749 		{		
   750 		_LIT(LogClientGraphicMessage,"GetGraphicMessage(%d)");
   751 		aText.AppendFormat(LogClientGraphicMessage, *pData.UInt);	
   752 		}
   753 		break;
   754 	case EWsClOpGraphicMessageCancel:
   755 		{		
   756 		_LIT(LogClientGraphicMessageCancel,"GraphicMessageCancel()");
   757 		aText.AppendFormat(LogClientGraphicMessageCancel);	
   758 		}
   759 		break;		
   760 	case EWsClOpNumWindowGroupsOnScreen:
   761 		{		
   762 		_LIT(LogClientNumWindowGroupsOnScreen,"NumWindowGroups(%d, %d)");
   763 		aText.AppendFormat(LogClientNumWindowGroupsOnScreen, pData.NumWinGroups->screenNumber, pData.NumWinGroups->priority);
   764 		}
   765 		break;
   766 	case EWsClOpGetNumberOfScreens:
   767 		{		
   768 		_LIT(LogClientGetNumberOfScreens,"NumberOfScreens()");
   769 		aText.AppendFormat(LogClientGetNumberOfScreens);		
   770 		}
   771 		break;
   772 	case EWsClOpNoFlickerFree:
   773 		{		
   774 		_LIT(LogNoFlickerFree,"EWsClOpNoFlickerFree enum");
   775 		aText.AppendFormat(LogNoFlickerFree);		
   776 		}
   777 		break;
   778 	case EWsClOpCreateGraphic:
   779 		{		
   780 		_LIT(LogCreateGraphic,"EWsClOpCreateGraphic enum");
   781 		aText.AppendFormat(LogCreateGraphic);		
   782 		}
   783 		break;
   784 	case EWsClOpRegisterSurface:
   785 		{
   786 		TInt screenNumber = pData.SurfaceRegister->screenNumber;
   787 		const TSurfaceId& surfaceId = pData.SurfaceRegister->surfaceId;
   788 		
   789 		_LIT(LogRegisterSurface,"RegisterSurface(aScreenNumber(%d), TSurfaceId{%x,%x,%x,%x})");
   790 		aText.AppendFormat(LogRegisterSurface, screenNumber, surfaceId.iInternal[0], surfaceId.iInternal[1], surfaceId.iInternal[2], surfaceId.iInternal[3]);
   791 		}
   792 		break;
   793 	case EWsClOpUnregisterSurface:
   794 		{
   795 		TInt screenNumber = pData.SurfaceRegister->screenNumber;
   796 		const TSurfaceId& surfaceId = pData.SurfaceRegister->surfaceId;
   797 		
   798 		_LIT(LogUnregisterSurface,"UnregisterSurface(aScreenNumber(%d), TSurfaceId{%x,%x,%x,%x})");
   799 		aText.AppendFormat(LogUnregisterSurface, screenNumber, surfaceId.iInternal[0], surfaceId.iInternal[1], surfaceId.iInternal[2], surfaceId.iInternal[3]);
   800 		}
   801 		break;
   802 	case EWsClOpSetCloseProximityThresholds:
   803 		{
   804 		_LIT(LogSetCloseProximityThresholds,"SetCloseProximityThresholds(%d, %d)");
   805 		aText.AppendFormat(LogSetCloseProximityThresholds, pData.ZThresholdPair->enterThreshold, pData.ZThresholdPair->exitThreshold);
   806 		}
   807 		break;	
   808 	case EWsClOpSetHighPressureThresholds:
   809 		{
   810 		_LIT(LogSetHighPressureThresholds,"SetHighPressureThresholds(%d, %d)");
   811 		aText.AppendFormat(LogSetHighPressureThresholds, pData.ZThresholdPair->enterThreshold, pData.ZThresholdPair->exitThreshold);	
   812 		}
   813 		break;
   814 	case EWsClOpGetEnterCloseProximityThreshold:
   815 		{		
   816 		_LIT(LogGetEnterCloseProximityThreshold,"EWsClOpGetEnterCloseProximityThreshold()");
   817 		aText.AppendFormat(LogGetEnterCloseProximityThreshold);		
   818 		}
   819 		break;	
   820 	case EWsClOpGetExitCloseProximityThreshold:
   821 		{		
   822 		_LIT(LogGetExitCloseProximityThreshold,"EWsClOpGetExitCloseProximityThreshold()");
   823 		aText.AppendFormat(LogGetExitCloseProximityThreshold);		
   824 		}
   825 		break;
   826 	case EWsClOpGetEnterHighPressureThreshold:
   827 		{		
   828 		_LIT(LogGetEnterHighPressureThreshold,"EWsClOpGetEnterHighPressureThreshold()");
   829 		aText.AppendFormat(LogGetEnterHighPressureThreshold);		
   830 		}
   831 		break;	
   832 	case EWsClOpGetExitHighPressureThreshold:
   833 		{		
   834 		_LIT(LogGetExitHighPressureThreshold,"EWsClOpGetExitHighPressureThreshold()");
   835 		aText.AppendFormat(LogGetExitHighPressureThreshold);		
   836 		}
   837 		break;
   838 	case EWsClOpIndicateAppOrientation:
   839 	    {
   840         _LIT(LogIndicateAppOrientation,"EWsClOpIndicateAppOrientation(%d)");
   841         aText.AppendFormat(LogIndicateAppOrientation, *pData.Orientation);       	    
   842 	    }
   843 	    break;
   844 	case EWsClOpLastEnumValue:
   845 		{		
   846 		_LIT(LogLastEnumValue,"EWsClOpLastEnumValue enum");
   847 		aText.AppendFormat(LogLastEnumValue);		
   848 		}
   849 		break;
   850 	default:
   851 		UnKnownOpcode(aText, aOpcode);
   852 		break;
   853 		}
   854 	}
   855 
   856 void TWsDecoder::DecodeWindow(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
   857 	{
   858 	_LIT(LogWindow,"RWindow[%d]::");
   859 	aText.Format(LogWindow,aHandle);
   860 	decodeWindow(aText,aOpcode,aCmdData);
   861 	}
   862 
   863 void TWsDecoder::decodeWindow(TBuf<LogTBufSize> &aText,TInt aOpcode,const TAny *aData)
   864 	{
   865 	TWsWinCmdUnion pData;
   866 	pData.any=aData;
   867 	switch (aOpcode)
   868 		{
   869 	case EWsWinOpFree:
   870 		aText.AppendFormat(LogClose);
   871 		break;
   872 	case EWsWinOpSetExtent:
   873 		{
   874 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.SetEx->pos));
   875 		TShortBuf buf2(TDebugLogTextHandler::FormatSize(pData.SetEx->size));
   876 		aText.AppendFormat(_L("SetExtent(%S, %S)"), &buf1, &buf2);
   877 		}
   878 		break;
   879 	case EWsWinOpSetExtentErr:
   880 		{
   881 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.SetEx->pos));
   882 		TShortBuf buf2(TDebugLogTextHandler::FormatSize(pData.SetEx->size));
   883 		aText.AppendFormat(_L("SetExtentError(%S, %S)"), &buf1, &buf2);
   884 		}
   885 		break;
   886 	case EWsWinOpOrdinalPosition:
   887 		aText.AppendFormat(_L("OrdinalPosition()"));
   888 		break;
   889 	case EWsWinOpFullOrdinalPosition:
   890 		aText.AppendFormat(_L("FullOrdinalPosition()"));
   891 		break;
   892 	case EWsWinOpSetOrdinalPosition:
   893 		aText.AppendFormat(_L("SetOrdinalPosition(%d)"),*pData.Int);
   894 		break;
   895 	case EWsWinOpSetOrdinalPositionPri:
   896 		aText.AppendFormat(_L("SetOrdinalPosition(%d,%d)"), pData.OrdinalPos->pos, pData.OrdinalPos->ordinalPriority);
   897 		break;
   898 	case EWsWinOpSetPos:
   899 		{
   900 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.pos));
   901 		aText.AppendFormat(_L("SetPosition(%S)"),&buf);
   902 		}
   903 		break;
   904 	case EWsWinOpSetSizeErr:
   905 		{
   906 		TShortBuf buf(TDebugLogTextHandler::FormatSize(*pData.size));
   907 		aText.AppendFormat(_L("SetSizeErr(%S)"), &buf);
   908 		}
   909 		break;
   910 	case EWsWinOpSetSize:
   911 		{
   912 		TShortBuf buf(TDebugLogTextHandler::FormatSize(*pData.size));
   913 		aText.AppendFormat(_L("SetSize(%S)"), &buf);
   914 		}
   915 		break;
   916 	case EWsWinOpPosition:
   917 		aText.AppendFormat(_L("Position()"));
   918 		break;
   919 	case EWsWinOpAbsPosition:
   920 		aText.AppendFormat(_L("AbsPosition()"));
   921 		break;
   922 	case EWsWinOpSize:
   923 		aText.AppendFormat(_L("Size()"));
   924 		break;
   925 	case EWsWinOpActivate:
   926 		aText.AppendFormat(_L("Activate()"));
   927 		break;
   928 	case EWsWinOpInvalidate:
   929 		{
   930 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.rect));
   931 		aText.AppendFormat(_L("Invalidate(%S)"), &buf);
   932 		}
   933 		break;
   934 	case EWsWinOpInvalidateFull:
   935 		aText.AppendFormat(_L("Invalidate()"));
   936 		break;
   937 	case EWsWinOpBeginRedraw:
   938 		{
   939 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.rect));
   940 		aText.AppendFormat(_L("BeginRedraw(%S)"), &buf);
   941 		}
   942 		break;
   943 	case EWsWinOpBeginRedrawFull:
   944 		aText.AppendFormat(_L("BeginRedraw()"));
   945 		break;
   946 	case EWsWinOpEndRedraw:
   947 		aText.AppendFormat(_L("EndRedraw()"));
   948 		break;
   949 	case EWsWinOpTestInvariant:
   950 		aText.AppendFormat(_L("__TestInvariant()"));
   951 		break;
   952 	case EWsWinOpParent:
   953 		aText.AppendFormat(_L("Parent()"));
   954 		break;
   955 	case EWsWinOpNextSibling:
   956 		aText.AppendFormat(_L("NextSibling()"));
   957 		break;
   958 	case EWsWinOpPrevSibling:
   959 		aText.AppendFormat(_L("PrevSibling()"));
   960 		break;
   961 	case EWsWinOpChild:
   962 		aText.AppendFormat(_L("Child()"));
   963 		break;
   964 	case EWsWinOpInquireOffset:
   965 		aText.AppendFormat(_L("InquireOffset(%d)"),hHandleToValue(*pData.UInt));
   966 		break;
   967 	case EWsWinOpPointerFilter:
   968 		aText.AppendFormat(_L("PointerFilter(0x%08x)"), *pData.UInt);
   969 		break;
   970 	case EWsWinOpSetPointerCapture:
   971 		aText.AppendFormat(_L("SetPointerCapture(%u)"), *pData.UInt);
   972 		break;
   973 	case EWsWinOpSetPointerGrab:
   974 		aText.AppendFormat(_L("SetPointerGrab(%u)"), *pData.UInt);
   975 		break;
   976 	case EWsWinOpSetNoBackgroundColor:
   977 		aText.Append(_L("SetBackgroundColor()"));
   978 		break;
   979 	case EWsWinOpSetBackgroundColor:
   980 		{
   981 		TLongBuf buf(TDebugLogTextHandler::FormatRgb(*pData.rgb));
   982 		aText.AppendFormat(_L("SetBackgroundColor(%S)"), &buf);
   983 		}
   984 		break;
   985 	case EWsWinOpSetColor:
   986 		{
   987 		TLongBuf buf(TDebugLogTextHandler::FormatRgb(*pData.rgb));
   988 		aText.AppendFormat(_L("SetColor(%S)"), &buf);
   989 		}
   990 		break;
   991 	case EWsWinOpSetShadowHeight:
   992 		aText.AppendFormat(_L("SetShadowHeight(%d)"), *pData.Int);
   993 		break;
   994 	case EWsWinOpShadowDisabled:
   995 		{
   996 		TShortBuf buf(TDebugLogTextHandler::FormatBool(*pData.Bool));
   997 		aText.AppendFormat(_L("SetShadowDisabled(%S)"), &buf);
   998 		}
   999 		break;
  1000 	case EWsWinOpSetVisible:
  1001 		{
  1002 		TShortBuf buf(TDebugLogTextHandler::FormatBool(*pData.Bool));
  1003 		aText.AppendFormat(_L("SetVisible(%S)"), &buf);
  1004 		}
  1005 		break;
  1006 	case EWsWinOpUpdateScreen:
  1007 		aText.Append(_L("UpdateScreen()"));
  1008 		break;
  1009 	case EWsWinOpUpdateScreenRegion:
  1010 		aText.Append(_L("UpdateScreenRegion(TRegion(...))"));
  1011 		break;
  1012 	case EWsWinOpMaintainBackup:
  1013 		aText.Append(_L("MaintainBackup()"));
  1014 		break;
  1015 	case EWsWinOpGetInvalidRegion:
  1016 		aText.Append(_L("GetInvalidRegion(...)"));
  1017 		break;
  1018 	case EWsWinOpGetInvalidRegionCount:
  1019 		aText.Append(_L("GetInvalidRegionCount()"));
  1020 		break;
  1021 	case EWsWinOpScroll:
  1022 		{
  1023 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.ScrollRect->offset));
  1024 		aText.AppendFormat(_L("Scroll(%S)"), &buf);
  1025 		}
  1026 		break;
  1027 	case EWsWinOpScrollClip:
  1028 		{
  1029 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.ScrollRect->clip));
  1030 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(pData.ScrollRect->offset));
  1031 		aText.AppendFormat(_L("Scroll(%S, %S)"), &buf1, &buf2);
  1032 		}
  1033 		break;
  1034 	case EWsWinOpScrollRect:
  1035 		{
  1036 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.ScrollRect->offset));
  1037 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.ScrollRect->rect));
  1038 		aText.AppendFormat(_L("Scroll(%S, %S)"), &buf1, &buf2);
  1039 		}
  1040 		break;
  1041 	case EWsWinOpScrollClipRect:
  1042 		{
  1043 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.ScrollRect->clip));
  1044 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(pData.ScrollRect->offset));
  1045 		TLongBuf buf3(TDebugLogTextHandler::FormatRect(pData.ScrollRect->rect));
  1046 		aText.AppendFormat(_L("Scroll(%S, %S, %S)"), &buf1, &buf2, &buf3);
  1047 		}
  1048 		break;
  1049 	case EWsWinOpBitmapHandle:
  1050 		aText.Append(_L("BitmapHandle()"));
  1051 		break;
  1052 	case EWsWinOpUpdateBackupBitmap:
  1053 		aText.Append(_L("UpdateBackupBitmap()"));
  1054 		break;
  1055 	case EWsWinOpRequiredDisplayMode:
  1056 		aText.AppendFormat(_L("SetRequiredDisplayMode(%d)"), *pData.UInt);
  1057 		break;
  1058 	case EWsWinOpSetCornerType:
  1059 		aText.AppendFormat(_L("SetCornerType(%d)"), *pData.UInt);
  1060 		break;
  1061 	case EWsWinOpSetShape:
  1062 		aText.AppendFormat(_L("SetWindowShape(%d rects)"), pData.SetShape->count);
  1063 		break;
  1064 	case EWsWinOpSetName:
  1065 		aText.Append(_L("SetName(\"...\")"));
  1066 		break;
  1067 	case EWsWinOpName:
  1068 		aText.Append(_L("Name()"));
  1069 		break;
  1070 	case EWsWinOpSetOwningWindowGroup:
  1071 		aText.AppendFormat(_L("SetOwningWindowGroup(%d)"),*pData.Int);
  1072 		break;
  1073 	case EWsWinOpDefaultOwningWindow:
  1074 		aText.Append(_L("DefaultOwningWindow()"));
  1075 		break;
  1076 	case EWsWinOpEnableOnEvents:
  1077 		aText.AppendFormat(_L("EnableOnEvents(%d)"),*pData.Int);
  1078 		break;
  1079 	case EWsWinOpDisableOnEvents:
  1080 		aText.Append(_L("DisableOnEvents()"));
  1081 		break;
  1082 	case EWsWinOpEnableErrorMessages:
  1083 		aText.AppendFormat(_L("EnableErrorMessages(%d)"),*pData.Int);
  1084 		break;
  1085 	case EWsWinOpDisableErrorMessages:
  1086 		aText.Append(_L("DisableErrorMessages()"));
  1087 		break;
  1088 	case EWsWinOpEnableModifierChangedEvents:
  1089 		aText.Append(_L("EnableModifierChangedEvents()"));
  1090 		break;
  1091 	case EWsWinOpDisableModifierChangedEvents:
  1092 		aText.Append(_L("DisableModifierChangedEvents()"));
  1093 		break;
  1094 	case EWsWinOpEnableGroupChangeEvents:
  1095 		aText.Append(_L("EnableGroupChangeEvents()"));
  1096 		break;
  1097 	case EWsWinOpDisableGroupChangeEvents:
  1098 		aText.Append(_L("DisableGroupChangeEvents()"));
  1099 		break;
  1100 	case EWsWinOpRequestPointerRepeatEvent:
  1101 		{
  1102 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.RequestPointerRepeatEvent->rect));
  1103 		aText.AppendFormat(_L("RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(%d), %S)"), 
  1104 								pData.RequestPointerRepeatEvent->time.Int(), &buf);
  1105 		}
  1106 		break;
  1107 	case EWsWinOpCancelPointerRepeatEventRequest:
  1108 		aText.Append(_L("CancelPointerRepeatEventRequest()"));
  1109 		break;
  1110 	case EWsWinOpSetPointerCursor:
  1111 		aText.AppendFormat(_L("SetPointerCursor(%d)"),*pData.UInt);
  1112 		break;
  1113 	case EWsWinOpSetCustomPointerCursor:
  1114 		aText.AppendFormat(_L("SetCustomPointerCursor(%d)"),*pData.UInt);
  1115 		break;
  1116 	case EWsWinOpPasswordWindow:
  1117 		aText.AppendFormat(_L("PasswordWindow(%d)"),*pData.PasswordMode);
  1118 		break;
  1119 	case EWsWinOpAddKeyRect:
  1120 		{
  1121 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.AddKeyRect->rect));
  1122 		aText.AppendFormat(_L("AddKeyRect(%S,%d,%d)"),&buf,pData.AddKeyRect->scanCode,pData.AddKeyRect->activatedByPointerSwitchOn);
  1123 		}
  1124 		break;
  1125 	case EWsWinOpRemoveAllKeyRects:
  1126 		aText.Append(_L("RemoveAllKeyRects()"));
  1127 		break;
  1128 	case EWsWinOpAllocPointerMoveBuffer:
  1129 		aText.AppendFormat(_L("AllocPointerMoveBuffer(%d,%d)"),pData.AllocPointerMoveBuffer->maxNumPoints,pData.AllocPointerMoveBuffer->flags);
  1130 		break;
  1131 	case EWsWinOpFreePointerMoveBuffer:
  1132 		aText.Append(_L("FreePointerMoveBuffer()"));
  1133 		break;
  1134 	case EWsWinOpEnablePointerMoveBuffer:
  1135 		aText.Append(_L("EnablePointerMoveBuffer()"));
  1136 		break;
  1137 	case EWsWinOpDisablePointerMoveBuffer:
  1138 		aText.Append(_L("DisablePointerMoveBuffer()"));
  1139 		break;
  1140 	case EWsWinOpRetrievePointerMoveBuffer:
  1141 		aText.Append(_L("RetrievePointerMoveBuffer(...)"));
  1142 		break;
  1143 	case EWsWinOpDiscardPointerMoveBuffer:
  1144 		aText.Append(_L("DiscardPointerMoveBuffer()"));
  1145 		break;
  1146 	case EWsWinOpEnableBackup:
  1147 		aText.Append(_L("EnableBackup()"));
  1148 		break;
  1149 	case EWsWinOpClaimPointerGrab:
  1150 		aText.Append(_L("ClaimPointerGrab()"));
  1151 		break;
  1152 	case EWsWinOpIdentifier:
  1153 		aText.Append(_L("Identifier()"));
  1154 		break;
  1155 	case EWsWinOpSetFade:
  1156 		{
  1157 		_LIT(LogWinSetFade,"SetFade(%d,%d");
  1158 		aText.AppendFormat(LogWinSetFade,pData.SetFaded->Faded(),pData.SetFaded->IncludeChildren());
  1159 		if (!pData.SetFaded->UseDefaultMap())
  1160 			{
  1161 			_LIT(LogWinSetFade2,",%d,%d");
  1162 			TUint8 blackMap;
  1163 			TUint8 whiteMap;
  1164 			pData.SetFaded->GetFadingParams(blackMap,whiteMap);
  1165 			aText.AppendFormat(LogWinSetFade2,blackMap,whiteMap);
  1166 			}
  1167 		aText.Append(LogCloseBracket);
  1168 		}
  1169 		break;
  1170 	case EWsWinOpSetNonFading:
  1171 		{
  1172 		_LIT(LogWinSetNonFading,"SetNonFading(%d)");
  1173 		aText.AppendFormat(LogWinSetNonFading,*(pData.Bool));
  1174 		}
  1175 		break;
  1176 	case EWsWinOpFadeBehind:
  1177 		{
  1178 		_LIT(LogWinFadeBehind,"FadeBehind(%d)");
  1179 		aText.AppendFormat(LogWinFadeBehind,*(pData.Bool));
  1180 		}
  1181 		break;
  1182 	case EWsWinOpEnableScreenChangeEvents:
  1183 		{
  1184 		_LIT(LogWinEnableScreenChangeEvents,"EnableScreenChangeEvents()");
  1185 		aText.Append(LogWinEnableScreenChangeEvents);
  1186 		}
  1187 		break;
  1188 	case EWsWinOpDisableScreenChangeEvents:
  1189 		{
  1190 		_LIT(LogWinDisableScreenChangeEvents,"DisableScreenChangeEvents()");
  1191 		aText.Append(LogWinDisableScreenChangeEvents);
  1192 		}
  1193 		break;
  1194 	case EWsWinOpSendPointerEvent:
  1195 		{
  1196 		_LIT(LogWinSendPointerEvent,"SimulatePointerEvent(");
  1197 		aText.Append(LogWinSendPointerEvent);
  1198 		aText.Append(eventDetails(pData.RawEvent));
  1199 		aText.Append(LogCloseBracket);
  1200 		}
  1201 		break;
  1202 	case EWsWinOpSendAdvancedPointerEvent:
  1203 		{
  1204 		_LIT(LogWinSendPointerEvent,"SimulateAdvancedPointerEvent(");
  1205 		aText.Append(LogWinSendPointerEvent);
  1206 		aText.Append(eventDetails(pData.RawEvent));
  1207 		aText.Append(LogCloseBracket);
  1208 		}
  1209 		break;
  1210 	case EWsWinOpGetDisplayMode:
  1211 		{
  1212 		_LIT(LogWinGetDisplayMode,"GetDisplayMode()");
  1213 		aText.Append(LogWinGetDisplayMode);
  1214 		}
  1215 		break;
  1216 	case EWsWinOpGetIsFaded:
  1217 		{
  1218 		_LIT(LogWinIsFaded,"IsFaded()");
  1219 		aText.Append(LogWinIsFaded);
  1220 		}
  1221 		break;
  1222 	case EWsWinOpGetIsNonFading:
  1223 		{
  1224 		_LIT(LogWinIsNonFading,"IsNonFading()");
  1225 		aText.Append(LogWinIsNonFading);
  1226 		}
  1227 		break;
  1228 	case EWsWinOpOrdinalPriority:
  1229 		{
  1230 		_LIT(LogWinOrdinalPriority,"OrdinalPriority()");
  1231 		aText.Append(LogWinOrdinalPriority);
  1232 		}
  1233 		break;
  1234 	case EWsWinOpClearPointerCursor:
  1235 		{
  1236 		_LIT(LogWinClearPointerCursor,"ClearPointerCursor()");
  1237 		aText.Append(LogWinClearPointerCursor);
  1238 		}
  1239 		break;
  1240 	case EWsWinOpEnableGroupListChangeEvents:
  1241 		{
  1242 		_LIT(LogWinEnableGroupListChangeEvents,"EnableGroupListChangeEvents()");
  1243 		aText.Append(LogWinEnableGroupListChangeEvents);
  1244 		}
  1245 		break;
  1246 	case EWsWinOpDisableGroupListChangeEvents:
  1247 		{
  1248 		_LIT(LogWinDisableGroupListChangeEvents,"DisableGroupListChangeEvents()");
  1249 		aText.Append(LogWinDisableGroupListChangeEvents);
  1250 		}
  1251 		break;
  1252 	case EWsWinOpHandleTransparencyUpdate:
  1253 		{
  1254 		_LIT(LogWinHandleTransparencyUpdate,"HandleTransparencyUpdate()");
  1255 		aText.Append(LogWinHandleTransparencyUpdate);
  1256 		}
  1257 		break;
  1258 	case EWsWinOpSetTransparencyFactor:
  1259 		{
  1260 		_LIT(LogWinSetTransparencyFactor,"SetTransparencyFactor()");
  1261 		aText.Append(LogWinSetTransparencyFactor);
  1262 		}
  1263 		break;
  1264 	case EWsWinOpSetTransparencyBitmap:
  1265 		{
  1266 		_LIT(LogWinSetTransparencyBitmap,"SetTransparencyBitmap()");
  1267 		aText.Append(LogWinSetTransparencyBitmap);
  1268 		}
  1269 		break;
  1270 	case EWsWinOpSetTransparencyBitmapCWs:
  1271 		{
  1272 		_LIT(LogWinSetTransparencyWsBitmap,"SetTransparencyWsBitmap()");
  1273 		aText.Append(LogWinSetTransparencyWsBitmap);
  1274 		}
  1275 		break;	
  1276 
  1277 	case EWsWinOpSetTransparencyAlphaChannel:
  1278 		{
  1279 		_LIT(LogWinSetTransparencyAlphaChannel,"SetTransparencyAlphaChannel()");
  1280 		aText.Append(LogWinSetTransparencyAlphaChannel);
  1281 		}
  1282 		break;	
  1283 	case EWsWinOpMoveToGroup:
  1284 		{
  1285 		_LIT(LogWinMoveToGroup,"MoveToGroup(%d)");
  1286 		aText.AppendFormat(LogWinMoveToGroup, *pData.Int);
  1287 		}
  1288 		break;	
  1289 	case EWsWinOpStoreDrawCommands:
  1290 		{
  1291 		_LIT(LogWinStoreDrawCommands,"EnableRedrawStore(%u)");
  1292 		aText.AppendFormat(LogWinStoreDrawCommands, *pData.Bool);
  1293 		}
  1294 		break;	
  1295 	case EWsWinOpSetPointerCapturePriority:
  1296 		{
  1297 		_LIT(LogWinSetPointerCapturePriority,"SetPointerCapturePriority(%d)");
  1298 		aText.AppendFormat(LogWinSetPointerCapturePriority, *pData.Int);
  1299 		}
  1300 		break;	
  1301 	case EWsWinOpGetPointerCapturePriority:
  1302 		{
  1303 		_LIT(LogWinGetPointerCapturePriority,"GetPointerCapturePriority()");
  1304 		aText.Append(LogWinGetPointerCapturePriority);
  1305 		}
  1306 		break;	
  1307 	case EWsWinOpSetTransparentRegion:
  1308 		{
  1309 		_LIT(LogWinSetTransparentRegion,"SetTransparentRegion(%d rects)");
  1310 		aText.AppendFormat(LogWinSetTransparentRegion, pData.SetShape->count);
  1311 		}
  1312 		break;	
  1313 	case EWsWinOpSetTransparencyPolicy:
  1314 		{
  1315 		_LIT(LogWinSetTransparentPolicy,"SetTransparencyPolicy(TransparencyPolicy= %d)");
  1316 		aText.AppendFormat(LogWinSetTransparentPolicy, *pData.Int);
  1317 		}
  1318 		break;	
  1319 	case EWsWinOpIsRedrawStoreEnabled:
  1320 		{
  1321 		_LIT(LogWinIsRedrawStoreEnabled,"IsRedrawStoreEnabled()");
  1322 		aText.Append(LogWinIsRedrawStoreEnabled);
  1323 		}
  1324 		break;		
  1325 	case EWsWinOpEnableOSB:
  1326 		{
  1327 		_LIT(LogOSBEnabled,"EWsWinOpEnableOSB enum");
  1328 		aText.Append(LogOSBEnabled);
  1329 		}
  1330 		break;		
  1331 	case EWsWinOpDisableOSB:
  1332 		{
  1333 		_LIT(LogOSBDisabled,"EWsWinOpDisableOSB enum");
  1334 		aText.Append(LogOSBDisabled);
  1335 		}
  1336 		break;
  1337 	case EWsWinOpClientHandle:
  1338 		{
  1339 		_LIT(LogClientHandle,"ClientHandle()");
  1340 		aText.AppendFormat(LogClientHandle);
  1341 		}
  1342 		break;
  1343     case EWsWinOpSetBackgroundSurface:
  1344         {
  1345         _LIT(LogWinSetBackgroundSurface,"SetBackgroundSurface(TSurfaceId{%x,%x,%x,%x})");
  1346         aText.AppendFormat(LogWinSetBackgroundSurface, pData.Surface->iInternal[0],pData.Surface->iInternal[1],pData.Surface->iInternal[2],pData.Surface->iInternal[3]);
  1347         }
  1348         break;
  1349     case EWsWinOpKeyColor:
  1350         {
  1351         _LIT(LogWinKeyColor,"KeyColor()");
  1352         aText.AppendFormat(LogWinKeyColor);
  1353         }
  1354         break;          
  1355     case EWsWinOpSetBackgroundSurfaceConfig:
  1356         {        
  1357         TSurfaceConfiguration aSurfaceConfig = pData.SurfaceConfigurationAndTrigger->surfaceConfig;
  1358         TSurfaceId surfaceid;
  1359         aSurfaceConfig.GetSurfaceId(surfaceid);
  1360         CFbsBitGc::TGraphicsOrientation orientation = aSurfaceConfig.Orientation();
  1361         TRect extent;
  1362         aSurfaceConfig.GetExtent(extent);
  1363         TRect viewport;
  1364         aSurfaceConfig.GetViewport(viewport);
  1365         TBool flip = aSurfaceConfig.Flip();
  1366         TBool triggerRedraw = pData.SurfaceConfigurationAndTrigger->triggerRedraw;
  1367         
  1368         TLongBuf extentbuf(TDebugLogTextHandler::FormatRect(extent));
  1369         TLongBuf viewportbuf(TDebugLogTextHandler::FormatRect(viewport));
  1370         
  1371         _LIT(LogWinSetBackgroundSurfaceConfig,"SetBackgroundSurface({%x,%x,%x,%x},%d,%S,%S,%d,%d)");
  1372         aText.AppendFormat(LogWinSetBackgroundSurfaceConfig, surfaceid.iInternal[0],
  1373                                                              surfaceid.iInternal[1],
  1374                                                              surfaceid.iInternal[2],
  1375                                                              surfaceid.iInternal[3],
  1376                                                              orientation,
  1377                                                              &extentbuf, 
  1378                                                              &viewportbuf,
  1379                                                              flip,
  1380                                                              triggerRedraw);
  1381         }
  1382         break;
  1383     case EWsWinOpRemoveBackgroundSurface:
  1384         {
  1385         _LIT(LogWinRemoveBackgroundSurface,"RemoveBackgroundSurface(%d)");
  1386         aText.AppendFormat(LogWinRemoveBackgroundSurface, *(pData.Bool));
  1387         }
  1388         break;
  1389     case EWsWinOpGetBackgroundSurfaceConfig:
  1390         {
  1391         _LIT(LogWinGetBackgroundSurfaceConfig,"GetBackgroundSurface()");
  1392         aText.AppendFormat(LogWinGetBackgroundSurfaceConfig);
  1393         }
  1394         break;
  1395     case EWsWinOpClearRedrawStore:
  1396         {
  1397         _LIT(LogWinClearRedrawStore,"ClearRedrawStore()");
  1398         aText.AppendFormat(LogWinClearRedrawStore);
  1399         }
  1400         break;
  1401 	default:
  1402 		UnKnownOpcode(aText, aOpcode);
  1403 		break;
  1404 		}
  1405 	}
  1406 
  1407 //#pragma check_stack(on)
  1408 void TWsDecoder::DecodeGc(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  1409 	{
  1410 	_LIT(LogGc,"RGc[%d]::");
  1411 	aText.Format(LogGc,aHandle);
  1412     if (aOpcode<EWsGcOpGdiBlt2)
  1413         {
  1414         if (aOpcode<EWsGcOpDrawPolyLineContinued)
  1415             DecodeGc1(aText,aOpcode,aCmdData);
  1416         else
  1417             DecodeGc2(aText,aOpcode,aCmdData);
  1418         }
  1419     else
  1420         DecodeGc3(aText,aOpcode,aCmdData);
  1421     }
  1422     
  1423 void TWsDecoder::DecodeGc1(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData)
  1424 	{
  1425 	TWsGcCmdUnion pData;
  1426 
  1427 	pData.any=aCmdData;
  1428 	switch (aOpcode)
  1429 		{
  1430 	case EWsGcOpFree:
  1431 		aText.AppendFormat(LogClose);
  1432 		break;
  1433 	case EWsGcOpActivate:
  1434 		{
  1435 		_LIT(LogGcActivate,"Activate(%d)");
  1436 		aText.AppendFormat(LogGcActivate,hHandleToValue(*pData.UInt));
  1437 		}
  1438 		break;
  1439 	case EWsGcOpDeactivate:
  1440 		{
  1441 		_LIT(LogGcDeactivate,"Deactivate()");
  1442 		aText.AppendFormat(LogGcDeactivate);
  1443 		}
  1444 		break;
  1445 	case EWsGcOpDrawLine:
  1446 		{
  1447 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.DrawLine->pnt1));
  1448 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(pData.DrawLine->pnt2));
  1449 		_LIT(LogGcDrawLine,"DrawLine(%S, %S)");
  1450 		aText.AppendFormat(LogGcDrawLine, &buf1, &buf2);
  1451 		}
  1452 		break;
  1453 	case EWsGcOpSetBrushStyle:
  1454 		{
  1455 		_LIT(LogGcSetBrushStyle,"SetBrushStyle(%u)");
  1456 		aText.AppendFormat(LogGcSetBrushStyle,*pData.UInt);
  1457 		}
  1458 		break;
  1459 	case EWsGcOpPlot:
  1460 		{
  1461 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1462 		_LIT(LogGcPlot,"Plot(%S)");
  1463 		aText.AppendFormat(LogGcPlot, &buf);
  1464 		}
  1465 		break;
  1466 	case EWsGcOpSetPenColor:
  1467 		{
  1468 		TLongBuf buf(TDebugLogTextHandler::FormatRgb(*pData.rgb));
  1469 		_LIT(LogGcSetPenColor,"SetPenColor(%S)");
  1470 		aText.AppendFormat(LogGcSetPenColor,&buf);
  1471 		}
  1472 		break;
  1473 	case EWsGcOpSetBrushColor:
  1474 		{
  1475 		TLongBuf buf(TDebugLogTextHandler::FormatRgb(*pData.rgb));
  1476 		_LIT(LogGcSetBrushColor,"SetBrushColor(%S)");
  1477 		aText.AppendFormat(LogGcSetBrushColor,&buf);
  1478 		}
  1479 		break;
  1480 	case EWsGcOpSetPenSize:
  1481 		{
  1482 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1483 		_LIT(LogGcSetPenSize,"SetPenSize(%S)");
  1484 		aText.AppendFormat(LogGcSetPenSize,&buf);
  1485 		}
  1486 		break;
  1487 	case EWsGcOpSetPenStyle:
  1488 		{
  1489 		_LIT(LogGcSetPenStyle,"SetPenStyle(%d)");
  1490 		aText.AppendFormat(LogGcSetPenStyle,*pData.UInt);
  1491 		}
  1492 		break;
  1493 	case EWsGcOpSetClippingRegion:
  1494 		{
  1495 		_LIT(LogGcSetClippingRegion,"SetClippingRegion(...)");
  1496 		aText.Append(LogGcSetClippingRegion);
  1497 		}
  1498 		break;
  1499 	case EWsGcOpCancelClippingRegion:
  1500 		{
  1501 		_LIT(LogGcCancelClippingRegion,"CancelClippingRegion()");
  1502 		aText.Append(LogGcCancelClippingRegion);
  1503 		}
  1504 		break;
  1505 	case EWsGcOpSetClippingRect:
  1506 		{
  1507 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.Rect));
  1508 		_LIT(LogGcSetClippingRect,"SetClippingRect(%S)");
  1509 		aText.AppendFormat(LogGcSetClippingRect,&buf);
  1510 		}
  1511 		break;
  1512 	case EWsGcOpCancelClippingRect:
  1513 		{
  1514 		_LIT(LogGcCancelClippingRect,"CancelClippingRect()");
  1515 		aText.Append(LogGcCancelClippingRect);
  1516 		}
  1517 		break;
  1518 	case EWsGcOpDrawTo:
  1519 		{
  1520 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1521 		_LIT(LogGcDrawTo,"DrawTo(%S)");
  1522 		aText.AppendFormat(LogGcDrawTo,&buf);
  1523 		}
  1524 		break;
  1525 	case EWsGcOpDrawBy:
  1526 		{
  1527 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1528 		_LIT(LogGcDrawBy,"DrawBy(%S)");
  1529 		aText.AppendFormat(LogGcDrawBy,&buf);
  1530 		}
  1531 		break;
  1532 	case EWsGcOpDrawPolyLine:
  1533 		{
  1534 		_LIT(LogGcDrawPolyLine,"DrawPolyLine(%d...)");
  1535 		aText.AppendFormat(LogGcDrawPolyLine,pData.PolyLine->numPoints);
  1536 		}
  1537 		break;
  1538 	case EWsGcOpDrawPolyLineContinued:
  1539 		{
  1540 		_LIT(LogGcDrawPolyLineContinued,"DrawPolyLineContinued(%d...)");
  1541 		aText.AppendFormat(LogGcDrawPolyLineContinued,pData.PolyLine->numPoints);
  1542 		}
  1543 		break;
  1544 	case EWsGcOpUseBrushPattern:
  1545 		{
  1546 		_LIT(LogGcUseBrushPattern,"UseBrushPattern({0x%x})");
  1547 		aText.AppendFormat(LogGcUseBrushPattern,hHandleToValue(*pData.handle));
  1548 		}
  1549 		break;
  1550 	case EWsGcOpDrawArc:
  1551 		{
  1552 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.ArcOrPie->rect));
  1553 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(pData.ArcOrPie->start));
  1554 		TShortBuf buf3(TDebugLogTextHandler::FormatPoint(pData.ArcOrPie->end));
  1555 		_LIT(LogGcDrawArc,"DrawArc(%S,%S,%S)");
  1556 		aText.AppendFormat(LogGcDrawArc,&buf1,&buf2,&buf3);
  1557 		}
  1558 		break;
  1559 	case EWsGcOpSetWordJustification:
  1560 		{
  1561 		_LIT(LogGcSetWordJustification,"SetWordJustification(%d,%d)");
  1562 		aText.AppendFormat(LogGcSetWordJustification,pData.SetJustification->excessWidth,pData.SetJustification->numGaps);
  1563 		}
  1564 		break;
  1565 	case EWsGcOpSetCharJustification:
  1566 		{
  1567 		_LIT(LogGcSetCharJustification,"SetCharJustification(%d,%d)");
  1568 		aText.AppendFormat(LogGcSetCharJustification,pData.SetJustification->excessWidth,pData.SetJustification->numGaps);
  1569 		}
  1570 		break;
  1571 	case EWsGcOpSetBrushOrigin:
  1572 		{
  1573 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1574 		aText.AppendFormat(_L("SetBrushOrigin(%S)"), &buf);		
  1575 		}
  1576 		break;
  1577 	case EWsGcOpDiscardBrushPattern:
  1578 		{
  1579 		_LIT(LogGcDiscardBrushPattern,"DiscardBrushPattern()");
  1580 		aText.Append(LogGcDiscardBrushPattern);
  1581 		}	
  1582 		break;	
  1583  	default:
  1584 		UnKnownOpcode(aText, aOpcode);
  1585 		break;
  1586 		}
  1587 	}
  1588 
  1589 void TWsDecoder::DecodeGc2(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData)
  1590 	{
  1591 	TWsGcCmdUnion pData;
  1592 
  1593 	pData.any=aCmdData;
  1594 	switch (aOpcode)
  1595 		{
  1596 	case EWsGcOpDrawText:
  1597 		{
  1598 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.DrawText->pos));
  1599 		_LIT(LogGcDrawText1,"DrawText(\"");
  1600 		TDebugLogTextHandler::Append(aText, LogGcDrawText1);
  1601 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.DrawText+1), pData.DrawText->length));
  1602 		_LIT(LogGcDrawText2,"\", %S)");
  1603 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler,&buf);
  1604 		}
  1605 		break;
  1606 	case EWsGcOpDrawTextVertical:
  1607 		{
  1608 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.DrawTextVertical->pos));
  1609 		_LIT(LogGcDrawTextVertical1,"DrawTextVertical(\"");
  1610 		TDebugLogTextHandler::Append(aText, LogGcDrawTextVertical1);
  1611 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.DrawTextVertical+1), pData.DrawTextVertical->length));
  1612 		_LIT(LogGcDrawTextVertical2,"\", %S, %d)");
  1613 		aText.AppendFormat(LogGcDrawTextVertical2,&iOverflowHandler,&buf,pData.DrawTextVertical->up);
  1614 		}
  1615 		break;
  1616 	case EWsGcOpDrawTextVerticalPtr:
  1617 		{
  1618 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.DrawTextVertical->pos));
  1619 		_LIT(LogGcDrawTextVertical1,"DrawTextVertical(...");
  1620 		TDebugLogTextHandler::Append(aText, LogGcDrawTextVertical1);
  1621 		_LIT(LogGcDrawTextVertical2,", %S, %d)");
  1622 		aText.AppendFormat(LogGcDrawTextVertical2,&iOverflowHandler,&buf,pData.DrawTextVertical->up);
  1623 		}
  1624 		break;
  1625 	case EWsGcOpDrawTextPtr:
  1626 		{
  1627 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.DrawText->pos));
  1628 		_LIT(LogGcDrawText1,"DrawText(...");
  1629 		TDebugLogTextHandler::Append(aText, LogGcDrawText1);
  1630 		_LIT(LogGcDrawText2,",%S)");
  1631 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler,&buf);
  1632 		}
  1633 		break;
  1634 	case EWsGcOpDrawBoxTextOptimised1:
  1635 		{
  1636 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.BoxTextO1->box));
  1637 		_LIT(LogGcDrawText1,"DrawText(\"");
  1638 		aText.Append(LogGcDrawText1);
  1639 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.BoxTextO1+1), pData.BoxTextO1->length));
  1640 		_LIT(LogGcDrawText2,"\", %S, %d, %d, 0)");
  1641 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler, &buf,
  1642 										pData.BoxTextO1->baselineOffset,CGraphicsContext::ELeft);
  1643 		}
  1644 		break;
  1645 	case EWsGcOpDrawBoxTextOptimised2:
  1646 		{
  1647 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.BoxTextO2->box));
  1648 		_LIT(LogGcDrawText1,"DrawText(\"");
  1649 		aText.Append(LogGcDrawText1);
  1650 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.BoxTextO2+1), pData.BoxTextO2->length));
  1651 		_LIT(LogGcDrawText2,"\", %S, %d, %d, %d)");
  1652 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler, &buf, pData.BoxTextO2->baselineOffset, 
  1653 										pData.BoxTextO2->horiz, pData.BoxTextO2->leftMrg);
  1654 		}
  1655 		break;
  1656 	case EWsGcOpDrawBoxTextVertical:
  1657 		{
  1658 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.DrawBoxTextVertical->box));
  1659 		_LIT(LogGcDrawTextVertical1,"DrawTextVertical(\"");
  1660 		aText.Append(LogGcDrawTextVertical1);
  1661 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.DrawBoxTextVertical+1), pData.DrawBoxTextVertical->length));
  1662 		_LIT(LogGcDrawTextVertical2,"\", %S, %d, %d, %d, %d)");
  1663 		aText.AppendFormat(LogGcDrawTextVertical2,&iOverflowHandler, &buf,
  1664 										pData.DrawBoxTextVertical->baselineOffset, pData.DrawBoxTextVertical->up,
  1665 										pData.DrawBoxTextVertical->vert, pData.DrawBoxTextVertical->margin);
  1666 		}
  1667 		break;
  1668 	case EWsGcOpDrawBoxTextPtr:
  1669 		{
  1670 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.BoxText->box));
  1671 		_LIT(LogGcDrawText1,"DrawText(...");
  1672 		TDebugLogTextHandler::Append(aText, LogGcDrawText1);
  1673 		_LIT(LogGcDrawText2,", %S, %d, %d, %d)");
  1674 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler, &buf, pData.BoxText->baselineOffset,
  1675 										pData.BoxText->horiz, pData.BoxText->leftMrg);
  1676 		}
  1677 		break;
  1678 	case EWsGcOpDrawBoxTextVerticalPtr:
  1679 		{
  1680 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.DrawBoxTextVertical->box));
  1681 		_LIT(LogGcDrawTextVertical1,"DrawTextVertical(...");
  1682 		aText.Append(LogGcDrawTextVertical1);
  1683 		_LIT(LogGcDrawTextVertical2,", %S, %d, %d, %d, %d)");
  1684 		aText.AppendFormat(LogGcDrawTextVertical2,&iOverflowHandler,&buf,
  1685 										pData.DrawBoxTextVertical->baselineOffset, pData.DrawBoxTextVertical->up,
  1686 										pData.DrawBoxTextVertical->vert, pData.DrawBoxTextVertical->margin);
  1687 		}
  1688 		break;
  1689 	case EWsGcOpCopyRect:
  1690 		{
  1691 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.CopyRect->pos));
  1692 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.CopyRect->rect));
  1693 		_LIT(LogGcCopyRect,"CopyRect(%S, %S)");
  1694 		aText.AppendFormat(LogGcCopyRect,&buf1,&buf2);
  1695 		}
  1696 		break;
  1697 	case EWsGcOpDrawEllipse:
  1698 		{
  1699 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.Rect));
  1700 		_LIT(LogGcDrawEllipse,"DrawEllipse(%S)");
  1701 		aText.AppendFormat(LogGcDrawEllipse,&buf);
  1702 		}
  1703 		break;
  1704 	case EWsGcOpMoveTo:
  1705 		{
  1706 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1707 		_LIT(LogGcMoveTo,"MoveTo(%S)");
  1708 		aText.AppendFormat(LogGcMoveTo,&buf);
  1709 		}
  1710 		break;
  1711 	case EWsGcOpMoveBy:
  1712 		{
  1713 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1714 		_LIT(LogGcMoveBy,"MoveBy(%S)");
  1715 		aText.AppendFormat(LogGcMoveBy,&buf);
  1716 		}
  1717 		break;
  1718 	case EWsGcOpDrawPolygon:
  1719 		{
  1720 		_LIT(LogGcDrawPolygon,"DrawPolygon(...)");
  1721 		aText.Append(LogGcDrawPolygon);
  1722 		}
  1723 		break;
  1724 	case EWsGcOpDrawRoundRect:
  1725 		{
  1726 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.RoundRect->rect));
  1727 		TShortBuf buf2(TDebugLogTextHandler::FormatSize(pData.RoundRect->ellipse));
  1728 		_LIT(LogGcDrawRoundRect,"DrawRoundRect(%S,%S)");
  1729 		aText.AppendFormat(LogGcDrawRoundRect,&buf1,&buf2);
  1730 		}
  1731 		break;
  1732 	case EWsGcOpDrawPie:
  1733 		{
  1734 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.ArcOrPie->rect));
  1735 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(pData.ArcOrPie->start));
  1736 		TShortBuf buf3(TDebugLogTextHandler::FormatPoint(pData.ArcOrPie->end));
  1737 		_LIT(LogGcDrawPie,"DrawPie(%S,%S,%S)");
  1738 		aText.AppendFormat(LogGcDrawPie,&buf1,&buf2,&buf3);
  1739 		}
  1740 		break;
  1741 	case EWsGcOpSetOrigin:
  1742 		{
  1743 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1744 		_LIT(LogGcSetOrigin,"SetOrigin(%S)");
  1745 		aText.AppendFormat(LogGcSetOrigin,&buf);
  1746 		}
  1747 		break;
  1748 	case EWsGcOpStartSegmentedDrawPolygon:
  1749 		{
  1750 		_LIT(LogGcStartSegmentedDrawPolygon,"StartSegmentedDrawPolygon(%d)");
  1751 		aText.AppendFormat(LogGcStartSegmentedDrawPolygon,*pData.StartSegmentedDrawPolygon);
  1752 		}
  1753 		break;
  1754 	case EWsGcOpSegmentedDrawPolygonData:
  1755 		{
  1756 		_LIT(LogGcSegmentedDrawPolygonData,"SegmentedDrawPolygonData(%d,%d,...)");
  1757 		aText.AppendFormat(LogGcSegmentedDrawPolygonData,pData.SegmentedDrawPolygonData->index,
  1758 									pData.SegmentedDrawPolygonData->numPoints);
  1759 		}
  1760 		break;
  1761 	case EWsGcOpDrawSegmentedPolygon:
  1762 		{
  1763 		_LIT(LogGcDrawSegmentedPolygon,"DrawSegmentedPolygon()");
  1764 		aText.AppendFormat(LogGcDrawSegmentedPolygon);
  1765 		}
  1766 		break;
  1767 	case EWsGcOpDrawRect:
  1768 		{
  1769 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.Rect));
  1770 		_LIT(LogGcDrawRect,"DrawRect(%S)");
  1771 		aText.AppendFormat(LogGcDrawRect,&buf);
  1772 		}
  1773 		break;
  1774 	case EWsGcOpDrawBitmap:
  1775 		{
  1776 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.Bitmap->pos));
  1777 		_LIT(KLitGcDrawBitmap, "DrawBitmap({%d}, %S)");
  1778 		aText.AppendFormat(KLitGcDrawBitmap, hHandleToValue(pData.Bitmap->handle), &buf);
  1779 		}
  1780 		break;
  1781 	case EWsGcOpDrawBitmap2:
  1782 		{
  1783 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.Bitmap2->rect));
  1784 		_LIT(KLitGcDrawBitmap2, "DrawBitmap2({%d}, %S)");
  1785 		aText.AppendFormat(KLitGcDrawBitmap2, hHandleToValue(pData.Bitmap2->handle), &buf);
  1786 		}
  1787 		break;
  1788 	case EWsGcOpDrawBitmap3:
  1789 		{
  1790 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.Bitmap3->rect));
  1791 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.Bitmap3->srcRect));
  1792 		_LIT(KLitGcDrawBitmap3, "DrawBitmap3({%d}, %S, %S)");
  1793 		aText.AppendFormat(KLitGcDrawBitmap3, hHandleToValue(pData.Bitmap3->handle), &buf1, &buf2);
  1794 		}
  1795 		break;
  1796 	case EWsGcOpDrawBitmapMasked:
  1797 	case EWsGcOpWsDrawBitmapMasked:
  1798 		{
  1799 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.iBitmapMasked->iRect));
  1800 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.iBitmapMasked->iSrcRect));
  1801 		_LIT(KLitGcDrawBitmapMasked, "DrawBitmapMasked(%S, {%d}, %S, {%d}, %d)");
  1802 		aText.AppendFormat(KLitGcDrawBitmapMasked, &buf1, hHandleToValue(pData.iBitmapMasked->iHandle), 
  1803 			&buf2, hHandleToValue(pData.iBitmapMasked->iMaskHandle), pData.iBitmapMasked->iInvertMask);
  1804 		}
  1805 		break;
  1806 	case EWsGcOpDrawBoxText:
  1807 		{
  1808 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.BoxText->box));
  1809 		_LIT(LogGcDrawText1,"DrawText(\"");
  1810 		aText.Append(LogGcDrawText1);
  1811 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.BoxText+1), pData.BoxText->length));
  1812 		_LIT(LogGcDrawText2,"\", %S, %d, %d, %d)");
  1813 		aText.AppendFormat(LogGcDrawText2,&iOverflowHandler, &buf, pData.BoxText->baselineOffset, 
  1814 										pData.BoxText->horiz, pData.BoxText->leftMrg);
  1815 		}
  1816 		break;		
  1817 	default:
  1818 		UnKnownOpcode(aText, aOpcode);
  1819 		break;
  1820 		}
  1821 	}
  1822 
  1823 void TWsDecoder::DecodeGc3(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData)
  1824 	{
  1825 	TWsGcCmdUnion pData;
  1826 
  1827 	pData.any=aCmdData;
  1828 	switch (aOpcode)
  1829 		{
  1830 	case EWsGcOpSetDrawMode:
  1831 		{
  1832 		_LIT(LogGcSetDrawMode,"SetDrawMode(%u)");
  1833 		aText.AppendFormat(LogGcSetDrawMode,*pData.UInt);
  1834 		}
  1835 		break;
  1836 	case EWsGcOpClearRect:
  1837 		{
  1838 		TLongBuf buf(TDebugLogTextHandler::FormatRect(*pData.Rect));
  1839 		_LIT(LogGcClear,"Clear(%S)");
  1840 		aText.AppendFormat(LogGcClear, &buf);
  1841 		}
  1842 		break;
  1843 	case EWsGcOpClear:
  1844 		{
  1845 		_LIT(LogGcClear,"Clear()");
  1846 		aText.AppendFormat(LogGcClear);
  1847 		}
  1848 		break;
  1849 	case EWsGcOpGdiBlt2:
  1850 	case EWsGcOpGdiWsBlt2:
  1851 		{
  1852 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.GdiBlt2->pos));
  1853 		_LIT(LogGcGdiBlt,"GdiBlt(%S, {%d})");
  1854 		aText.AppendFormat(LogGcGdiBlt,&buf,hHandleToValue(pData.GdiBlt2->handle));
  1855 		}
  1856 		break;
  1857 	case EWsGcOpGdiBlt3:
  1858 	case EWsGcOpGdiWsBlt3:
  1859 		{
  1860 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.GdiBlt3->pos));
  1861 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.GdiBlt3->rect));
  1862 		_LIT(LogGcGdiBlt,"GdiBlt(%S, {%d}, %S)");
  1863 		aText.AppendFormat(LogGcGdiBlt,&buf1,hHandleToValue(pData.GdiBlt3->handle),&buf2);
  1864 		}
  1865 		break;
  1866 	case EWsGcOpGdiBltMasked:
  1867 	case EWsGcOpGdiWsBltMasked:
  1868 		{
  1869 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.GdiBltMasked->destination));
  1870 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.GdiBltMasked->source));
  1871 		_LIT(LogGcBitBltMasked,"BitBltMasked(%S, {%d}, %S, {%d}, %d)");
  1872 		aText.AppendFormat(LogGcBitBltMasked, &buf1, hHandleToValue(pData.GdiBltMasked->handle),
  1873 										&buf2, hHandleToValue(pData.GdiBltMasked->maskHandle),
  1874 										pData.GdiBltMasked->invertMask);
  1875 		}
  1876 		break;
  1877 	case EWsGcOpSize:
  1878 		{
  1879 		_LIT(LogGcSize,"Size()");
  1880 		aText.AppendFormat(LogGcSize);
  1881 		}
  1882 		break;
  1883 	case EWsGcOpUseFont:
  1884 		{
  1885 		_LIT(LogGcUseFont,"UseFont({0x%x})");
  1886 		aText.AppendFormat(LogGcUseFont,hHandleToValue(*pData.handle));
  1887 		}
  1888 		break;
  1889 	case EWsGcOpDiscardFont:
  1890 		{
  1891 		_LIT(LogGcDiscardFont,"DiscardFont()");
  1892 		aText.AppendFormat(LogGcDiscardFont);
  1893 		}
  1894 		break;
  1895 	case EWsGcOpTestInvariant:
  1896 		{
  1897 		_LIT(LogGcTestInvariant,"unimplemented opcode 'EWsGcOpTestInvariant' (%u)");
  1898 		aText.AppendFormat(LogGcTestInvariant, aOpcode);
  1899 		}
  1900 		break;
  1901 	case EWsGcOpReset:
  1902 		{
  1903 		_LIT(LogGcReset,"Reset()");
  1904 		aText.Append(LogGcReset);
  1905 		}
  1906 		break;
  1907 	case EWsGcOpSetDitherOrigin:
  1908 		{
  1909 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1910 		_LIT(LogGcSetDitherOrigin,"SetDitherOrigin(%S)");
  1911 		aText.AppendFormat(LogGcSetDitherOrigin,&buf);
  1912 		}
  1913 		break;
  1914 	case EWsGcOpMapColors:
  1915 		{
  1916 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.MapColors->rect));
  1917 		_LIT(LogGcMapColors,"MapColors(%S,?,%d)");
  1918 		aText.AppendFormat(LogGcMapColors,&buf,pData.MapColors->numPairs);
  1919 		}
  1920 		break;
  1921 	case EWsGcOpSetUnderlineStyle:
  1922 		{
  1923 		_LIT(LogGcSetUnderlineStyle,"SetUnderlineStyle(%x)");
  1924 		aText.AppendFormat(LogGcSetUnderlineStyle,*pData.SetUnderlineStyle);
  1925 		}
  1926 		break;
  1927 	case EWsGcOpSetStrikethroughStyle:
  1928 		{
  1929 		_LIT(LogGcSetStrikethroughStyle,"SetStrikethroughStyle(%x)");
  1930 		aText.AppendFormat(LogGcSetStrikethroughStyle,*pData.SetStrikethroughStyle);
  1931 		}
  1932 		break;
  1933 	case EWsGcOpDrawWsGraphic:
  1934 	case EWsGcOpDrawWsGraphicPtr:
  1935 		{
  1936 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.WsGraphic->iRect));
  1937 		_LIT(KLitGcDrawWsGraphic,"DrawWsGraphic(%x, %d, %S, %d)");
  1938 		aText.AppendFormat(KLitGcDrawWsGraphic, pData.WsGraphic->iFlags, pData.WsGraphic->iId, &buf, pData.WsGraphic->iDataLen);
  1939 		}
  1940 		break;
  1941 	case EWsGcOpSetFaded:
  1942 		{
  1943 		_LIT(KLitGcSetFaded, "SetFaded(%d)");
  1944 		aText.AppendFormat(KLitGcSetFaded, *pData.Bool);
  1945 		}
  1946 		break;
  1947 	case EWsGcOpSetFadeParams:
  1948 		{
  1949 		_LIT(KLitGcSetFadeParams, "SetFadeParams(BlackMap %d, WhiteMap %d)");
  1950 		const unsigned char *bytePtr = (const unsigned char*)(pData.UInt);
  1951 		aText.AppendFormat(KLitGcSetFadeParams, bytePtr[0], bytePtr[1]);
  1952 		}
  1953 		break;
  1954 	case EWsGcOpGdiAlphaBlendBitmaps:
  1955 	case EWsGcOpGdiWsAlphaBlendBitmaps:
  1956 		{
  1957 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.AlphaBlendBitmaps->point));
  1958 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.AlphaBlendBitmaps->source));
  1959 		TShortBuf buf3(TDebugLogTextHandler::FormatPoint(pData.AlphaBlendBitmaps->alphaPoint));
  1960 		_LIT(KLitGcAlphaBlendBitmaps,"AlphaBlendBitmaps(%S, {%d}, %S, {%d}, %S)");
  1961 		aText.AppendFormat(KLitGcAlphaBlendBitmaps, &buf1, hHandleToValue(pData.AlphaBlendBitmaps->bitmapHandle),
  1962 										&buf2, hHandleToValue(pData.AlphaBlendBitmaps->alphaHandle),
  1963 										&buf3);
  1964 		}
  1965 		break;
  1966 	case EWsGcOpSetOpaque:
  1967 		{
  1968 		_LIT(KLitGcOpSetOpaque, "SetOpaque(%d)");
  1969 		aText.AppendFormat(KLitGcOpSetOpaque, *pData.Bool);
  1970 		}
  1971 		break;
  1972 	default:
  1973 		UnKnownOpcode(aText, aOpcode);
  1974 		break;
  1975 		}
  1976 	}
  1977 
  1978 void TWsDecoder::DecodeScreenDevice(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  1979 	{
  1980 	TWsSdCmdUnion pData;
  1981 	_LIT(LogScreenDevice,"CWsScreenDevice[%d]::");
  1982 
  1983 	aText.Format(LogScreenDevice,aHandle);
  1984 	pData.any=aCmdData;
  1985 	switch (aOpcode)
  1986 		{
  1987 	case EWsSdOpFree:
  1988 		{
  1989 		_LIT(LogScreenDeviceDelete,"~CWsScreenDevice()");
  1990 		aText.Append(LogScreenDeviceDelete);
  1991 		}
  1992 		break;
  1993 	case EWsSdOpPixel:
  1994 		{
  1995 		_LIT(LogScreenDevicePixel,"Pixel(%S)");
  1996 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(*pData.Point));
  1997 		aText.AppendFormat(LogScreenDevicePixel,&buf);
  1998 		}
  1999 		break;
  2000 	case EWsSdOpGetScanLine:
  2001 		{		//This fills up the log two much for test code
  2002 		aText=KNullDesC;
  2003 		/*_LIT(LogScreenDeviceGetScanLine,"GetScanLine(TRgb *aScanLine, %d, %S)");
  2004 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(pData.GetScanLine->pos));
  2005 		aText.AppendFormat(LogScreenDeviceGetScanLine,pData.GetScanLine->len,&buf);*/
  2006 		}
  2007 		break;
  2008 	case EWsSdOpHorizontalTwipsToPixels:
  2009 		{
  2010 		_LIT(LogScreenDeviceHorizontalTwipsToPixels,"HorizontalTwipsToPixels()");
  2011 		aText.Append(LogScreenDeviceHorizontalTwipsToPixels);
  2012 		}
  2013 		break;
  2014 	case EWsSdOpVerticalTwipsToPixels:
  2015 		{
  2016 		_LIT(LogScreenDeviceVerticalTwipsToPixels,"VerticalTwipsToPixels()");
  2017 		aText.Append(LogScreenDeviceVerticalTwipsToPixels);
  2018 		}
  2019 		break;
  2020 	case EWsSdOpHorizontalPixelsToTwips:
  2021 		{
  2022 		_LIT(LogScreenDeviceHorizontalPixelsToTwips,"HorizontalPixelsToTwips()");
  2023 		aText.Append(LogScreenDeviceHorizontalPixelsToTwips);
  2024 		}
  2025 		break;
  2026 	case EWsSdOpVerticalPixelsToTwips:
  2027 		{
  2028 		_LIT(LogScreenDeviceVerticalPixelsToTwips,"VerticalPixelsToTwips()");
  2029 		aText.Append(LogScreenDeviceVerticalPixelsToTwips);
  2030 		}
  2031 		break;
  2032 	case EWsSdOpPixelSize:
  2033 		{
  2034 		_LIT(LogScreenDeviceSizeInPixels,"SizeInPixels()");
  2035 		aText.Append(LogScreenDeviceSizeInPixels);
  2036 		}
  2037 		break;
  2038 	case EWsSdOpTwipsSize:
  2039 		{
  2040 		_LIT(LogScreenDeviceSizeInTwips,"SizeInTwips()");
  2041 		aText.Append(LogScreenDeviceSizeInTwips);
  2042 		}
  2043 		break;
  2044 	case EWsSdOpDisplayMode:
  2045 		{
  2046 		_LIT(LogScreenDeviceDisplayMode,"DisplayMode()");
  2047 		aText.Append(LogScreenDeviceDisplayMode);
  2048 		}
  2049 		break;
  2050 	case EWsSdOpRectCompare:
  2051 		{
  2052 		_LIT(LogScreenDeviceRectCompare,"RectCompare(%S, %S)");
  2053 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(pData.RectCompare->rect1));
  2054 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.RectCompare->rect2));
  2055 		aText.AppendFormat(LogScreenDeviceRectCompare,&buf1,&buf2);
  2056 		}
  2057 		break;
  2058 	case EWsSdOpPointerRect:
  2059 		{
  2060 		_LIT(LogScreenDevicePointerRect,"PointerRect()");
  2061 		aText.Append(LogScreenDevicePointerRect);
  2062 		}
  2063 		break;
  2064 	case EWsSdOpCopyScreenToBitmap:
  2065 		{
  2066 		_LIT(LogScreenDeviceCopyScreenToBitmap,"CopyScreenToBitmap(%d)");
  2067 		aText.AppendFormat(LogScreenDeviceCopyScreenToBitmap,pData.CopyScreenToBitmap->handle);
  2068 		}
  2069 		break;
  2070 	case EWsSdOpCopyScreenToBitmap2:
  2071 		{
  2072 		_LIT(LogScreenDeviceCopyScreenToBitmap2,"CopyScreenToBitmap(%d,%S)");
  2073 		TLongBuf buf(TDebugLogTextHandler::FormatRect(pData.CopyScreenToBitmap2->rect));
  2074 		aText.AppendFormat(LogScreenDeviceCopyScreenToBitmap2,pData.CopyScreenToBitmap2->handle,&buf);
  2075 		}
  2076 		break;
  2077 	case EWsSdOpSetScreenSizeAndRotation:
  2078 		{
  2079 		_LIT(LogScreenDeviceSetScreenSizeAndRotation,"SetScreenSizeAndRotation({%S, %S, %d})");
  2080 		TShortBuf buf1(TDebugLogTextHandler::FormatSize(pData.PixelsTwipsAndRotation->iPixelSize));
  2081 		TShortBuf buf2(TDebugLogTextHandler::FormatSize(pData.PixelsTwipsAndRotation->iTwipsSize));
  2082 		aText.AppendFormat(LogScreenDeviceSetScreenSizeAndRotation,&buf1,&buf2,pData.PixelsTwipsAndRotation->iRotation);
  2083 		}
  2084 		break;
  2085 	case EWsSdOpSetScreenSizeAndRotation2:
  2086 		{
  2087 		_LIT(LogScreenDeviceSetScreenSizeAndRotation,"SetScreenSizeAndRotation({%S, %d})");
  2088 		TShortBuf buf(TDebugLogTextHandler::FormatSize(pData.PixelsAndRotation->iPixelSize));
  2089 		aText.AppendFormat(LogScreenDeviceSetScreenSizeAndRotation,&buf,pData.PixelsAndRotation->iRotation);
  2090 		}
  2091 		break;
  2092 	case EWsSdOpGetDefaultScreenSizeAndRotation:
  2093 	case EWsSdOpGetDefaultScreenSizeAndRotation2:
  2094 		{
  2095 		_LIT(LogScreenDeviceGetDefaultScreenSizeAndRotation,"GetDefaultScreenSizeAndRotation(...)");
  2096 		aText.Append(LogScreenDeviceGetDefaultScreenSizeAndRotation);
  2097 		}
  2098 		break;
  2099 	case EWsSdOpGetNumScreenModes:
  2100 		{
  2101 		_LIT(LogScreenDeviceNumScreenModes,"NumScreenModes");
  2102 		aText.Append(LogScreenDeviceNumScreenModes);
  2103 		}
  2104 		break;
  2105 	case EWsSdOpSetScreenMode:
  2106 		{
  2107 		_LIT(LogScreenDeviceSetScreenMode,"ScreenMode(%d)");
  2108 		aText.AppendFormat(LogScreenDeviceSetScreenMode,*pData.Int);
  2109 		}
  2110 		break;
  2111 	case EWsSdOpGetScreenModeSizeAndRotation:
  2112 	case EWsSdOpGetScreenModeSizeAndRotation2:
  2113 		{
  2114 		_LIT(LogScreenDeviceGetScreenModeSizeAndRotation,"GetScreenModeSizeAndRotation(%d)");
  2115 		aText.AppendFormat(LogScreenDeviceGetScreenModeSizeAndRotation,*pData.Int);
  2116 		}
  2117 		break;
  2118 	case EWsSdOpSetScreenModeEnforcement:
  2119 		{
  2120 		_LIT(LogScreenDeviceSetScreenModeEnforcement,"SetScreenModeEnforcement(%d)");
  2121 		aText.AppendFormat(LogScreenDeviceSetScreenModeEnforcement,*pData.Int);
  2122 		}
  2123 		break;
  2124 	case EWsSdOpScreenModeEnforcement:
  2125 		{
  2126 		_LIT(LogScreenDeviceScreenModeEnforcement,"ScreenModeEnforcement");
  2127 		aText.Append(LogScreenDeviceScreenModeEnforcement);
  2128 		}
  2129 		break;
  2130 	case EWsSdOpSetModeRotation:
  2131 		{
  2132 		_LIT(LogScreenDeviceSetModeRotation,"SetModeRotation(%d,%d)");
  2133 		aText.AppendFormat(LogScreenDeviceSetModeRotation,pData.SetScreenRotation->mode,pData.SetScreenRotation->rotation);
  2134 		}
  2135 		break;
  2136 	case EWsSdOpGetRotationList:
  2137 		{
  2138 		_LIT(LogScreenDeviceGetRotationList,"GetRotationList(%d)");
  2139 		aText.AppendFormat(LogScreenDeviceGetRotationList,*pData.Int);
  2140 		}
  2141 		break;
  2142 	case EWsSdOpPaletteAttributes:
  2143 		{
  2144 		_LIT(LogScreenDevicePaletteAttributes,"PaletteAttributes(...)");
  2145 		aText.Append(LogScreenDevicePaletteAttributes);
  2146 		}
  2147 		break;
  2148 	case EWsSdOpSetPalette:
  2149 		{
  2150 		_LIT(LogScreenDeviceSetPalette,"SetPalette(...)");
  2151 		aText.Append(LogScreenDeviceSetPalette);
  2152 		}
  2153 		break;
  2154 	case EWsSdOpGetPalette:
  2155 		{
  2156 		_LIT(LogScreenDeviceGetPalette,"GetPalette()");
  2157 		aText.Append(LogScreenDeviceGetPalette);
  2158 		}
  2159 		break;
  2160 	case EWsSdOpGetScreenMode:
  2161 		{
  2162 		_LIT(LogScreenDeviceGetScreenMode,"CurrentScreenMode()");
  2163 		aText.Append(LogScreenDeviceGetScreenMode);
  2164 		}
  2165 		break;
  2166 	case EWsSdOpGetDefaultScreenModeOrigin:
  2167 		{
  2168 		_LIT(LogScreenDeviceGetDefaultScreenModeOrigin,"GetDefaultScreenModeOrigin()");
  2169 		aText.Append(LogScreenDeviceGetDefaultScreenModeOrigin);
  2170 		}	
  2171 		break;
  2172 	case EWsSdOpGetScreenModeOrigin:
  2173 		{
  2174 		_LIT(LogScreenDeviceGetScreenModeOrigin,"GetScreenModeOrigin(%d)");
  2175 		aText.AppendFormat(LogScreenDeviceGetScreenModeOrigin, *pData.Int);
  2176 		}	
  2177 		break;
  2178 	case EWsSdOpGetScreenModeScale:
  2179 		{
  2180 		_LIT(LogScreenDeviceGetScreenModeScale,"GetScreenModeScale(%d)");
  2181 		aText.AppendFormat(LogScreenDeviceGetScreenModeScale, *pData.Int);
  2182 		}	
  2183 		break;
  2184 	case EWsSdOpGetCurrentScreenModeScale:
  2185 		{
  2186 		_LIT(LogScreenDeviceGetCurrentScreenModeScale,"GetCurrentScreenModeScale()");
  2187 		aText.Append(LogScreenDeviceGetCurrentScreenModeScale);
  2188 		}	
  2189 		break;		
  2190 	case EWsSdOpSetAppScreenMode:
  2191 		{
  2192 		_LIT(LogScreenDeviceSetAppScreenMode,"SetAppScreenMode(%d)");
  2193 		aText.AppendFormat(LogScreenDeviceSetAppScreenMode, *pData.Int);
  2194 		}	
  2195 		break;		
  2196 	case EWsSdOpGetScreenModeScaledOrigin:
  2197 		{
  2198 		_LIT(LogScreenDeviceGetScreenModeScaledOrigin,"GetScreenModeScaledOrigin(%d)");
  2199 		aText.AppendFormat(LogScreenDeviceGetScreenModeScaledOrigin, *pData.Int);
  2200 		}	
  2201 		break;		
  2202 	case EWsSdOpGetCurrentScreenModeScaledOrigin:
  2203 		{
  2204 		_LIT(LogScreenDeviceGetCurrentScreenModeScaledOrigin,"GetCurrentScreenModeScaledOrigin()");
  2205 		aText.Append(LogScreenDeviceGetCurrentScreenModeScaledOrigin);
  2206 		}	
  2207 		break;		
  2208 	case EWsSdOpSetCurrentScreenModeAttributes:
  2209 		{
  2210 		_LIT(LogScreenDeviceSetCurrentScreenModeAttributes,"SetCurrentScreenModeAttributes(%S)");
  2211 		TShortBuf buf(TDebugLogTextHandler::FormatSize(pData.ScreenSizeMode->iScreenSize));
  2212 		aText.AppendFormat(LogScreenDeviceSetCurrentScreenModeAttributes,&buf);
  2213 		}	
  2214 		break;		
  2215 	case EWsSdOpGetCurrentScreenModeAttributes:
  2216 		{
  2217 		_LIT(LogScreenDeviceGetCurrentScreenModeOrigin,"GetCurrentScreenModeAttributes()");
  2218 		aText.Append(LogScreenDeviceGetCurrentScreenModeOrigin);
  2219 		}	
  2220 		break;		
  2221 	case EWsSdOpGetScreenNumber:
  2222 		{
  2223 		_LIT(LogScreenDeviceGetScreenNumber,"GetScreenNumber()");
  2224 		aText.Append(LogScreenDeviceGetScreenNumber);
  2225 		}	
  2226 		break;		
  2227 	case EWsSdOpGetScreenSizeModeList:
  2228 		{
  2229 		_LIT(LogScreenDeviceGetScreenSizeModeList,"GetScreenSizeModeList(RArray<TInt>* aModeList)");
  2230 		aText.Append(LogScreenDeviceGetScreenSizeModeList);
  2231 		}	
  2232 		break;		
  2233 	case EWsSdOpGetScreenModeDisplayMode:
  2234 		{
  2235 		_LIT(LogScreenDeviceGetScreenModeDisplayMode,"GetScreenModeDisplayMode(%d)");
  2236 		aText.AppendFormat(LogScreenDeviceGetScreenModeDisplayMode, *pData.Int);
  2237 		}	
  2238 		break;		
  2239 	case EWsClOpSetBackLight:
  2240 		{
  2241 		_LIT(LogScreenDeviceSetBackLight,"SetBackLight(%u)");
  2242 		aText.AppendFormat(LogScreenDeviceSetBackLight, *pData.UInt);
  2243 		}	
  2244 		break;		
  2245 	default:
  2246 		UnKnownOpcode(aText, aOpcode);
  2247 		break;
  2248 		}
  2249 	}
  2250 
  2251 void TWsDecoder::DecodeAnimDll(TBuf<LogTBufSize>& aText,TInt aOpcode,const TAny* /*aCmdData*/,TInt aHandle)
  2252 	{
  2253 	aText.Format(_L("CAnimDll[%d]::"),aHandle);
  2254 	switch (aOpcode)
  2255 		{
  2256 	case EWsAnimDllOpCreateInstance:
  2257 		TDebugLogTextHandler::Append(aText, _L("CreateInstance(...)"));
  2258 		break;
  2259 	case EWsAnimDllOpDestroyInstance:
  2260 		TDebugLogTextHandler::Append(aText, LogClose);
  2261 		break;
  2262 	case EWsAnimDllOpCommandReply:
  2263 		TDebugLogTextHandler::Append(aText, _L("CommandReply(...)"));
  2264 		break;
  2265 	case EWsAnimDllOpCommand:
  2266 		TDebugLogTextHandler::Append(aText, _L("Command(...)"));
  2267 		break;
  2268 	case EWsAnimDllOpFree:
  2269 		aText.Append(_L("~CAnimDll()"));
  2270 		break;
  2271 	case EWsAnimDllOpCreateInstanceSprite:
  2272 		aText.Append(_L("EWsAnimDllOpCreateInstanceSprite enum"));
  2273 		break;
  2274 	default:
  2275 		UnKnownOpcode(aText, aOpcode);
  2276 		break;
  2277 		}
  2278 	}
  2279 
  2280 void TWsDecoder::DecodeSpriteBase(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  2281 	{
  2282 	TWsSpriteCmdUnion pData;
  2283 
  2284 	aText.Format(_L("RWsSpriteBase[%d]::"),aHandle);
  2285 	pData.any=aCmdData;
  2286 	switch (aOpcode)
  2287 		{
  2288 	case EWsSpriteOpFree:
  2289 		aText.Append(LogClose);
  2290 		break;
  2291 	case EWsSpriteOpSetPosition:
  2292 		aText.Append(_L("SetPosition(...)"));
  2293 		break;
  2294 	case EWsSpriteOpUpdateMember:
  2295 		aText.AppendFormat(_L("UpdateMember(%d)"),pData.UpdateMember->index);
  2296 		break;
  2297 	case EWsSpriteOpUpdateMember2:
  2298 		aText.AppendFormat(_L("UpdateMember(%d,{%d,%d,%d,%d,{%d,%d},%d})"),pData.UpdateMember->index,
  2299 								pData.UpdateMember->data.iBitmap,pData.UpdateMember->data.iMaskBitmap,
  2300 								pData.UpdateMember->data.iInvertMask,pData.UpdateMember->data.iDrawMode,
  2301 								pData.UpdateMember->data.iOffset.iX,pData.UpdateMember->data.iOffset.iY,
  2302 								pData.UpdateMember->data.iInterval.Int());
  2303 		break;
  2304 	case EWsSpriteOpAppendMember:
  2305 		aText.Append(_L("AppendMember(...)"));
  2306 		break;
  2307 	case EWsSpriteOpActivate:
  2308 		aText.Append(_L("Activate()"));
  2309 		break;
  2310 	default:
  2311 		UnKnownOpcode(aText, aOpcode);
  2312 		break;
  2313 		}
  2314 	}
  2315 
  2316 void TWsDecoder::DecodeBitmap(TBuf<LogTBufSize>& aText,TInt aOpcode,const TAny* /*aCmdData*/,TInt aHandle)
  2317 	{
  2318 	aText.Format(_L("CWsBitmap[%d]::"),aHandle);
  2319 	switch (aOpcode)
  2320 		{
  2321 	case EWsBitmapOpFree:
  2322 		aText.Append(LogClose);
  2323 		break;
  2324 	default:
  2325 		UnKnownOpcode(aText, aOpcode);
  2326 		break;
  2327 		}
  2328 	}
  2329 
  2330 void TWsDecoder::DecodeDirect(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  2331 	{
  2332 	TWsDirectCmdUnion pData;
  2333 	
  2334 	_LIT(KClassName,"RDirectScreenAccess[%d]::");
  2335 	aText.Format(KClassName,aHandle);
  2336 	pData.any=aCmdData;
  2337 	switch (aOpcode)
  2338 		{
  2339 	case EWsDirectOpFree:
  2340 		aText.Append(LogClose);
  2341 		break;
  2342 	case EWsDirectOpRequest:
  2343 		{
  2344 		_LIT(LogDirectRequest,"Request(TInt *stat,%d)");
  2345 		aText.AppendFormat(LogDirectRequest,hHandleToValue(*pData.Int));
  2346 		}
  2347 		break;
  2348 	case EWsDirectOpInitFailed:
  2349 		{
  2350 		_LIT(LogDirectInitFailed,"InitFailed()");
  2351 		aText.Append(LogDirectInitFailed);
  2352 		}
  2353 		break;
  2354 	case EWsDirectOpGetRegion:
  2355 		{
  2356 		_LIT(LogDirectGetRegion,"GetRegion(%d)");
  2357 		aText.AppendFormat(LogDirectGetRegion,*pData.Int);
  2358 		}
  2359 		break;
  2360 	case EWsDirectOpCancel:
  2361 		{
  2362 		_LIT(LogDirectCancel,"Cancel()");
  2363 		aText.Append(LogDirectCancel);
  2364 		}
  2365 		break;
  2366 	case EWsDirectOpGetSendQueue:
  2367 		{
  2368 		_LIT(LogGetSendQueue,"EWsDirectOpGetSendQueue enum");
  2369 		aText.Append(LogGetSendQueue);
  2370 		}
  2371 		break;	
  2372 	case EWsDirectOpGetRecQueue:
  2373 		{
  2374 		_LIT(LogGetRecQueue,"EWsDirectOpGetRecQueue enum");
  2375 		aText.Append(LogGetRecQueue);
  2376 		}
  2377 		break;	
  2378 	default:
  2379 		UnKnownOpcode(aText, aOpcode);
  2380 		break;
  2381 		}
  2382 	}
  2383 
  2384 void TWsDecoder::DecodeClick(TBuf<LogTBufSize> &aText, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  2385 	{
  2386 	TWsClickCmdUnion pData;
  2387 
  2388 	_LIT(KClassName,"RSoundPlugIn[%d]::");
  2389 	aText.Format(KClassName,aHandle);
  2390 	pData.any=aCmdData;
  2391 	switch (aOpcode)
  2392 		{
  2393 	case EWsClickOpFree:
  2394 		aText.Append(LogClose);
  2395 		break;
  2396 	case EWsClickOpIsLoaded:
  2397 		{
  2398 		_LIT(LogClickIsLoaded,"IsLoaded()");
  2399 		aText.Append(LogClickIsLoaded);
  2400 		}
  2401 		break;
  2402 	case EWsClickOpUnLoad:
  2403 		{
  2404 		_LIT(LogClickUnLoad,"UnLoad()");
  2405 		aText.Append(LogClickUnLoad);
  2406 		}
  2407 		break;
  2408 	case EWsClickOpLoad:
  2409 		{
  2410 		_LIT(LogClickLoad1,"Load(\"");
  2411 		_LIT(LogClickLoad2,"\")");
  2412 		TDebugLogTextHandler::Append(aText, LogClickLoad1);
  2413 		TDebugLogTextHandler::Append(aText, TPtrC((TText *)(pData.Int+1), *pData.Int));
  2414 		TDebugLogTextHandler::Append(aText, LogClickLoad2);
  2415 		}
  2416 		break;
  2417 	case EWsClickOpCommandReply:
  2418 		{
  2419 		_LIT(LogClickCommandReply,"CommandReply(...)");
  2420 		aText.Append(LogClickCommandReply);
  2421 		}
  2422 		break;
  2423 	case EWsClickOpSetKeyClick:
  2424 		{			
  2425 		_LIT(LogSetKeyClick,"SetKeyClick(%u)");
  2426 		aText.AppendFormat(LogSetKeyClick, *pData.Bool);
  2427 		}
  2428 		break;
  2429 	case EWsClickOpSetPenClick:
  2430 		{			
  2431 		_LIT(LogSetPenClick,"SetPenClick(%u)");
  2432 		aText.AppendFormat(LogSetPenClick, *pData.Bool);
  2433 		}	
  2434 		break;
  2435 	case EWsClickOpKeyClickEnabled:
  2436 		{
  2437 		_LIT(LogKeyClickEnabled,"KeyClickEnabled()");
  2438 		aText.Append(LogKeyClickEnabled);
  2439 		}
  2440 		break;
  2441 	case EWsClickOpPenClickEnabled:
  2442 		{
  2443 		_LIT(LogPenClickEnabled,"PenClickEnabled()");
  2444 		aText.Append(LogPenClickEnabled);
  2445 		}
  2446 		break;
  2447 	default:
  2448 		UnKnownOpcode(aText, aOpcode);
  2449 		break;
  2450 		}
  2451 	}
  2452 
  2453 TDesC &TWsDecoder::replyBufDetails(TInt aClass, TInt aOpcode, const TDesC8 *aReplyDes8, const TDesC *aReplyDesText)
  2454 	{
  2455 	iCommandDetailsText.Format(_L("Reply Buffer: "));
  2456 	switch (aClass)
  2457 		{
  2458 	case WS_HANDLE_GROUP_WINDOW:
  2459 		ReplyBufWindowGroup(iCommandDetailsText, aOpcode, aReplyDes8, aReplyDesText);
  2460 		break;
  2461 	case WS_HANDLE_CLIENT:
  2462 		ReplyBufClient(iCommandDetailsText, aOpcode, aReplyDes8, aReplyDesText);
  2463 		break;
  2464 	case WS_HANDLE_WINDOW:
  2465 		ReplyBufWindow(iCommandDetailsText, aOpcode, aReplyDes8, aReplyDesText);
  2466 		break;
  2467 	case WS_HANDLE_SCREEN_DEVICE:
  2468 		ReplyBufScreenDevice(iCommandDetailsText, aOpcode, aReplyDes8, aReplyDesText);
  2469 		break;
  2470 	default:
  2471 		iCommandDetailsText.Format(_L("Reply buffer not handled (%u)"), aClass);
  2472 		UnKnown();
  2473 		break;
  2474 		}
  2475 	return iCommandDetailsText;
  2476 	}
  2477 
  2478 TDesC &TWsDecoder::commandDetails(TInt aClass, TInt aOpcode, const TAny *aCmdData, TInt aHandle)
  2479 	{
  2480 	switch (aClass)
  2481 		{
  2482 	case WS_HANDLE_ROOT_WINDOW:
  2483 		iCommandDetailsText.Format(_L("invalid class"));
  2484 		break;
  2485 	case WS_HANDLE_GROUP_WINDOW:
  2486 		DecodeWindowGroup(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2487 		break;
  2488 	case WS_HANDLE_CLIENT:
  2489 		DecodeClient(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2490 		break;
  2491 	case WS_HANDLE_WINDOW:
  2492 		DecodeWindow(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2493 		break;
  2494 	case WS_HANDLE_GC:
  2495 		DecodeGc(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2496 		break;
  2497 	case WS_HANDLE_SCREEN_DEVICE:
  2498 		DecodeScreenDevice(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2499 		break;
  2500 	case WS_HANDLE_ANIM_DLL:
  2501 		DecodeAnimDll(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2502 		break;
  2503 	case WS_HANDLE_SPRITE:
  2504 	case WS_HANDLE_POINTER_CURSOR:
  2505 	case WS_HANDLE_TEXT_CURSOR:
  2506 		DecodeSpriteBase(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2507 		break;
  2508 	case WS_HANDLE_BITMAP:
  2509 		DecodeBitmap(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2510 		break;
  2511 	case WS_HANDLE_DIRECT:
  2512 		DecodeDirect(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2513 		break;
  2514 	case WS_HANDLE_CLICK:
  2515 		DecodeClick(iCommandDetailsText, aOpcode, aCmdData, aHandle);
  2516 		break;
  2517 	default:
  2518 		iCommandDetailsText.Format(_L("unknown class (%u)"), aClass);
  2519 		UnKnown();
  2520 		break;
  2521 		}
  2522 	iRequestFuncClass=aClass;
  2523 	iPrevOpcode=aOpcode;
  2524 	return iCommandDetailsText;
  2525 	}
  2526 
  2527 TDesC &TWsDecoder::eventDetails(const TWsEvent *aWsEvent)
  2528 	{
  2529 	switch (aWsEvent->Type())
  2530 		{
  2531 	case EEventKey:
  2532 		iEventDetailsText.Format(_L("EEventKey (code %u, scanCode %u, mdfs 0x%04x, repeats %u)"),
  2533 											aWsEvent->Key()->iCode,
  2534 											aWsEvent->Key()->iScanCode,
  2535 											aWsEvent->Key()->iModifiers,
  2536 											aWsEvent->Key()->iRepeats);
  2537 		break;
  2538 	case EEventKeyUp:
  2539 		iEventDetailsText.Format(_L("EEventKeyUp (scanCode %u, mdfs 0x%04x)"),
  2540 											aWsEvent->Key()->iScanCode,
  2541 											aWsEvent->Key()->iModifiers);
  2542 		break;
  2543 	case EEventKeyDown:
  2544 		iEventDetailsText.Format(_L("EEventKeyDown (scanCode %u, mdfs 0x%04x)"),
  2545 											aWsEvent->Key()->iScanCode,
  2546 											aWsEvent->Key()->iModifiers);
  2547 		break;
  2548 	case EEventPointer:
  2549 		{
  2550 		TShortBuf buf1(TDebugLogTextHandler::PointerEventType(aWsEvent->Pointer()->iType));
  2551 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(aWsEvent->Pointer()->iPosition));
  2552 		TShortBuf buf3(TDebugLogTextHandler::FormatPoint(aWsEvent->Pointer()->iParentPosition));
  2553 		iEventDetailsText.Format(_L("EEventPointer (type %S, modifiers 0x%x, pos %S, global-pos %S)"),
  2554 											&buf1,aWsEvent->Pointer()->iModifiers,&buf2,&buf3);
  2555 		}
  2556 		break;
  2557 	case EEventDragDrop:
  2558 		{
  2559 		TShortBuf buf1(TDebugLogTextHandler::PointerEventType(aWsEvent->Pointer()->iType));
  2560 		TShortBuf buf2(TDebugLogTextHandler::FormatPoint(aWsEvent->Pointer()->iPosition));
  2561 		TShortBuf buf3(TDebugLogTextHandler::FormatPoint(aWsEvent->Pointer()->iParentPosition));
  2562 		iEventDetailsText.Format(_L("EEventDragDrop (type %S, modifiers 0x%x, pos %S, global-pos %S)"),
  2563 											&buf1,aWsEvent->Pointer()->iModifiers,&buf2,&buf3);
  2564 		}
  2565 		break;
  2566 	case EEventPointerEnter:
  2567 		iEventDetailsText.Format(_L("EEventPointerEnter"));
  2568 		break;
  2569 	case EEventPointerExit:
  2570 		iEventDetailsText.Format(_L("EEventPointerExit"));
  2571 		break;
  2572 	case EEventFocusLost:
  2573 		iEventDetailsText.Format(_L("EEventFocusLost"));
  2574 		break;
  2575 	case EEventFocusGained:
  2576 		iEventDetailsText.Format(_L("EEventFocusGained"));
  2577 		break;
  2578 	case EEventModifiersChanged:
  2579 		iEventDetailsText.Format(_L("EEventModifiersChanged"));
  2580 		break;
  2581 	case EEventSwitchOn:
  2582 		iEventDetailsText.Format(_L("EEventSwitchOn"));
  2583 		break;
  2584 	case EEventPassword:
  2585 		iEventDetailsText.Format(_L("EEventPassword"));
  2586 		break;
  2587 	case EEventWindowGroupsChanged:
  2588 		iEventDetailsText.Format(_L("EEventWindowGroupsChanged"));
  2589 		break;
  2590 	case EEventErrorMessage:
  2591 		iEventDetailsText.Format(_L("EEventErrorMessage (%d,%d)"),aWsEvent->ErrorMessage()->iErrorCategory,aWsEvent->ErrorMessage()->iError);
  2592 		break;
  2593 	case EEventMessageReady:
  2594 		iEventDetailsText.Format(_L("EEventMessageReady"));
  2595 		break;
  2596 	case EEventScreenDeviceChanged:
  2597 		iEventDetailsText.Format(_L("EEventScreenDeviceChanged"));
  2598 		break;
  2599 	case EEventSwitchOff:
  2600 		{
  2601 		_LIT(LogEventSwitchOff,"EEventSwitchOff");
  2602 		iEventDetailsText.Format(LogEventSwitchOff);
  2603 		}
  2604 		break;
  2605 	case EEventKeySwitchOff:
  2606 		{
  2607 		_LIT(LogEventKeySwitchOff,"EEventKeySwitchOff");
  2608 		iEventDetailsText.Format(LogEventKeySwitchOff);
  2609 		}
  2610 		break;
  2611 	case EEventFocusGroupChanged:
  2612 		{
  2613 		_LIT(LogEventFocusGroupChanged,"EEventFocusGroupChanged");
  2614 		iEventDetailsText.Format(LogEventFocusGroupChanged);
  2615 		}
  2616 		break;
  2617 	case EEventCaseOpened:
  2618 		{
  2619 		_LIT(LogEventCaseOpened,"EEventCaseOpened");
  2620 		iEventDetailsText.Format(LogEventCaseOpened);
  2621 		}
  2622 		break;
  2623 	case EEventCaseClosed:
  2624 		{
  2625 		_LIT(LogEventCaseClosed,"EEventCaseClosed");
  2626 		iEventDetailsText.Format(LogEventCaseClosed);
  2627 		}
  2628 		break;
  2629 	default:
  2630 		if (aWsEvent->Type()>=EEventUser)
  2631 			iEventDetailsText.Format(_L("EEventUser[%d]"), aWsEvent->Type()-EEventUser);
  2632 		else
  2633 			{
  2634 			UnKnown();
  2635 			iEventDetailsText.Format(_L("Unknown event type=%d "), aWsEvent->Type());
  2636 			}
  2637 		break;
  2638 		}
  2639 	return iEventDetailsText;
  2640 	}
  2641 
  2642 TDesC &TWsDecoder::eventDetails(const TRawEvent *aEvent)
  2643 	{
  2644 	iEventDetailsText.Zero();
  2645 	switch (aEvent->Type())
  2646 		{
  2647 	case TRawEvent::ENone:
  2648 		{
  2649 		_LIT(LogEventDetailsNone,"ENone");
  2650 		iEventDetailsText.Append(LogEventDetailsNone);
  2651 		}
  2652 		break;
  2653 	case TRawEvent::EPointerMove:
  2654 		{
  2655 		_LIT(LogEventDetailsPointerMove,"EPointerMove(");
  2656 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2657 		iEventDetailsText.Append(LogEventDetailsPointerMove);
  2658 		iEventDetailsText.Append(buf);
  2659 		iEventDetailsText.Append(LogCloseBracket);
  2660 		}
  2661 		break;
  2662     case TRawEvent::EPointerSwitchOn:
  2663 		{
  2664 		_LIT(LogEventDetailsPointerSwitchOn,"EPointerSwitchOn(");
  2665 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2666 		iEventDetailsText.Append(LogEventDetailsPointerSwitchOn);
  2667 		iEventDetailsText.Append(buf);
  2668 		iEventDetailsText.Append(LogCloseBracket);
  2669 		}
  2670 		break;
  2671 	case TRawEvent::EKeyDown:
  2672 		{
  2673 		_LIT(LogEventDetailsKeyDown,"EKeyDown(%d)");
  2674 		iEventDetailsText.Format(LogEventDetailsKeyDown,aEvent->ScanCode());
  2675 		}
  2676 		break;
  2677 	case TRawEvent::EKeyUp:
  2678 		{
  2679 		_LIT(LogEventDetailsKeyUp,"EKeyUp(%d)");
  2680 		iEventDetailsText.Format(LogEventDetailsKeyUp,aEvent->ScanCode());
  2681 		}
  2682 		break;
  2683 	case TRawEvent::ERedraw:
  2684 		{
  2685 		_LIT(LogEventDetailsRedraw,"ERedraw");
  2686 		iEventDetailsText.Append(LogEventDetailsRedraw);
  2687 		}
  2688 		break;
  2689 	case TRawEvent::ESwitchOn:
  2690  		{
  2691 		_LIT(LogEventDetailsSwitchOn,"ESwitchOn");
  2692 		iEventDetailsText.Append(LogEventDetailsSwitchOn);
  2693 		}
  2694 		break;
  2695 	case TRawEvent::EActive:
  2696 		{
  2697 		_LIT(LogEventDetailsActive,"EActive");
  2698 		iEventDetailsText.Append(LogEventDetailsActive);
  2699 		}
  2700 		break;
  2701 	case TRawEvent::EInactive:
  2702 		{
  2703 		_LIT(LogEventDetailsInactive,"EInactive");
  2704 		iEventDetailsText.Append(LogEventDetailsInactive);
  2705 		}
  2706 		break;
  2707 	case TRawEvent::EUpdateModifiers:
  2708 		{
  2709 		_LIT(LogEventDetailsModifiers,"EUpdateModifiers(%d)");
  2710 		iEventDetailsText.Format(LogEventDetailsModifiers,aEvent->Modifiers());
  2711 		}
  2712 		break;
  2713 	case TRawEvent::EButton1Down:
  2714 		{
  2715 		_LIT(LogEventDetailsButton1Down,"EButton1Down(");
  2716 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2717 		iEventDetailsText.Append(LogEventDetailsButton1Down);
  2718 		iEventDetailsText.Append(buf);
  2719 		iEventDetailsText.Append(LogCloseBracket);
  2720 		}
  2721 		break;
  2722 	case TRawEvent::EButton1Up:
  2723 		{
  2724 		_LIT(LogEventDetailsButton1Up,"EButton1Up(");
  2725 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2726 		iEventDetailsText.Append(LogEventDetailsButton1Up);
  2727 		iEventDetailsText.Append(buf);
  2728 		iEventDetailsText.Append(LogCloseBracket);
  2729 		}
  2730 		break;
  2731 	case TRawEvent::EButton2Down:
  2732 		{
  2733 		_LIT(LogEventDetailsButton2Down,"EButton2Down(");
  2734 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2735 		iEventDetailsText.Append(LogEventDetailsButton2Down);
  2736 		iEventDetailsText.Append(buf);
  2737 		iEventDetailsText.Append(LogCloseBracket);
  2738 		}
  2739 		break;
  2740 	case TRawEvent::EButton2Up:
  2741 		{
  2742 		_LIT(LogEventDetailsButton2Up,"EButton2Up(");
  2743 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2744 		iEventDetailsText.Append(LogEventDetailsButton2Up);
  2745 		iEventDetailsText.Append(buf);
  2746 		iEventDetailsText.Append(LogCloseBracket);
  2747 		}
  2748 		break;
  2749 	case TRawEvent::EButton3Down:
  2750 		{
  2751 		_LIT(LogEventDetailsButton3Down,"EButton3Down(");
  2752 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2753 		iEventDetailsText.Append(LogEventDetailsButton3Down);
  2754 		iEventDetailsText.Append(buf);
  2755 		iEventDetailsText.Append(LogCloseBracket);
  2756 		}
  2757 		break;
  2758 	case TRawEvent::EButton3Up:
  2759 		{
  2760 		_LIT(LogEventDetailsButton3Up,"EButton3Up(");
  2761 		TShortBuf buf(TDebugLogTextHandler::FormatPoint(aEvent->Pos()));
  2762 		iEventDetailsText.Append(LogEventDetailsButton3Up);
  2763 		iEventDetailsText.Append(buf);
  2764 		iEventDetailsText.Append(LogCloseBracket);
  2765 		}
  2766 		break;
  2767 	case TRawEvent::ESwitchOff:
  2768 		{
  2769 		_LIT(LogEventDetailsSwitchOff,"ESwitchOff");
  2770 		iEventDetailsText.Append(LogEventDetailsSwitchOff);
  2771 		}
  2772 		break;
  2773 	case TRawEvent::EKeyRepeat:
  2774  		{
  2775   		_LIT(LogEventDetailsKeyRepeat,"ERepeatKey(scancode=%d,repeat=%d");
  2776  		iEventDetailsText.Format(LogEventDetailsKeyRepeat,aEvent->ScanCode(),aEvent->Repeats());
  2777  		}
  2778 		break;
  2779 	case TRawEvent::EPointer3DOutOfRange:
  2780  		{
  2781   		_LIT(LogEventDetailsOutOfRange,"EPointer3DOutOfRange");
  2782  		iEventDetailsText.Format(LogEventDetailsOutOfRange);
  2783  		}
  2784 		break;
  2785 	default:
  2786 		{
  2787 		_LIT(LogEventDetailsUnknown,"Unknown event type: %d");
  2788 		iEventDetailsText.Format(LogEventDetailsUnknown,aEvent->Type());
  2789 		UnKnown();
  2790 		}
  2791 		break;
  2792 		}
  2793 	return iEventDetailsText;
  2794 	}
  2795 
  2796 void TWsDecoder::ReplyBufWindowGroup(TBuf<LogTBufSize> &aText, TInt aOpcode, const TDesC8 *aReplyDes8, const TDesC *aReplyDesText)
  2797 	{
  2798 	ReplyBufWindow(aText, aOpcode, aReplyDes8, aReplyDesText);
  2799 	}
  2800 
  2801 void TWsDecoder::ReplyBufWindow(TBuf<LogTBufSize> &aText, TInt aOpcode, const TDesC8 *aReplyDes8, const TDesC *aReplyDesText)
  2802 	{
  2803 	switch (aOpcode)
  2804 		{
  2805 	case EWsWinOpPosition:
  2806 		AppendPoint(aText,aReplyDes8);
  2807 		break;
  2808 	case EWsWinOpAbsPosition:
  2809 		AppendPoint(aText,aReplyDes8);
  2810 		break;
  2811 	case EWsWinOpSize:
  2812 		AppendPoint(aText,aReplyDes8);
  2813 		break;
  2814 	case EWsWinOpInquireOffset:
  2815 		AppendPoint(aText,aReplyDes8);
  2816 		break;
  2817 	case EWsWinOpName:
  2818 		AppendDesc(aText, aReplyDesText);
  2819 		break;
  2820 	case EWsWinOpRetrievePointerMoveBuffer:
  2821 		aText.Append(_L("..."));
  2822 		break;
  2823 	case EWsWinOpGetInvalidRegion:
  2824 		{
  2825 		TRect *rect=(TRect *)aReplyDes8->Ptr();
  2826 		TInt count=aReplyDes8->Size()/sizeof(TRect);
  2827 		TBuf<2> comma;
  2828 		_LIT(LogTwoStrings,"%S%S");
  2829 		for(TInt index=0;index<count && !iOverflowHandler.IsError();index++)
  2830 			{
  2831 			TLongBuf buf(TDebugLogTextHandler::FormatRect(*rect++));
  2832 			aText.AppendFormat(LogTwoStrings,&iOverflowHandler,&comma,&buf);
  2833 			if (index==0)
  2834 				comma=LogComma;
  2835 			}
  2836 		break;
  2837 		}
  2838 	default:
  2839 		UnKnownReplyBuf(aText, aOpcode);
  2840 		break;
  2841 		}
  2842 	}
  2843 
  2844 void TWsDecoder::ReplyBufClient(TBuf<LogTBufSize> &aText, TInt aOpcode, const TDesC8 *aReplyDes8, const TDesC *aReplyDesText)
  2845 	{
  2846 	switch (aOpcode)
  2847 		{
  2848 	case EWsClOpGetEvent:
  2849 		{
  2850 		const TWsEvent *wsEvent=(TWsEvent *)aReplyDes8->Ptr();
  2851 		TPtrC details(eventDetails(wsEvent));
  2852 		aText=KNullDesC;
  2853 		if (details!=KNullDesC)
  2854 			{
  2855 			TDebugLogTextHandler::Append(aText, details);
  2856 			TBuf<128> buf;
  2857 			_LIT(LogReplyClientDestTime,"(dest %d, time ");
  2858 			_LIT(LogReplyClientTime,"%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S%.%*C2%:3)");
  2859 			buf.Format(LogReplyClientDestTime, wsEvent->Handle());
  2860 			TDebugLogTextHandler::Append(aText, buf);
  2861 			TRAPD(err,wsEvent->Time().FormatL(buf,LogReplyClientTime));
  2862 			if (err==KErrNone)
  2863 				TDebugLogTextHandler::Append(aText, buf);
  2864 			else
  2865 				{
  2866 				_LIT(LogReplyClientTimeErr,"######)");
  2867 				TDebugLogTextHandler::Append(aText,LogReplyClientTimeErr);
  2868 				}
  2869 			}
  2870 		}
  2871 		break;
  2872 	case EWsClOpGetRedraw:
  2873 		{
  2874 		const TWsRedrawEvent *redrawEvent=(TWsRedrawEvent *)aReplyDes8->Ptr();
  2875 		TLongBuf buf(TDebugLogTextHandler::FormatRect(redrawEvent->Rect()));
  2876 		aText.Format(_L("Redraw (handle %d): "), redrawEvent->Handle());
  2877 		aText.AppendFormat(_L("rect %S"), &buf);
  2878 		}
  2879 		break;
  2880 	case EWsClOpGetPriorityKey:
  2881 		{
  2882 		const TWsPriorityKeyEvent *abortEvent=(TWsPriorityKeyEvent *)aReplyDes8->Ptr();
  2883 		aText.Format(_L("Abort key handle %d"), abortEvent->Handle());
  2884 		}
  2885 		break;
  2886 	case EWsClOpShadowVector:
  2887 		AppendPoint(aText,aReplyDes8);
  2888 		break;
  2889 	case EWsClOpGetWindowGroupClientThreadId:
  2890 		{
  2891 		const TThreadId *threadId=(TThreadId *)aReplyDes8->Ptr();
  2892 		aText.Format(_L("TThreadId=%d"), *(TInt *)threadId);
  2893 		}
  2894 		break;
  2895 	case EWsClOpGetWindowGroupNameFromIdentifier:
  2896 		AppendDesc(aText, aReplyDesText);
  2897 		break;
  2898 	case EWsClOpWindowGroupList:
  2899 	case EWsClOpWindowGroupListAndChain: 
  2900 	case EWsClOpWindowGroupListAllPriorities:
  2901 		{
  2902 		TInt *handlPtr=(TInt *)aReplyDes8->Ptr();
  2903 		TInt count=aReplyDes8->Size()/sizeof(TInt);
  2904 		TBuf<2> comma;
  2905 		_LIT(LogStringInt,"%S%d");
  2906 		for(TInt index=0;index<count && !iOverflowHandler.IsError();index++)
  2907 			{
  2908 			aText.AppendFormat(LogStringInt,&iOverflowHandler,&comma,*handlPtr++);
  2909 			if (index==0)
  2910 				comma=LogComma;
  2911 			}
  2912 		}
  2913 		break;
  2914 	case EWsClOpGetKeyboardRepeatRate:
  2915 		{
  2916 		SKeyRepeatSettings *settings=(SKeyRepeatSettings *)aReplyDes8->Ptr();
  2917 		aText.AppendFormat(_L("initial=%d,normal=%d"),settings->iInitialTime.Int(),settings->iTime.Int());
  2918 		}
  2919 		break;
  2920 	case EWsClOpGetDoubleClickSettings:
  2921 		{
  2922 		SDoubleClickSettings *settings=(SDoubleClickSettings *)aReplyDes8->Ptr();
  2923 		aText.AppendFormat(_L("interval=%d,distance=%d"),settings->iInterval.Int(),settings->iDistance);
  2924 		}
  2925 		break;
  2926 	case EWsClOpFetchMessage:
  2927 		{
  2928 		_LIT(LogClientRetFetchMessage,"FetchMessage");
  2929 		aText.Append(LogClientRetFetchMessage);
  2930 		}
  2931 		break;
  2932 	case EWsClOpCreateGraphic:
  2933 		aText.AppendFormat(_L("Creating graphic: %s"), aReplyDes8);
  2934 		break;
  2935 	case EWsClOpGetGraphicMessage: 
  2936 		aText.AppendFormat(_L("Graphic message: %s"), aReplyDes8);
  2937 		break;
  2938 	case EWsClOpPointerCursorPosition:
  2939 		{
  2940 		TWsClCmdSetPointerCursorArea *settings=(TWsClCmdSetPointerCursorArea*)aReplyDes8->Ptr();
  2941 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(settings->area));
  2942 		aText.AppendFormat(_L("Cursor position area=%S"), &buf1);
  2943 		}
  2944 		break;
  2945 	case EWsClOpPointerCursorArea:
  2946 		{
  2947 		TWsClCmdSetPointerCursorArea *settings=(TWsClCmdSetPointerCursorArea*)aReplyDes8->Ptr();
  2948 		TLongBuf buf1(TDebugLogTextHandler::FormatRect(settings->area));
  2949 		aText.AppendFormat(_L("Cursor area=%S"), &buf1);
  2950 		}
  2951 		break;
  2952 	case EWsClOpGetDefModeMaxNumColors:
  2953 		{
  2954 		SDefModeMaxNumColors *settings=(SDefModeMaxNumColors*)aReplyDes8->Ptr();
  2955 		aText.AppendFormat(_L("Num of colors=%d, num of grays=%d, display mode=%d"),settings->iColors, settings->iGrays, settings->iDisplayMode);
  2956 		}
  2957 		break;
  2958 	default:
  2959 		UnKnownReplyBuf(aText, aOpcode);
  2960 		break;
  2961 		}
  2962 	}
  2963 
  2964 void TWsDecoder::ReplyBufScreenDevice(TBuf<LogTBufSize> &aText, TInt aOpcode, const TDesC8 *aReplyDes8, const TDesC *)
  2965 	{
  2966 	switch (aOpcode)
  2967 		{
  2968 	case EWsSdOpGetScanLine:
  2969 		{			//This fills up the log two much for test code
  2970 		aText=KNullDesC;
  2971 		//Alternate code that would log this information.
  2972 		/*_LIT(LogScreenDeviceReplyBufGetScanLine,"aScanLine set to ...");
  2973 		aText=LogScreenDeviceReplyBufGetScanLine;*/
  2974 		/*TDebugLogTextHandler::Append(aText, TDebugLogTextHandler::FormatArray(TDebugLogTextHandler::ERgb,
  2975 														((TDesC8 *)aReplyData)->Ptr(),((TDesC8 *)aReplyData)->Length()*sizeof(TRgb)));*/
  2976 		}
  2977 		break;
  2978 	case EWsSdOpHorizontalTwipsToPixels:
  2979 	case EWsSdOpVerticalTwipsToPixels:
  2980 	case EWsSdOpHorizontalPixelsToTwips:
  2981 	case EWsSdOpVerticalPixelsToTwips:
  2982 	case EWsSdOpPixelSize:
  2983 	case EWsSdOpTwipsSize:
  2984 		AppendPoint(aText,aReplyDes8);
  2985 		break;
  2986 	case EWsSdOpPointerRect:
  2987 		AppendRect(aText,aReplyDes8);
  2988 		break;
  2989 	case EWsSdOpGetDefaultScreenSizeAndRotation:
  2990 	case EWsSdOpGetScreenModeSizeAndRotation:
  2991 		{
  2992 		_LIT(LogScreenDeviceReplyBufPTR,"%S %S %d");
  2993 		const TPixelsTwipsAndRotation *sar=(TPixelsTwipsAndRotation *)aReplyDes8->Ptr();
  2994 		TShortBuf buf1(TDebugLogTextHandler::FormatSize(sar->iPixelSize));
  2995 		TShortBuf buf2(TDebugLogTextHandler::FormatSize(sar->iTwipsSize));
  2996 		aText.AppendFormat(LogScreenDeviceReplyBufPTR,&buf1,&buf2,sar->iRotation);
  2997 		}
  2998 		break;
  2999 	case EWsSdOpGetDefaultScreenSizeAndRotation2:
  3000 	case EWsSdOpGetScreenModeSizeAndRotation2:
  3001 		{
  3002 		_LIT(LogScreenDeviceReplyBufPR,"%S %d");
  3003 		const TPixelsAndRotation *sar=(TPixelsAndRotation *)aReplyDes8->Ptr();
  3004 		TShortBuf buf(TDebugLogTextHandler::FormatSize(sar->iPixelSize));
  3005 		aText.AppendFormat(LogScreenDeviceReplyBufPR,&buf,sar->iRotation);
  3006 		}
  3007 		break;
  3008 	case EWsSdOpGetPalette:
  3009 		{
  3010 		_LIT(LogScreenDeviceReplyBufGetPalette,"Palette returned ...");
  3011 		aText.Append(LogScreenDeviceReplyBufGetPalette);
  3012 		}
  3013 		break;
  3014 	case EWsSdOpGetDefaultScreenModeOrigin:	
  3015 		{
  3016 		const TPoint *point = reinterpret_cast<const TPoint*>(aReplyDes8->Ptr());
  3017 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(*point));
  3018 		_LIT(LogScreenDeviceReplyBufGetDefaultScreenModeOrigin,"Default screen mode origin=%S");
  3019 		aText.AppendFormat(LogScreenDeviceReplyBufGetDefaultScreenModeOrigin, &buf1);
  3020 		}
  3021 		break;
  3022 	case EWsSdOpGetScreenModeOrigin:	
  3023 		{
  3024 		const TPoint *point = reinterpret_cast<const TPoint*>(aReplyDes8->Ptr());
  3025 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(*point));
  3026 		_LIT(LogScreenDeviceReplyBufGetScreenModeOrigin,"Screen mode origin=%S");
  3027 		aText.AppendFormat(LogScreenDeviceReplyBufGetScreenModeOrigin, &buf1);
  3028 		}
  3029 		break;
  3030 	case EWsSdOpGetScreenModeScale: 	
  3031 	case EWsSdOpGetCurrentScreenModeScale:	
  3032 		{
  3033 		const TSize *size = reinterpret_cast<const TSize*>(aReplyDes8->Ptr());
  3034 		TShortBuf buf1(TDebugLogTextHandler::FormatSize(*size));
  3035 		_LIT(LogScreenDeviceReplyBufGetScreenScale,"Screen scale=%S");
  3036 		aText.AppendFormat(LogScreenDeviceReplyBufGetScreenScale, &buf1);
  3037 		}
  3038 		break;
  3039 	case EWsSdOpGetScreenModeScaledOrigin: 
  3040 		{
  3041 		const TPoint *point = reinterpret_cast<const TPoint*>(aReplyDes8->Ptr());
  3042 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(*point));
  3043 		_LIT(LogScreenDeviceReplyBufGetScreenModeScaledOrigin,"Screen mode scaled origin=%S");
  3044 		aText.AppendFormat(LogScreenDeviceReplyBufGetScreenModeScaledOrigin, &buf1);
  3045 		}
  3046 		break;
  3047 	case EWsSdOpGetCurrentScreenModeAttributes:	
  3048 		{
  3049 		TSizeMode *settings=(TSizeMode*)aReplyDes8->Ptr();
  3050 		TShortBuf origin(TDebugLogTextHandler ::FormatPoint(settings->iOrigin));
  3051 		TShortBuf size(TDebugLogTextHandler ::FormatSize(settings->iScreenSize));
  3052 		TShortBuf area(TDebugLogTextHandler ::FormatRect(settings->iPointerCursorArea));
  3053 		aText.AppendFormat(_L("Screen attribute: origin=%S, size=%s, rotation=%d, area=$s, display mode = %d"), 
  3054 							   &origin, &size, settings->iAlternativeRotations, &area, settings->iDefaultDisplayMode);
  3055 		}
  3056 		break;
  3057 	case EWsSdOpGetScreenSizeModeList:	
  3058 		AppendDesc(aText, aReplyDes8);
  3059 		break;	
  3060 	default:
  3061 		UnKnownReplyBuf(aText, aOpcode);
  3062 		break;
  3063 		}
  3064 	}