vtuis/videotelui/src/CVtUiContextControl.cpp
branchRCL_3
changeset 11 50bbdc59f9c4
parent 10 f84a661cfc1d
child 14 856ae1b15d98
equal deleted inserted replaced
10:f84a661cfc1d 11:50bbdc59f9c4
    75     {
    75     {
    76     __VTPRINTENTER( "CtxCtrl.HandlePointerEventL" )
    76     __VTPRINTENTER( "CtxCtrl.HandlePointerEventL" )
    77     __VTPRINT2( DEBUG_GEN, "CtxCtrl.HandlePtr  ok= %d", iOkToSwapOnButtonUp )
    77     __VTPRINT2( DEBUG_GEN, "CtxCtrl.HandlePtr  ok= %d", iOkToSwapOnButtonUp )
    78     if ( AknLayoutUtils::PenEnabled() )
    78     if ( AknLayoutUtils::PenEnabled() )
    79         {
    79         {
    80         if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
    80         __VTPRINT2( DEBUG_GEN, "CtxCtrl.HandlePtr.Position.iX = %d", aPointerEvent.iPosition.iX )
       
    81         __VTPRINT2( DEBUG_GEN, "CtxCtrl.HandlePtr.Position.iY = %d", aPointerEvent.iPosition.iY )
       
    82         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
    81             {
    83             {
    82             TRect window( Size() );
    84             TRect window( Size() );
    83             if ( !window.Contains( aPointerEvent.iPosition ) )
    85             if ( !window.Contains( aPointerEvent.iPosition ) )
    84                 {
    86                 {
       
    87                 __VTPRINT( DEBUG_GEN, "CtxCtrl.HandlePtr.Button1Down outside" )
       
    88                 // Down outside of Ctx ctrl, set inside false
       
    89                 iPointerButton1DownInside = EFalse;
       
    90                 }
       
    91             else
       
    92                 {
       
    93                 __VTPRINT( DEBUG_GEN, "CtxCtrl.HandlePtrButton1Down inside" )
       
    94                 // Only true here
       
    95                 iPointerButton1DownInside = ETrue;
       
    96                 }
       
    97             }
       
    98         else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
    99             {
       
   100             TRect window( Size() );
       
   101             if ( !window.Contains( aPointerEvent.iPosition ) )
       
   102                 {
       
   103                 __VTPRINT( DEBUG_GEN, "CtxCtrl.HandlePtr.Button1Up outside" )
       
   104                 
       
   105                 // Up outside of Ctx ctrl, set inside false
       
   106                 iPointerButton1DownInside = EFalse;
       
   107                 
    85                 iOkToSwapOnButtonUp = ETrue;
   108                 iOkToSwapOnButtonUp = ETrue;
    86                 SetGloballyCapturing( EFalse );
   109                 SetGloballyCapturing( EFalse );
    87                 SetPointerCapture( EFalse); 
   110                 SetPointerCapture( EFalse ); 
    88                 }
   111                 }
    89             else if( iOkToSwapOnButtonUp )
   112             else if( iOkToSwapOnButtonUp )
    90                 {
   113                 {
       
   114                 __VTPRINT( DEBUG_GEN, "CtxCtrl.HandlePtr.Button1Up inside" )
    91                  if ( !iUiStates.IsWhiteBalanceModeOn() &&
   115                  if ( !iUiStates.IsWhiteBalanceModeOn() &&
    92                       !iUiStates.IsColorToneModeOn() &&
   116                       !iUiStates.IsColorToneModeOn() &&
    93                       !iUiStates.IsZoomModeOn() &&
   117                       !iUiStates.IsZoomModeOn() &&
    94                       !iUiStates.IsCaptureModeOn() &&
   118                       !iUiStates.IsCaptureModeOn() &&
    95                       !iUiStates.IsContrastModeOn() &&
   119                       !iUiStates.IsContrastModeOn() &&
    96                       !iUiStates.IsBrightnessModeOn() &&
   120                       !iUiStates.IsBrightnessModeOn() &&
    97                       !iUiStates.IsVolumeModeOn() )
   121                       !iUiStates.IsVolumeModeOn() )
    98                         {
   122                         {
    99                         if ( !( iAppUi.CanSwapImagePlaces() ) )
   123                         if ( !iPointerButton1DownInside ||
       
   124                                 !( iAppUi.CanSwapImagePlaces() ) )
   100                             {
   125                             {
       
   126                             // Set the flag back
       
   127                             iPointerButton1DownInside = EFalse;
   101                             return;
   128                             return;
   102                             }	
   129                             }
       
   130                         // Set the flag back
       
   131                         iPointerButton1DownInside = EFalse;
   103                         iAppUi.HandleCommandL( EVtUiCmdSwapImagesPlaces );
   132                         iAppUi.HandleCommandL( EVtUiCmdSwapImagesPlaces );
   104                         }
   133                         }
   105                 }
   134                 }
   106             else
   135             else
   107                 {
   136                 {
       
   137                 __VTPRINT( DEBUG_GEN, "CtxCtrl.HandlePtr.Button1Up inside" )
   108                 SetGloballyCapturing( EFalse );
   138                 SetGloballyCapturing( EFalse );
   109                 SetPointerCapture( EFalse); 
   139                 SetPointerCapture( EFalse); 
   110                 iOkToSwapOnButtonUp = ETrue;
   140                 iOkToSwapOnButtonUp = ETrue;
       
   141                 // Set the flag back
       
   142                 iPointerButton1DownInside = EFalse;
   111                 }
   143                 }
   112             }
   144             }
   113         }
   145         }
   114     __VTPRINTEXIT( "CtxCtrl.HandlePointerEventL" )
   146     __VTPRINTEXIT( "CtxCtrl.HandlePointerEventL" )
   115     }
   147     }
   281         {
   313         {
   282         iAppUi.EventMonitor()->AddObserverL( this );
   314         iAppUi.EventMonitor()->AddObserverL( this );
   283         }
   315         }
   284         
   316         
   285     iOkToSwapOnButtonUp = ETrue;
   317     iOkToSwapOnButtonUp = ETrue;
       
   318     
       
   319     ClaimPointerGrab( ETrue );
       
   320     
   286     __VTPRINTEXIT( "CtxCtrl.ConstructL" )
   321     __VTPRINTEXIT( "CtxCtrl.ConstructL" )
   287     }
   322     }
   288 
   323 
   289 // -----------------------------------------------------------------------------
   324 // -----------------------------------------------------------------------------
   290 // CVtUiContextControl::HandleWsEventL
   325 // CVtUiContextControl::HandleWsEventL
   297     if( aEvent.Type() == EEventPointer )
   332     if( aEvent.Type() == EEventPointer )
   298         {
   333         {
   299         // Touch outside of volume popup, close volume popup
   334         // Touch outside of volume popup, close volume popup
   300         if ( aEvent.Pointer()->iType == TPointerEvent::EButton1Down )
   335         if ( aEvent.Pointer()->iType == TPointerEvent::EButton1Down )
   301             {
   336             {
   302             if ( iAppUi.IsDisplayingMenuOrDialog() )
   337             __VTPRINT( DEBUG_GEN, "CtxCtrl.WsEvent.Button1Down inside" )
   303                 {
   338             iOkToSwapOnButtonUp = !iUiStates.IsZoomModeOn() &&
   304                 iOkToSwapOnButtonUp = EFalse;
   339                     !iUiStates.IsContrastModeOn() &&
   305                 }
   340                     !iUiStates.IsBrightnessModeOn() &&
   306             else if ( aDestination == this )
   341                     !iUiStates.IsVolumeModeOn();
       
   342             
       
   343             if( iUiStates.IsZoomModeOn() && iUiStates.IsCaptureModeOn() )
       
   344                 {
       
   345                 iOkToSwapOnButtonUp = ETrue;
       
   346                 }            
       
   347             
       
   348             if ( aDestination == this )
   307                 {
   349                 {
   308                 iOkToSwapOnButtonUp = !iUiStates.IsZoomModeOn() &&
   350                 iOkToSwapOnButtonUp = !iUiStates.IsZoomModeOn() &&
   309                     !iUiStates.IsCaptureModeOn() &&
   351                     !iUiStates.IsCaptureModeOn() &&
   310                     !iUiStates.IsContrastModeOn() &&
   352                     !iUiStates.IsContrastModeOn() &&
   311                     !iUiStates.IsBrightnessModeOn() &&
   353                     !iUiStates.IsBrightnessModeOn() &&
   312                     !iUiStates.IsVolumeModeOn();
   354                     !iUiStates.IsVolumeModeOn();
   313                     SetGloballyCapturing( ETrue );
   355                     SetGloballyCapturing( ETrue );
   314                     SetPointerCapture( ETrue ); 
   356                     SetPointerCapture( ETrue ); 
   315                 }
   357                 }
   316             }             
   358             }
       
   359         else if ( aEvent.Pointer()->iType == TPointerEvent::EButton1Up )
       
   360             {
       
   361             __VTPRINT( DEBUG_GEN, "CtxCtrl.WsEvent.Button1Up inside" )
       
   362             }
   317         }
   363         }
   318     __VTPRINTEXIT( "CVtUiContextControl.HandleWsEventL" )
   364     __VTPRINTEXIT( "CVtUiContextControl.HandleWsEventL" )
   319     }
   365     }
   320 
   366 
   321 // -----------------------------------------------------------------------------
   367 // -----------------------------------------------------------------------------