htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp
branchRCL_3
changeset 11 454d022d514b
parent 6 69ec17276f52
equal deleted inserted replaced
9:404ad6c9bc20 11:454d022d514b
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include "HtiKeyEventServicePlugin.h"
    19 #include "HtiKeyEventServicePlugin.h"
    20 #include "PointerEventHandler.h"
    20 #include "PointerEventHandler.h"
    21 
    21 
       
    22 
    22 #include <HtiDispatcherInterface.h>
    23 #include <HtiDispatcherInterface.h>
    23 #include <HtiLogging.h>
    24 #include <HtiLogging.h>
    24 
    25 
    25 
    26 
    26 // CONSTANTS
    27 // CONSTANTS
    54 
    55 
    55 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    56 // CPointerEventHandler::CPointerEventHandler()
    57 // CPointerEventHandler::CPointerEventHandler()
    57 // ----------------------------------------------------------------------------
    58 // ----------------------------------------------------------------------------
    58 CPointerEventHandler::CPointerEventHandler()
    59 CPointerEventHandler::CPointerEventHandler()
    59     : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ),
    60     : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ), iMultiTouchHandler(NULL),
    60       iState( EPointerUp )
    61       iState( EPointerUp )
    61     {
    62     {
    62     }
    63     }
    63 
    64 
    64 // ----------------------------------------------------------------------------
    65 // ----------------------------------------------------------------------------
    73     if ( iCoords )
    74     if ( iCoords )
    74         {
    75         {
    75         iCoords->Close();
    76         iCoords->Close();
    76         }
    77         }
    77     delete iCoords;
    78     delete iCoords;
       
    79     delete iMultiTouchHandler;
    78 	
    80 	
    79 	iAdvancedPointers.ResetAndDestroy();
    81 	iAdvancedPointers.ResetAndDestroy();
    80 	iDelayArray.ResetAndDestroy();  
    82 	iDelayArray.ResetAndDestroy();  
    81 	iAdvPointerMoveArray.ResetAndDestroy(); 
    83 	iAdvPointerMoveArray.ResetAndDestroy(); 
    82     }
    84     }
   132         else
   134         else
   133             {
   135             {
   134             MoveToNextPointL(); // Continuing current line
   136             MoveToNextPointL(); // Continuing current line
   135             }
   137             }
   136         }
   138         }
       
   139     
   137     else if ( iCommand == EPinchZoom )
   140     else if ( iCommand == EPinchZoom )
   138         {
   141         {
   139         PointerMove();
   142         PointerMove();
   140         if ( !AdvancedStartDelay())
   143         if ( !AdvancedStartDelay())
   141             {
   144             {
   142             PointerUp();
   145             PointerUp();
   143             SendOkMsgL();
   146             SendOkMsgL();
   144             iAdvPointerMoveArray.ResetAndDestroy(); 
   147             iAdvPointerMoveArray.ResetAndDestroy(); 
   145             iReady = ETrue;
   148             iReady = ETrue;
   146             }
   149             }
       
   150         }		
       
   151     
       
   152     else if ( iCommand == EMultiTouch )
       
   153         {
       
   154         SendOkMsgL();
       
   155         iMultiTouchHandler->Clear();
       
   156         iReady = ETrue;
   147         }		
   157         }		
   148     HTI_LOG_FUNC_OUT( "CPointerEventHandler::RunL" );
   158     HTI_LOG_FUNC_OUT( "CPointerEventHandler::RunL" );
   149     }
   159     }
   150 
   160 
   151 // ----------------------------------------------------------------------------
   161 // ----------------------------------------------------------------------------
   215 		    HandleAdvancedTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
   225 		    HandleAdvancedTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
   216             break;		
   226             break;		
   217 		case EPinchZoom: 
   227 		case EPinchZoom: 
   218 		    HandlePinchZoomL( aMessage.Right( aMessage.Length() - 1 ) );
   228 		    HandlePinchZoomL( aMessage.Right( aMessage.Length() - 1 ) );
   219             break;
   229             break;
   220 		
   230 		case EMultiTouch:
       
   231 			HandleMultiTouchL(aMessage.Right( aMessage.Length() - 1 ));
       
   232 			break;
   221         default:
   233         default:
   222             SendErrorMessageL( EUnrecognizedCommand,
   234             SendErrorMessageL( EUnrecognizedCommand,
   223                 KErrorUnrecognizedCommand );
   235                 KErrorUnrecognizedCommand );
   224             break;
   236             break;
   225         }
   237         }
   599         return;        
   611         return;        
   600         }
   612         }
   601 
   613 
   602     HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePinchZoomL" );
   614     HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePinchZoomL" );
   603     }	
   615     }	
   604 
   616 // ----------------------------------------------------------------------------
       
   617 // void CPointerEventHandler::HandleMultiTouchL()
       
   618 // ----------------------------------------------------------------------------
       
   619 void CPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
       
   620 	{
       
   621 	HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleMultiTouchL" );	
       
   622 	
       
   623 	if (iMultiTouchHandler == NULL)
       
   624 		iMultiTouchHandler=CMultiTouchPointerEventHandler::NewL(*this);	
       
   625 	
       
   626     if ( !iMultiTouchHandler->HandleMultiTouchL ( aData ) )
       
   627     	{
       
   628 		iMultiTouchHandler->Clear();
       
   629 		SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
       
   630     	}
       
   631     else
       
   632 		iReady = EFalse;
       
   633 	
       
   634 	HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleMultiTouchL" );
       
   635 	}
       
   636 // ----------------------------------------------------------------------------
       
   637 // void CPointerEventHandler::NotifyMultiTouchComplete()
       
   638 // ----------------------------------------------------------------------------
       
   639 void CPointerEventHandler::NotifyMultiTouchComplete()
       
   640     {
       
   641     HTI_LOG_FUNC_IN("CPointerEventHandler::NotifyMultiTouchComplete"); 
       
   642     
       
   643     // wait for 1000 microsecond then clear multi touch and send ok msg 
       
   644     TTimeIntervalMicroSeconds32 time(1000);
       
   645     iTimer.After( iStatus, time );
       
   646     SetActive();    
       
   647     
       
   648     HTI_LOG_FUNC_OUT("CPointerEventHandler::NotifyMultiTouchComplete");
       
   649     }
   605 // ----------------------------------------------------------------------------
   650 // ----------------------------------------------------------------------------
   606 // CPointerEventHandler::AdvancedStartDelay()
   651 // CPointerEventHandler::AdvancedStartDelay()
   607 // ----------------------------------------------------------------------------
   652 // ----------------------------------------------------------------------------
   608 TBool CPointerEventHandler::AdvancedStartDelay()
   653 TBool CPointerEventHandler::AdvancedStartDelay()
   609     {
   654     {