uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
changeset 19 f5bac0badc7e
parent 14 83d2d132aa58
child 24 f93c875b566e
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
    39 
    39 
    40 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
    40 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
    41 // this will stop the effect.
    41 // this will stop the effect.
    42 const TInt KAlfShortEffectTimeout = 4000000;
    42 const TInt KAlfShortEffectTimeout = 4000000;
    43 const TInt KAlfLongEffectTimeout  = 5000000;
    43 const TInt KAlfLongEffectTimeout  = 5000000;
       
    44 const TInt KAlfActiveControlFxGranularity = 4;
    44 
    45 
    45 //const TInt KAlfLongEffectTimeout  = 500000;
    46 //const TInt KAlfLongEffectTimeout  = 500000;
    46 // Timer to send finish full screen effect
    47 // Timer to send finish full screen effect
    47 // ---------------------------------------------------------
    48 // ---------------------------------------------------------
    48 // CAlfFinishTimer
    49 // CAlfFinishTimer
   235     iControlTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
   236     iControlTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
   236     iFullScreenTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
   237     iFullScreenTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
   237     iProperty.Attach( KPSAlfDomain, KAlfTransitionStatus );
   238     iProperty.Attach( KPSAlfDomain, KAlfTransitionStatus );
   238     iProperty.Set( KPSAlfDomain, KAlfTransitionStatus, 0 );
   239     iProperty.Set( KPSAlfDomain, KAlfTransitionStatus, 0 );
   239     iFs.Connect();
   240     iFs.Connect();
   240     
       
   241     }
   241     }
   242 
   242 
   243 // ---------------------------------------------------------------------------
   243 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   245 //
   245 //
   246 CAlfServerDrawer::CAlfServerDrawer( CAlfWindowManager* aWindowManager,
   246 CAlfServerDrawer::CAlfServerDrawer( CAlfWindowManager* aWindowManager,
   247     CPolicyHandler& aPolicyHandler  ):
   247     CPolicyHandler& aPolicyHandler  ):
   248     iWindowManager( aWindowManager ),
   248     iWindowManager( aWindowManager ),
   249     iPolicyHandler( aPolicyHandler )
   249     iPolicyHandler( aPolicyHandler ),
       
   250     iActiveControlFx( KAlfActiveControlFxGranularity )
   250     {
   251     {
   251     iScrModeChangedState = EScreenModeChangedIdle;
   252     iScrModeChangedState = EScreenModeChangedIdle;
   252     }
   253     }
   253 
   254 
   254 // ---------------------------------------------------------------------------
   255 // ---------------------------------------------------------------------------
   262     iFs.Close();
   263     iFs.Close();
   263     delete iControlController;
   264     delete iControlController;
   264     delete iFullScreenController;
   265     delete iFullScreenController;
   265     delete iFinishFullScreen;
   266     delete iFinishFullScreen;
   266     delete iFullScreenTimeout;
   267     delete iFullScreenTimeout;
   267         
   268     iActiveControlFx.Close();
   268     }
   269     }
   269 
   270 
   270 // ---------------------------------------------------------------------------
   271 // ---------------------------------------------------------------------------
   271 // ---------------------------------------------------------------------------
   272 // ---------------------------------------------------------------------------
   272 //
   273 //
   661     if ( bridgeBuffer )
   662     if ( bridgeBuffer )
   662         {
   663         {
   663         RMemWriteStream stream( bridgeBuffer, bufferSize );
   664         RMemWriteStream stream( bridgeBuffer, bufferSize );
   664         // The writes should not leave if we have calculated our buffer length correctly.
   665         // The writes should not leave if we have calculated our buffer length correctly.
   665         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
   666         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
   666         stream.WriteInt32L( iCurrentFullScreenHandle );
   667         stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
   667         stream.WriteInt32L( iType );
   668         stream.WriteInt32L( iType );
   668       	if ( iType == AknTransEffect::EParameterType && isExit )
   669       	if ( iType == AknTransEffect::EParameterType && isExit )
   669       	    {
   670       	    {
   670             stream.WriteInt32L( iToWg );
   671             stream.WriteInt32L( iToWg );
   671             stream.WriteInt32L( 0 );
   672             stream.WriteInt32L( 0 );
  1051         RMemWriteStream stream( bridgeBuffer, bufferSize );
  1052         RMemWriteStream stream( bridgeBuffer, bufferSize );
  1052         // The writes should not leave if we have calculated our buffer length correctly.
  1053         // The writes should not leave if we have calculated our buffer length correctly.
  1053         TRAP_IGNORE(
  1054         TRAP_IGNORE(
  1054             {
  1055             {
  1055             stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition );
  1056             stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition );
  1056             stream.WriteInt32L( iCurrentControlHandle );
  1057             stream.WriteInt32L( iControlHandle ); //iCurrentControlHandle );
  1057             stream.WriteInt32L( iControlHandle ); // window handle
  1058             stream.WriteInt32L( iControlHandle ); // window handle
  1058             stream.WriteInt32L( iControlWindowGroup ); // window group id
  1059             stream.WriteInt32L( iControlWindowGroup ); // window group id
  1059             stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future
  1060             stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future
  1060             // should send starting and ending points and possible other position/rectange
  1061             // should send starting and ending points and possible other position/rectange
  1061             // data, too.
  1062             // data, too.
  1063             stream << resourceDir;
  1064             stream << resourceDir;
  1064             stream << actionFile;    
  1065             stream << actionFile;    
  1065             stream.CommitL();
  1066             stream.CommitL();
  1066             });
  1067             });
  1067         bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index );
  1068         bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index );
  1068         __ALFFXLOGSTRING1("CAlfServerDrawer::SendBeginControlTransition - sending bridgedata, Current handle: %d", iCurrentControlHandle);
  1069         __ALFFXLOGSTRING1("CAlfServerDrawer::SendBeginControlTransition - sending bridgedata, Current handle: %d", iControlHandle)
  1069         iWindowManager->PostIt( bridgerData );
  1070         iWindowManager->PostIt( bridgerData );
  1070         stream.Close();
  1071         stream.Close();
  1071         iControlTransitionEndObserver->StartObserving( TCallBack( ControlTransitionFinished, this ), iCurrentControlHandle );
  1072         iControlTransitionEndObserver->StartObserving( TCallBack( ControlTransitionFinished, this ), iControlHandle );
       
  1073         
       
  1074         if ( iActiveControlFx.Find( iControlHandle ) == KErrNotFound )
       
  1075             {
       
  1076             iActiveControlFx.Append( iControlHandle );
       
  1077             }
  1072         }
  1078         }
  1073 	
  1079 	
  1074     iFullScreenFinished = EFalse;
  1080     iFullScreenFinished = EFalse;
  1075     
  1081     
  1076     iControlTimeout->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) );
  1082     iControlTimeout->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) );
  1084 TInt CAlfServerDrawer::SendFinishControlTransition()
  1090 TInt CAlfServerDrawer::SendFinishControlTransition()
  1085     {
  1091     {
  1086     // We should now delete the effects from any controls that remain active.
  1092     // We should now delete the effects from any controls that remain active.
  1087     __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition >>");
  1093     __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition >>");
  1088     iControlTransitionEndObserver->Cancel();
  1094     iControlTransitionEndObserver->Cancel();
  1089 	
  1095     
       
  1096     while ( iActiveControlFx.Count() )
       
  1097         {
       
  1098         TInt handle = iActiveControlFx[ iActiveControlFx.Count() - 1 ];
       
  1099         iActiveControlFx.Remove( iActiveControlFx.Count() - 1 );
       
  1100         DoSendFinishControlTransition( handle );
       
  1101         }
       
  1102 
       
  1103     return KErrNone;
       
  1104     }
       
  1105 
       
  1106 // ---------------------------------------------------------------------------
       
  1107 // ---------------------------------------------------------------------------
       
  1108 //
       
  1109 TInt CAlfServerDrawer::DoSendFinishControlTransition(TInt aHandle)
       
  1110     {
       
  1111     __ALFFXLOGSTRING1("CAlfServerDrawer::DoSendFinishControlTransition %d >>", aHandle)
       
  1112     	
  1090     // Send the data to CAlfAppUI via bridge
  1113     // Send the data to CAlfAppUI via bridge
  1091     TAlfBridgerData bridgerData;
  1114     TAlfBridgerData bridgerData;
  1092     
  1115     
  1093     // We must make a stream of the data as the length may vary.
  1116     // We must make a stream of the data as the length may vary.
  1094     // This function only sends numbers, others send filenames, too.
  1117     // This function only sends numbers, others send filenames, too.
  1104         RMemWriteStream stream( bridgeBuffer, bufferSize );
  1127         RMemWriteStream stream( bridgeBuffer, bufferSize );
  1105         // The writes should not leave if we have calculated our buffer length correctly.
  1128         // The writes should not leave if we have calculated our buffer length correctly.
  1106         TRAP_IGNORE(
  1129         TRAP_IGNORE(
  1107             {
  1130             {
  1108             stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition );
  1131             stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition );
  1109             stream.WriteInt32L( iCurrentControlHandle );
  1132             stream.WriteInt32L( aHandle );
  1110             stream.WriteInt32L( 0 );
  1133             stream.WriteInt32L( 0 );
  1111             stream.WriteInt32L( 0 );
  1134             stream.WriteInt32L( 0 );
  1112             stream.WriteInt32L( 0 );
  1135             stream.WriteInt32L( 0 );
  1113             stream.WriteInt32L( 0 ); 
  1136             stream.WriteInt32L( 0 ); 
  1114             stream.CommitL();    
  1137             stream.CommitL();    
  1115             });
  1138             });
  1116 			// TODO, check, if iCurrentHandle is approriate
  1139 			// TODO, check, if iCurrentHandle is approriate
  1117         bridgerData.Set( EAlfStopControlEffectFx, iCurrentControlHandle, bufferSize, (TAny*) index );
  1140         bridgerData.Set( EAlfStopControlEffectFx, aHandle, bufferSize, (TAny*) index );
  1118         __ALFFXLOGSTRING1("CAlfServerDrawer::sending bridgedata, Stop control handle: %d", iCurrentControlHandle);
  1141         __ALFFXLOGSTRING1("CAlfServerDrawer::sending bridgedata, Stop control handle: %d", aHandle);
  1119         iWindowManager->PostIt( bridgerData );
  1142         iWindowManager->PostIt( bridgerData );
  1120         stream.Close();
  1143         stream.Close();
  1121         }
  1144         }
  1122     __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition <<");
  1145     __ALFFXLOGSTRING("CAlfServerDrawer::DoSendFinishControlTransition <<")
  1123     return KErrNone;
  1146     return KErrNone;
  1124     }
  1147     }
  1125 	
  1148 	
  1126 // ---------------------------------------------------------------------------
  1149 // ---------------------------------------------------------------------------
  1127 // ---------------------------------------------------------------------------
  1150 // ---------------------------------------------------------------------------