photosgallery/viewframework/views/zoomview/src/glxzoomeventhandler.cpp
branchRCL_3
changeset 30 a60acebbbd9d
parent 25 191387a8b767
child 32 78ad99c24f08
equal deleted inserted replaced
25:191387a8b767 30:a60acebbbd9d
   140     TRACER("CGlxZoomPanEventHandler::SetupAnimatedZoom");
   140     TRACER("CGlxZoomPanEventHandler::SetupAnimatedZoom");
   141     
   141     
   142     iTargetAnimatedZoomRatio = (iMaxZoomRatio + iMinZoomRatio)/2 ;
   142     iTargetAnimatedZoomRatio = (iMaxZoomRatio + iMinZoomRatio)/2 ;
   143     
   143     
   144     CancelAnimationTimer();
   144     CancelAnimationTimer();
       
   145     CancelUITimer();
   145     
   146     
   146     //ToDo: Verify this with images slightly smaller or slightly larger than fullscreen size. 
   147     //ToDo: Verify this with images slightly smaller or slightly larger than fullscreen size. 
   147     if (EZoomIn == aZoomMode)
   148     if (EZoomIn == aZoomMode)
   148         {
   149         {
   149         // the '1+' is to take care of the situation when there the rest of the equation returns something betn 0 and 1
   150         // the '1+' is to take care of the situation when there the rest of the equation returns something betn 0 and 1
   231         {
   232         {
   232         iIsZoomingInAnimatedState = EFalse;
   233         iIsZoomingInAnimatedState = EFalse;
   233         CancelAnimationTimer();
   234         CancelAnimationTimer();
   234         TSize screensize = iMathsEngine.ScreenSize();
   235         TSize screensize = iMathsEngine.ScreenSize();
   235         iZoomFocus = TPoint(screensize.iWidth>>1,screensize.iHeight>>1) ;
   236         iZoomFocus = TPoint(screensize.iWidth>>1,screensize.iHeight>>1) ;
       
   237         
       
   238         //start the timer here after the animation is complete
       
   239         if(EUiOn == iZoomUiState && iZoomActivated)
       
   240             {
       
   241             ShowScreenFurniture(KGlxScreenTimeout);
       
   242             }
   236         }
   243         }
   237     }
   244     }
   238 
   245 
   239 //----------------------------------------------------------------------------------
   246 //----------------------------------------------------------------------------------
   240 // StartPanTimer:Starts the Pan timer for continous Panning
   247 // StartPanTimer:Starts the Pan timer for continous Panning
   375                 break;
   382                 break;
   376     
   383     
   377             //Listen EStdKeyApplicationC as EKeyZoomIn key is mapped to TKeyCode:: EKeyApplicationC for which TStdScancode is EStdKeyApplicatoinC
   384             //Listen EStdKeyApplicationC as EKeyZoomIn key is mapped to TKeyCode:: EKeyApplicationC for which TStdScancode is EStdKeyApplicatoinC
   378             case EStdKeyApplicationC :
   385             case EStdKeyApplicationC :
   379                 {
   386                 {
   380                 HandleZoomStripeAction(EZoomIn ,aEvent.Code()) ;
   387                 HandleZoomKey(EZoomIn ,aEvent.Code()) ;
   381                 consumed = ETrue;
   388                 consumed = ETrue;
   382                 break ;
   389                 break ;
   383                 }
   390                 }
   384             //Listen EStdKeyApplicationD as EKeyZoomOut key is mapped to TKeyCode:: EKeyApplicationD for which TStdScancode is EStdKeyApplicatoinD
   391             //Listen EStdKeyApplicationD as EKeyZoomOut key is mapped to TKeyCode:: EKeyApplicationD for which TStdScancode is EStdKeyApplicatoinD
   385             case EStdKeyApplicationD :
   392             case EStdKeyApplicationD :
   386                 {
   393                 {
   387                 HandleZoomStripeAction(EZoomOut,aEvent.Code());
   394                 HandleZoomKey(EZoomOut,aEvent.Code());
   388                 consumed = ETrue;
   395                 consumed = ETrue;
   389                 break ;
   396                 break ;
   390                 }                
   397                 }                
   391             default:
   398             default:
   392                 break;
   399                 break;
   395 
   402 
   396     return consumed;
   403     return consumed;
   397     }
   404     }
   398 
   405 
   399 // -----------------------------------------------------------------------------
   406 // -----------------------------------------------------------------------------
   400 // HandleZoomStripeAction:Zooms the image on zoom stripe action.
   407 // HandleZoomKey:Zooms the image on zoom stripe action.
   401 // -----------------------------------------------------------------------------
   408 // -----------------------------------------------------------------------------
   402 //
   409 //
   403 void CGlxZoomPanEventHandler::HandleZoomStripeAction(TZoomMode aZoomMode ,
   410 void CGlxZoomPanEventHandler::HandleZoomKey(TZoomMode aZoomMode ,
   404         TEventCode aEventCode)
   411         TEventCode aEventCode)
   405     {
   412     {
   406     TRACER("CGlxZoomControl::HandleZoomStripeAction ");
   413     TRACER("CGlxZoomControl::HandleZoomKey ");
   407     if ( iZoomActivated )
   414     if ( iZoomActivated )
   408         {
   415         {
   409         switch(aEventCode)
   416         switch(aEventCode)
   410             {
   417             {
   411             case EEventKey :
   418             case EEventKey :
   734     // Ignore events when we are animating in Zoom
   741     // Ignore events when we are animating in Zoom
   735     if (iIsZoomingInAnimatedState)
   742     if (iIsZoomingInAnimatedState)
   736         {
   743         {
   737         return;
   744         return;
   738         }
   745         }
   739     
   746 
   740     ShowScreenFurniture(KGlxScreenTimeout);
   747     if (EUiOff == iZoomUiState)
       
   748         {
       
   749         ShowScreenFurniture(KGlxScreenTimeout);
       
   750         }
       
   751     else{
       
   752         HideScreenFurniture();
       
   753         }
   741     }
   754     }
   742 
   755 
   743 // ---------------------------------------------------------------------------
   756 // ---------------------------------------------------------------------------
   744 // UiTimeOut: Hides the screen furniture once the Timeout happens
   757 // UiTimeOut: Hides the screen furniture once the Timeout happens
   745 // ---------------------------------------------------------------------------
   758 // ---------------------------------------------------------------------------
   839 // -----------------------------------------------------------------------------
   852 // -----------------------------------------------------------------------------
   840 //
   853 //
   841 void CGlxZoomPanEventHandler::ShowScreenFurniture(TTimeIntervalMicroSeconds32 aTimeout)
   854 void CGlxZoomPanEventHandler::ShowScreenFurniture(TTimeIntervalMicroSeconds32 aTimeout)
   842     {
   855     {
   843     TRACER("CGlxZoomPanEventHandler::ShowScreenFurniture()");
   856     TRACER("CGlxZoomPanEventHandler::ShowScreenFurniture()");
   844 
   857     
   845     iZoomEventHandler.HandleShowUi(ETrue);
   858     if (EUiOff == iZoomUiState )
       
   859         {
       
   860         // make visible if not already visible. 
       
   861         // the timer will ofcourse get restarted. 
       
   862         iZoomEventHandler.HandleShowUi(ETrue);
       
   863         }
   846     
   864     
   847     if (aTimeout.Int())
   865     if (aTimeout.Int())
   848         {
   866         {
   849         StartUITimer(aTimeout,aTimeout,TCallBack( UiTimeOut,this ));
   867         StartUITimer(aTimeout,aTimeout,TCallBack( UiTimeOut,this ));
   850         }
   868         }
   856 // -----------------------------------------------------------------------------
   874 // -----------------------------------------------------------------------------
   857 //
   875 //
   858 void CGlxZoomPanEventHandler::HideScreenFurniture()
   876 void CGlxZoomPanEventHandler::HideScreenFurniture()
   859     {
   877     {
   860     TRACER("CGlxZoomPanEventHandler::HideScreenFurniture()");
   878     TRACER("CGlxZoomPanEventHandler::HideScreenFurniture()");
   861 
   879     if (EUiOn == iZoomUiState )
   862     iZoomEventHandler.HandleShowUi(EFalse);
   880         {
   863     CancelUITimer();
   881         iZoomEventHandler.HandleShowUi(EFalse);
       
   882         CancelUITimer();
       
   883         }
   864     }
   884     }
   865 
   885 
   866 
   886 
   867 // -----------------------------------------------------------------------------
   887 // -----------------------------------------------------------------------------
   868 // ActivateZoom
   888 // ActivateZoom
  1143 // -----------------------------------------------------------------------------
  1163 // -----------------------------------------------------------------------------
  1144 //
  1164 //
  1145 TUiState CGlxZoomPanEventHandler::ZoomUiState()
  1165 TUiState CGlxZoomPanEventHandler::ZoomUiState()
  1146     {
  1166     {
  1147     TRACER("CGlxZoomPanEventHandler::ZoomUiState");
  1167     TRACER("CGlxZoomPanEventHandler::ZoomUiState");
       
  1168     GLX_LOG_INFO1("CGlxZoomPanEventHandler::ZoomUiState :=%d",iZoomUiState);
  1148     return iZoomUiState ;
  1169     return iZoomUiState ;
  1149     }
  1170     }
  1150 
  1171 
  1151 // -----------------------------------------------------------------------------
  1172 // -----------------------------------------------------------------------------
  1152 // HandleMultiTouchReleased
  1173 // HandleMultiTouchReleased