uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp
branchRCL_3
changeset 34 3a60ebea00d0
parent 11 46927d61fef3
child 41 cd0ae4656946
equal deleted inserted replaced
24:f93c875b566e 34:3a60ebea00d0
   293 	}
   293 	}
   294 	
   294 	
   295 CGfxTransAdapterTfx::~CGfxTransAdapterTfx()
   295 CGfxTransAdapterTfx::~CGfxTransAdapterTfx()
   296 	{
   296 	{
   297 	
   297 	
       
   298     
       
   299     iControlEffects.Close();
   298 	__ALFFXLOGSTRING("CGfxTransAdapterTfx for HWA transitionn effects, destructor ");
   300 	__ALFFXLOGSTRING("CGfxTransAdapterTfx for HWA transitionn effects, destructor ");
   299 //	iIgnoredWOChildControls.Close();
   301 //	iIgnoredWOChildControls.Close();
   300 	//iControlInfo.ResetAndDestroy();
   302 	//iControlInfo.ResetAndDestroy();
   301 	if ( iConnected )
   303 	if ( iConnected )
   302 	    {
   304 	    {
   454 	    {
   456 	    {
   455 	    return KErrNone;
   457 	    return KErrNone;
   456 	    }
   458 	    }
   457 	 
   459 	 
   458 	TInt err = KErrNone;    
   460 	TInt err = KErrNone;    
   459 	TInt action = 0;
       
   460 	const CTransitionData* transdata;
   461 	const CTransitionData* transdata;
   461 	err = iClient->GetTransitionData( aHandle, transdata );
   462 	err = iClient->GetTransitionData( aHandle, transdata );
   462 	if ( err == KErrNone )
       
   463 	    {
       
   464     	action = transdata->iAction;
       
   465 	    }
       
   466 
   463 
   467 	switch(aState)
   464 	switch(aState)
   468 		{
   465 		{
   469 		case EFallback:
   466 		case EFallback:
       
   467 	    case EAbort:
       
   468 	        for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
       
   469 	            {
       
   470 	            // clear ongoing effect for this handle
       
   471 	            if( iControlEffects[i].iHandle == aHandle)
       
   472 	                {
       
   473 	                iControlEffects.Remove(i);
       
   474 	                i--;
       
   475 	                }
       
   476 	            }
   470 		    break;
   477 		    break;
   471 		case EPreBeginCapture:
   478 		case EPreBeginCapture:
   472 		    break;
   479 		    break;
   473 		case EPostBeginCapture:
   480 		case EPostBeginCapture:
   474 			// Send control effect request to ALf. This is done immediately after call of 
   481 			// Send control effect request to ALf. This is done immediately after call of 
   475 			// GfxTransEffect::Begin(). This makes it possible (NOT QUARANTEENED)
   482 			// GfxTransEffect::Begin(). This makes it possible (NOT QUARANTEENED)
   476 			// that effect request arrives to Alf before possible visiblity changes are made to 
   483 			// that effect request arrives to Alf before possible visiblity changes are made to 
   477 			// the control.
   484 			// the control.
   478 		    if ( iHasPlugin && aKey && aKey->DrawableWindow())
   485 		    if (aKey && aKey->DrawableWindow() && err == KErrNone)
   479 		        {
   486 		        {
   480 		        // We must generate our own transition as we won't be sending 
   487                 TControlEffect newEffect;
   481 		        // iClient->TransitionFinished back.
   488                 newEffect.iHandle = aHandle;
   482 		        // (Client did not ask for transition to be started, and won't be
   489                 newEffect.iWindowGroup = aKey->DrawableWindow()->WindowGroupId();
   483 		        // interested in the end.)
   490                 newEffect.iWindowHandle =aKey->DrawableWindow()->ClientHandle(); 
   484           		TRAP( err, GenerateTransitionL( aKey, transdata ) );
   491                 iControlEffects.Append(newEffect);
   485 		        }
   492 		        }
   486 		    break;
   493 		    break;
   487 		case EPreEndCapture:	
   494 		case EPreEndCapture:	
   488 		    break;
   495 		    break;
   489 		case EPostEndCapture:
   496 		case EPostEndCapture:
   490 		    break;
   497             if (aKey && err == KErrNone)
   491 		case EAbort:
   498                 {
   492 		// Abort component transition, handle given.
   499                 TRAP( err, GenerateComponentTransitionEventL( transdata, MAlfGfxEffectPlugin::EBeginComponentTransition, aHandle ) );
       
   500                 }
   493 		    break;
   501 		    break;
   494 		case EGlobalAbort:
   502 		case EGlobalAbort:
   495 		// abort component transition, no handle.
   503 		    // abort component transition, no handle.
       
   504 		    for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
       
   505                 {
       
   506                 // clear all on going effects
       
   507                 iControlEffects.Remove(i);
       
   508                 i--;
       
   509                 }
       
   510           // TODO: send abort to server
       
   511 		   // TRAP( err, GenerateComponentTransitionEventL( transdata, MAlfGfxEffectPlugin::EAbortComponentTransition) );
       
   512 		    
   496 	        break;
   513 	        break;
   497 		case EBeginGroup:
   514 		case EBeginGroup:
   498 			{
   515 			{
   499 			__ALFFXLOGSTRING1("-- BeginGroup: New transition group for groupid: %d)",aHandle);
   516             __ALFFXLOGSTRING1("-- BeginGroup: New transition group for groupid: %d)",aHandle);
   500 			SendGroupCommand(aHandle, EFalse);
   517             SendGroupCommand(aHandle, EFalse);
   501 		    break;
   518 		    break;
   502 			}
   519 			}
   503 		case EEndGroup:
   520 		case EEndGroup:
   504 			{
   521 			{
   505 			__ALFFXLOGSTRING1("-- EndGroup: closing transition group: %d)",aHandle);
   522             __ALFFXLOGSTRING1("-- EndGroup: closing transition group: %d)",aHandle);
   506 			SendGroupCommand(aHandle, ETrue);
   523             SendGroupCommand(aHandle, ETrue);
   507 		    break;
   524 		    break;
   508 			}
   525 			}
   509 		default:
   526 		default:
   510 			break;
   527 			break;
   511 		}
   528 		}
  1267 	iCurrHandle = 0;
  1284 	iCurrHandle = 0;
  1268 */	
  1285 */	
  1269 	__ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL <<");
  1286 	__ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL <<");
  1270 	}
  1287 	}
  1271 
  1288 
  1272 void CGfxTransAdapterTfx::GenerateTransitionL( const CCoeControl* aKey, const CTransitionData* aTransData)
  1289 void CGfxTransAdapterTfx::GenerateComponentTransitionEventL(const CTransitionData* aTransData, TInt aOp, TInt aHandle)
  1273     {
  1290     {
  1274 
  1291 
  1275     // We generate a transition call from begin capture for control exit transitions
  1292     // We generate a transition call from begin capture for control exit transitions
  1276 	TPtr8 inPtr = iTransferBuffer->Des();
  1293     TPtr8 inPtr = iTransferBuffer->Des();
  1277 	inPtr.Zero();
  1294     inPtr.Zero();
  1278 	TPtr8 outPtr = iReturnBuffer->Des();
  1295     TPtr8 outPtr = iReturnBuffer->Des();
  1279 	outPtr.Zero();
  1296     outPtr.Zero();
  1280 	RDesWriteStream inBuf( inPtr );
  1297     RDesWriteStream inBuf( inPtr );
  1281     TInt op = MAlfGfxEffectPlugin::EBeginComponentTransition;
  1298     TInt op = aOp;
  1282     TInt windowGroup = aKey->DrawableWindow()->WindowGroupId();
  1299     
  1283     TInt windowHandle = aKey->DrawableWindow()->ClientHandle(); 
  1300     TInt windowGroup = KErrNotFound;
  1284     
  1301     TInt windowHandle = KErrNotFound;
  1285     __ALFFXLOGSTRING4("CGfxTransAdapterTfx::GenerateTransitionL - Operation: MAlfGfxEffectPlugin::EBeginComponentTransition Action: %d,  Uid: 0x%x, WindowGroup: %d, WindowHandle: %d  >>",
  1302     if( aHandle != KErrNotFound )
       
  1303         {
       
  1304         for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
       
  1305             {
       
  1306             // we take the last one. to make hopefully clean up any earlier effect that was not finished for some reason.
       
  1307             if( iControlEffects[i].iHandle == aHandle)
       
  1308                 {
       
  1309                 windowGroup = iControlEffects[i].iWindowGroup;
       
  1310                 windowHandle = iControlEffects[i].iWindowHandle;
       
  1311                 iControlEffects.Remove(i);
       
  1312                 i--;
       
  1313                 }
       
  1314             }
       
  1315         }
       
  1316     if(aHandle != KErrNotFound && (windowGroup == KErrNotFound  || windowHandle == KErrNotFound))
       
  1317         {
       
  1318         return;
       
  1319         }
       
  1320     
       
  1321     __ALFFXLOGSTRING1("CGfxTransAdapterTfx::GenerateComponentTransitionEventL - Operation: %d", op );
       
  1322 
       
  1323     __ALFFXLOGSTRING4("CGfxTransAdapterTfx::GenerateComponentTransitionEventL - Action: %d,  Uid: 0x%x, WindowGroup: %d, WindowHandle: %d  >>",
  1286         aTransData->iAction,
  1324         aTransData->iAction,
  1287         aTransData->iUid.iUid,
  1325         aTransData->iUid.iUid,
  1288         windowGroup,
  1326         windowGroup,
  1289         windowHandle
  1327         windowHandle
  1290         );
  1328         );
  1301 
  1339 
  1302     inBuf.CommitL();
  1340     inBuf.CommitL();
  1303     inBuf.Release();
  1341     inBuf.Release();
  1304     inBuf.Close();
  1342     inBuf.Close();
  1305 
  1343 
  1306     __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GenerateTransitionL" );
  1344     __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GenerateTransitionL - iTfxServer.SendSynchronousData " );
  1307     iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
  1345     iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
  1308     // clear out used data    
  1346     // clear out used data    
  1309 	inPtr.Zero();
  1347     inPtr.Zero();
  1310 	outPtr.Zero();
  1348     outPtr.Zero();
  1311 	
  1349     
  1312 	// Don't signal client because client did not request the transition to start
  1350     // Don't signal client because client did not request the transition to start
  1313     __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL <<");
  1351     __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL <<");
  1314     }
  1352     }	
  1315 	
  1353 
  1316 	
  1354 
  1317 // ---------------------------------------------------------------------------
  1355 // ---------------------------------------------------------------------------
  1318 // finds a control
  1356 // finds a control
  1319 // ---------------------------------------------------------------------------
  1357 // ---------------------------------------------------------------------------
  1320 //
  1358 //
  1321 //CTransControlDrawerInfo* CGfxTransAdapterTfx::FindControl(TInt /*aHandle*/)
  1359 //CTransControlDrawerInfo* CGfxTransAdapterTfx::FindControl(TInt /*aHandle*/)