photosgallery/viewframework/views/zoomview/src/glxzoomeventhandler.cpp
branchRCL_3
changeset 47 f9e827349359
parent 35 420f6808bf21
child 56 b023a8d2866a
equal deleted inserted replaced
35:420f6808bf21 47:f9e827349359
    49 const TInt KGlxAnimeFrameInmS           = 10000     ;
    49 const TInt KGlxAnimeFrameInmS           = 10000     ;
    50 const TInt KGlxAnimeFrameCount          = 10        ;                 
    50 const TInt KGlxAnimeFrameCount          = 10        ;                 
    51 
    51 
    52 const TInt KGlxPanInertiaFrameInmS      = 20000     ;
    52 const TInt KGlxPanInertiaFrameInmS      = 20000     ;
    53 
    53 
    54 //Zoom Factor to keep the relative Zoom Ratio 
    54 // The (neutral) zoom factor above which all zooms caused are zoom-ins and below , zoom-outs.
    55 //same while changing orientation.
       
    56 const TInt KGlxNeutralZoomFactor = 100;
    55 const TInt KGlxNeutralZoomFactor = 100;
    57 
    56 
    58 using namespace GestureHelper;
    57 using namespace GestureHelper;
    59 
    58 
    60 // ============================ CGlxZoomPanEventHandler===============================
    59 // ============================ CGlxZoomPanEventHandler===============================
    62 
    61 
    63 //----------------------------------------------------------------------------------
    62 //----------------------------------------------------------------------------------
    64 // NewL
    63 // NewL
    65 //----------------------------------------------------------------------------------
    64 //----------------------------------------------------------------------------------
    66 //
    65 //
    67 CGlxZoomPanEventHandler* CGlxZoomPanEventHandler::NewL(MGlxZoomEventHandlers& aZoomEventHandler)
    66 CGlxZoomPanEventHandler* CGlxZoomPanEventHandler::NewL(
       
    67         MGlxZoomEventHandlers& aZoomEventHandler)
    68     {
    68     {
    69     TRACER("CGlxZoomPanEventHandler::NewL");
    69     TRACER("CGlxZoomPanEventHandler::NewL");
    70     CGlxZoomPanEventHandler* self = new (ELeave) CGlxZoomPanEventHandler(aZoomEventHandler);
    70     CGlxZoomPanEventHandler* self = new (ELeave) CGlxZoomPanEventHandler(
       
    71             aZoomEventHandler);
    71     CleanupStack::PushL(self);
    72     CleanupStack::PushL(self);
    72     self->ConstructL();
    73     self->ConstructL();
    73     CleanupStack::Pop(self);
    74     CleanupStack::Pop(self);
    74     return self;
    75     return self;
    75     }
    76     }
    76 
    77 
    77 //----------------------------------------------------------------------------------
    78 //----------------------------------------------------------------------------------
    78 // CGlxZoomPanEventHandler constructor
    79 // CGlxZoomPanEventHandler constructor
    79 //----------------------------------------------------------------------------------
    80 //----------------------------------------------------------------------------------
    80 //
    81 //
    81 CGlxZoomPanEventHandler::CGlxZoomPanEventHandler(MGlxZoomEventHandlers& aZoomEventHandler):
    82 CGlxZoomPanEventHandler::CGlxZoomPanEventHandler(
    82         iZoomEventHandler(aZoomEventHandler)
    83         MGlxZoomEventHandlers& aZoomEventHandler) :
       
    84     iZoomEventHandler(aZoomEventHandler), iPrevPinchFactor(
       
    85             KGlxNeutralZoomFactor)
    83     {
    86     {
    84     TRACER("CGlxZoomPanEventHandler::CGlxZoomPanEventHandler()");
    87     TRACER("CGlxZoomPanEventHandler::CGlxZoomPanEventHandler()");
    85     // No Implementation
    88     // No Implementation
    86     }
    89     }
    87 
    90 
   108         {
   111         {
   109         CancelAnimationTimer();
   112         CancelAnimationTimer();
   110         delete iZoomAnimationTimer;
   113         delete iZoomAnimationTimer;
   111         iZoomAnimationTimer = NULL;
   114         iZoomAnimationTimer = NULL;
   112         }
   115         }
   113    
       
   114     }
   116     }
   115 
   117 
   116 //----------------------------------------------------------------------------------
   118 //----------------------------------------------------------------------------------
   117 // CGlxZoomPanEventHandler Constructl
   119 // CGlxZoomPanEventHandler Constructl
   118 //----------------------------------------------------------------------------------
   120 //----------------------------------------------------------------------------------
   137 //----------------------------------------------------------------------------------
   139 //----------------------------------------------------------------------------------
   138 // CGlxZoomPanEventHandler SetupAnimatedZoom
   140 // CGlxZoomPanEventHandler SetupAnimatedZoom
   139 //----------------------------------------------------------------------------------
   141 //----------------------------------------------------------------------------------
   140 //
   142 //
   141 // Todo: Combine logics of setting up animated zoom and pan.
   143 // Todo: Combine logics of setting up animated zoom and pan.
   142 void CGlxZoomPanEventHandler::SetupAnimatedZoom(TZoomMode aZoomMode, TPoint* /*aZoomFocus*/)
   144 void CGlxZoomPanEventHandler::SetupAnimatedZoom(TZoomMode aZoomMode, 
       
   145         TPoint* /*aZoomFocus*/)
   143     {
   146     {
   144     TRACER("CGlxZoomPanEventHandler::SetupAnimatedZoom");
   147     TRACER("CGlxZoomPanEventHandler::SetupAnimatedZoom");
   145     
   148 
   146     iTargetAnimatedZoomRatio = (iMaxZoomRatio + iMinZoomRatio)/2 ;
   149     iTargetAnimatedZoomRatio = (iMaxZoomRatio + iMinZoomRatio) / 2;
   147     
   150 
   148     CancelAnimationTimer();
   151     CancelAnimationTimer();
   149     CancelUITimer();
   152     CancelUITimer();
   150     
   153 
   151     //ToDo: Verify this with images slightly smaller or slightly larger than fullscreen size. 
   154     //ToDo: Verify this with images slightly smaller or slightly larger than fullscreen size. 
   152     if (EZoomIn == aZoomMode)
   155     if (EZoomIn == aZoomMode)
   153         {
   156         {
   154         // the '1+' is to take care of the situation when there the rest of the equation returns something betn 0 and 1
   157         // the '1+' is to take care of the situation when there the rest of the equation returns something betn 0 and 1
   155         iZoomPerInterval = 1 + (iTargetAnimatedZoomRatio - iZoomRatio)/KGlxAnimeFrameCount ; 
   158         iZoomPerInterval = 1 + (iTargetAnimatedZoomRatio - iZoomRatio)
       
   159                 / KGlxAnimeFrameCount;
   156         }
   160         }
   157     else
   161     else
   158         {
   162         {
   159         iZoomPerInterval = 1 + (iZoomRatio - iMinZoomRatio)/KGlxAnimeFrameCount;
   163         iZoomPerInterval = 1 + (iZoomRatio - iMinZoomRatio)
   160         }
   164                 / KGlxAnimeFrameCount;
   161     
   165         }
   162     
   166 
   163     if (1 < iZoomPerInterval)
   167     if (1 < iZoomPerInterval)
   164         {
   168         {
   165         iIsZoomingInAnimatedState = ETrue;
   169         iIsZoomingInAnimatedState = ETrue;
   166         
   170 
   167         switch(aZoomMode)
   171         switch (aZoomMode)
   168             {
   172             {
   169             case EZoomIn:
   173             case EZoomIn:
   170                 iAnimatedZoomMode = EAnimationModeZoomIn;
   174                 iAnimatedZoomMode = EAnimationModeZoomIn;
   171                 break;
   175                 break;
   172             case EZoomOut:
   176             case EZoomOut:
   173                 iAnimatedZoomMode = EAnimationModeZoomOut;
   177                 iAnimatedZoomMode = EAnimationModeZoomOut;
   174                 break;
   178                 break;
   175             }
   179             }
   176 
   180 
   177         iZoomAnimationTimer->Start( 0,  
   181         iZoomAnimationTimer->Start(0, KGlxAnimeFrameInmS, TCallBack(
   178                 KGlxAnimeFrameInmS, 
   182                 ActivationIntervalElapsed, (TAny*) this));
   179                 TCallBack( ActivationIntervalElapsed,(TAny*)this) );
       
   180         }
   183         }
   181     else
   184     else
   182         // Cant zoom in/out at less than 1 percent. so directly jump to the target zoom ratio.
   185     // Cant zoom in/out at less than 1 percent. so directly jump to the target zoom ratio.
   183         // This happens in cases where there is not much difference between the source and target zoom levels
   186     // This happens in cases where there is not much difference between the source and target zoom levels
   184         {
   187         {
   185         TInt targetZoomRatio = 0;  
   188         TInt targetZoomRatio = 0;
   186         if (EZoomIn == aZoomMode)
   189         if (EZoomIn == aZoomMode)
   187             {
   190             {
   188             targetZoomRatio = iTargetAnimatedZoomRatio ;
   191             targetZoomRatio = iTargetAnimatedZoomRatio;
   189             }
   192             }
   190         else
   193         else
   191             {
   194             {
   192             targetZoomRatio = iMinZoomRatio ;
   195             targetZoomRatio = iMinZoomRatio;
   193             }
   196             }
   194         Zoom(targetZoomRatio, 0) ;
   197         Zoom(targetZoomRatio, 0);
   195         }
   198         }
   196     }
   199     }
   197 
   200 
   198 //----------------------------------------------------------------------------------
   201 //----------------------------------------------------------------------------------
   199 // CGlxZoomPanEventHandler ActivationIntervalElapsed
   202 // CGlxZoomPanEventHandler ActivationIntervalElapsed
   229         }
   232         }
   230             
   233             
   231     Zoom(targetZoomLevel, 0, EZoomIn, &iZoomFocus );
   234     Zoom(targetZoomLevel, 0, EZoomIn, &iZoomFocus );
   232 
   235 
   233     // The boundary conditions. 
   236     // The boundary conditions. 
   234     if ( (( targetZoomLevel >= iTargetAnimatedZoomRatio ) && (EAnimationModeZoomIn == iAnimatedZoomMode ) ) 
   237     if (((targetZoomLevel >= iTargetAnimatedZoomRatio)
   235             || ((targetZoomLevel <= iMinZoomRatio) && (EAnimationModeZoomOut == iAnimatedZoomMode)))
   238             && (EAnimationModeZoomIn == iAnimatedZoomMode))
       
   239             || ((targetZoomLevel <= iMinZoomRatio) && (EAnimationModeZoomOut
       
   240                     == iAnimatedZoomMode)))
   236         {
   241         {
   237         iIsZoomingInAnimatedState = EFalse;
   242         iIsZoomingInAnimatedState = EFalse;
   238         CancelAnimationTimer();
   243         CancelAnimationTimer();
   239         TSize screensize = iMathsEngine.ScreenSize();
   244         TSize screensize = iMathsEngine.ScreenSize();
   240         iZoomFocus = TPoint(screensize.iWidth>>1,screensize.iHeight>>1) ;
   245         iZoomFocus = TPoint(screensize.iWidth>>1,screensize.iHeight>>1) ;
   336 // HandlekeyEvents:This function handles the key Events.
   341 // HandlekeyEvents:This function handles the key Events.
   337 // -----------------------------------------------------------------------------
   342 // -----------------------------------------------------------------------------
   338 //
   343 //
   339 TBool CGlxZoomPanEventHandler::HandlekeyEvents(const TAlfEvent &aEvent)
   344 TBool CGlxZoomPanEventHandler::HandlekeyEvents(const TAlfEvent &aEvent)
   340     {
   345     {
   341     TRACER("CGlxZoomControl::HandlekeyEvents()");
   346     TRACER("CGlxZoomPanEventHandler::HandlekeyEvents()");
   342     GLX_LOG_INFO1("CGlxZoomPanEventHandler::HandlekeyEvents. Scancode = %d   ", aEvent.KeyEvent().iScanCode);
   347     GLX_LOG_INFO1("CGlxZoomPanEventHandler::HandlekeyEvents.Scancode = %d", 
       
   348             aEvent.KeyEvent().iScanCode);
   343 
   349 
   344     TBool consumed = EFalse;
   350     TBool consumed = EFalse;
   345     
   351     
   346     if (!iIsZoomingInAnimatedState)
   352     if (!iIsZoomingInAnimatedState)
   347         {
   353         {
   408 
   414 
   409 // -----------------------------------------------------------------------------
   415 // -----------------------------------------------------------------------------
   410 // HandleZoomKey:Zooms the image on zoom stripe action.
   416 // HandleZoomKey:Zooms the image on zoom stripe action.
   411 // -----------------------------------------------------------------------------
   417 // -----------------------------------------------------------------------------
   412 //
   418 //
   413 void CGlxZoomPanEventHandler::HandleZoomKey(TZoomMode aZoomMode ,
   419 void CGlxZoomPanEventHandler::HandleZoomKey(TZoomMode aZoomMode,
   414         TEventCode aEventCode)
   420         TEventCode aEventCode)
   415     {
   421     {
   416     TRACER("CGlxZoomControl::HandleZoomKey ");
   422     TRACER("CGlxZoomPanEventHandler::HandleZoomKey ");
   417     if ( iZoomActivated )
   423     if ( iZoomActivated )
   418         {
   424         {
   419         switch(aEventCode)
   425         switch(aEventCode)
   420             {
   426             {
   421             case EEventKey :
   427             case EEventKey :
   429             default :
   435             default :
   430             break ;
   436             break ;
   431             }
   437             }
   432         }
   438         }
   433     }
   439     }
   434 
       
   435 
   440 
   436 // -----------------------------------------------------------------------------
   441 // -----------------------------------------------------------------------------
   437 // SetupPanOperation: start the pan operation for Key based pan. 
   442 // SetupPanOperation: start the pan operation for Key based pan. 
   438 // -----------------------------------------------------------------------------
   443 // -----------------------------------------------------------------------------
   439 //
   444 //
   575 
   580 
   576 // -----------------------------------------------------------------------------
   581 // -----------------------------------------------------------------------------
   577 // HandleDragEvent
   582 // HandleDragEvent
   578 // -----------------------------------------------------------------------------
   583 // -----------------------------------------------------------------------------
   579 //
   584 //
   580 void CGlxZoomPanEventHandler::HandleDragEvent(const GestureHelper::MGestureEvent& aEvent )
   585 void CGlxZoomPanEventHandler::HandleDragEvent(
   581     {
   586         const GestureHelper::MGestureEvent& aEvent)
   582     TRACER("CGlxZoomControl::HandleDragEvent (GestureHelper::MGestureEvent&)");
   587     {
   583     
   588     TRACER("CGlxZoomPanEventHandler::HandleDragEvent(GestureHelper::MGestureEvent&)");
   584 
   589     
   585     // Ignore events when we are animating in Zoom
   590     // Ignore events when we are animating in Zoom
   586     if (iIsZoomingInAnimatedState)
   591     if (iIsZoomingInAnimatedState)
   587         {
   592         {
   588         return;
   593         return;
   589         }
   594         }
   596     if (startPos != iPreviousDragStartPosition)
   601     if (startPos != iPreviousDragStartPosition)
   597         {
   602         {
   598         iPreviousPointerPosition = startPos;
   603         iPreviousPointerPosition = startPos;
   599         }
   604         }
   600     
   605     
   601     TPoint offset((iPreviousPointerPosition.iX - currPos.iX) , (iPreviousPointerPosition.iY - currPos.iY));
   606     TPoint offset((iPreviousPointerPosition.iX - currPos.iX),
       
   607             (iPreviousPointerPosition.iY - currPos.iY));
   602     
   608     
   603     HideScreenFurniture();
   609     HideScreenFurniture();
   604 
   610 
   605     TPoint topLeftCorner(0,0);    
   611     TPoint topLeftCorner(0,0);    
   606     iMathsEngine.Pan(offset, topLeftCorner, EGlxPanIncrementUniform);
   612     iMathsEngine.Pan(offset, topLeftCorner, EGlxPanIncrementUniform);
   607     
   613     
   608 
   614     iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner,
   609     iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimeDrag);
   615             KGlxAnimationTimeDrag);
   610     
   616     
   611     iPreviousPointerPosition = currPos ;
   617     iPreviousPointerPosition = currPos ;
   612     iPreviousDragStartPosition = startPos;
   618     iPreviousDragStartPosition = startPos;
   613     }
   619     }
   614 
   620 
   615 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   616 // HandleGestureReleased
   622 // HandleGestureReleased
   617 // -----------------------------------------------------------------------------
   623 // -----------------------------------------------------------------------------
   618 //
   624 //
   619 void CGlxZoomPanEventHandler::HandleGestureReleased(const GestureHelper::MGestureEvent& /*aEvent*/ )
   625 void CGlxZoomPanEventHandler::HandleGestureReleased(
       
   626         const GestureHelper::MGestureEvent& /*aEvent*/)
   620     {
   627     {
   621     TRACER("CGlxZoomPanEventHandler::HandleGestureReleasedEvent(const GestureHelper::MGestureEvent& )");
   628     TRACER("CGlxZoomPanEventHandler::HandleGestureReleasedEvent(const GestureHelper::MGestureEvent& )");
   622     
   629     
   623     if ( /*(EGestureUnknown  == iPreviousGestureCode)
   630     if ( (EGestureSwipeLeft  == iPreviousGestureCode)
   624           ||*/(EGestureSwipeLeft  == iPreviousGestureCode)
       
   625           ||(EGestureSwipeRight == iPreviousGestureCode)
   631           ||(EGestureSwipeRight == iPreviousGestureCode)
   626           ||(EGestureSwipeUp    == iPreviousGestureCode)
   632           ||(EGestureSwipeUp    == iPreviousGestureCode)
   627           ||(EGestureSwipeDown  == iPreviousGestureCode))
   633           ||(EGestureSwipeDown  == iPreviousGestureCode))
   628         {
   634         {
   629         SetupAnimatedPan();
   635         SetupAnimatedPan();
   665         {
   671         {
   666         CancelAnimationTimer();
   672         CancelAnimationTimer();
   667         }
   673         }
   668     else
   674     else
   669         {
   675         {
   670         TPoint topLeftCorner(0,0);    
   676         TPoint topLeftCorner(0, 0);
   671         TBool thresholdReached = EFalse; 
   677         TBool thresholdReached = EFalse;
   672         iMathsEngine.Pan(inertiaOffset, topLeftCorner, EGlxPanIncrementInertic, &thresholdReached);
   678         iMathsEngine.Pan(inertiaOffset, topLeftCorner,
   673         
   679                 EGlxPanIncrementInertic, &thresholdReached);
   674         iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimeDrag);
   680 
   675         
   681         iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner,
       
   682                 KGlxAnimationTimeDrag);
       
   683 
   676         // we dont want to continue animated PAN if we have reached one end of the image.
   684         // we dont want to continue animated PAN if we have reached one end of the image.
   677         if (thresholdReached)
   685         if (thresholdReached)
   678             {
   686             {
   679             CancelAnimationTimer();
   687             CancelAnimationTimer();
   680             }
   688             }
   690 
   698 
   691 // -----------------------------------------------------------------------------
   699 // -----------------------------------------------------------------------------
   692 // HandlePinchEvent
   700 // HandlePinchEvent
   693 // -----------------------------------------------------------------------------
   701 // -----------------------------------------------------------------------------
   694 //
   702 //
   695 void CGlxZoomPanEventHandler::HandlePinchEventL(const GestureHelper::MGestureEvent& aEvent )
   703 void CGlxZoomPanEventHandler::HandlePinchEventL(
   696     {
   704         const GestureHelper::MGestureEvent& aEvent)
   697     TRACER("CGlxZoomControl::HandlePinchEvent(GestureHelper::MGestureEvent&)");
   705     {
       
   706     TRACER("CGlxZoomPanEventHandler::HandlePinchEvent(GestureHelper::MGestureEvent&)");
   698 
   707 
   699     // Ignore events when we are animating in Zoom
   708     // Ignore events when we are animating in Zoom
   700     if (iIsZoomingInAnimatedState)
   709     if (iIsZoomingInAnimatedState)
   701         {
   710         {
   702         return;
   711         return;
   703         }
   712         }
   704     
   713     
   705     TPoint pinchFocus       = aEvent.PinchCentrePoint();
   714     TPoint pinchFocus       = aEvent.PinchCentrePoint();
   706     TInt pinchPercentage    = aEvent.PinchPercent();  // Wrong convention in variable nomenclature but better than ratioInPercentOfChangeInPinchDistance which is incidentally correct 
   715    // Wrong convention in variable nomenclature but better than 
   707 
   716    // ratioInPercentOfChangeInPinchDistance which is incidentally correct 
       
   717     TInt pinchPercentage    = aEvent.PinchPercent();  
       
   718 
       
   719 	if (( iPrevPinchFactor >= KGlxNeutralZoomFactor ) && 
       
   720         ( pinchPercentage < KGlxNeutralZoomFactor ))
       
   721         {
       
   722 		iPrevPinchFactor = pinchPercentage ;
       
   723 		//This will result in we ignoring this event
       
   724 		pinchPercentage = KGlxNeutralZoomFactor;
       
   725         }
       
   726 	else
       
   727         {	
       
   728 		iPrevPinchFactor = pinchPercentage ;
       
   729         }
       
   730 	
   708     // pinchPercentage == 100 => No change in finger distance => No Zoom. 
   731     // pinchPercentage == 100 => No change in finger distance => No Zoom. 
   709     // A negative Pinch percentage signifies an error in calculations. So NOT handling these
   732     // A negative Pinch percentage signifies an error in calculations. 
   710     if ( (pinchPercentage != 100)
   733 	// So NOT handling these
       
   734     if ( (pinchPercentage != KGlxNeutralZoomFactor)
   711             && (pinchPercentage > 0) )
   735             && (pinchPercentage > 0) )
   712         {
   736         {
   713         Zoom(0, pinchPercentage, EZoomIn, &pinchFocus);
   737         Zoom(0, pinchPercentage, EZoomIn, &pinchFocus);
   714         }
   738         }
   715     
   739     
   716     HideScreenFurniture();
   740     HideScreenFurniture();
       
   741     GLX_LOG_INFO1("CGlxZoomPanEventHandler::HandlePinchEventL: Percentage [%d]" , pinchPercentage);
   717     }
   742     }
   718 
   743 
   719 // -----------------------------------------------------------------------------
   744 // -----------------------------------------------------------------------------
   720 // HandleDoubleTap
   745 // HandleDoubleTap
   721 // -----------------------------------------------------------------------------
   746 // -----------------------------------------------------------------------------
   722 //
   747 //
   723 void CGlxZoomPanEventHandler::HandleDoubleTap(const GestureHelper::MGestureEvent& /*aEvent*/ )
   748 void CGlxZoomPanEventHandler::HandleDoubleTap(const GestureHelper::MGestureEvent& /*aEvent*/ )
   724     {
   749     {
   725     TRACER("CGlxZoomControl::HandleDoubleTap(GestureHelper::MGestureEvent&)");
   750     TRACER("CGlxZoomPanEventHandler::HandleDoubleTap(GestureHelper::MGestureEvent&)");
   726 
   751 
   727     // Ignore events when we are animating in Zoom
   752     // Ignore events when we are animating in Zoom
   728     if (iIsZoomingInAnimatedState)
   753     if (iIsZoomingInAnimatedState)
   729         {
   754         {
   730         return;
   755         return;
   760 // UiTimeOut: Hides the screen furniture once the Timeout happens
   785 // UiTimeOut: Hides the screen furniture once the Timeout happens
   761 // ---------------------------------------------------------------------------
   786 // ---------------------------------------------------------------------------
   762 //  
   787 //  
   763 TInt CGlxZoomPanEventHandler::UiTimeOut(TAny* aSelf)
   788 TInt CGlxZoomPanEventHandler::UiTimeOut(TAny* aSelf)
   764     {
   789     {
   765     TRACER("CGlxZoomControl::UiTimeOut");
   790     TRACER("CGlxZoomPanEventHandler::UiTimeOut");
   766     if(aSelf)
   791     if(aSelf)
   767         {
   792         {
   768         CGlxZoomPanEventHandler* self = static_cast <CGlxZoomPanEventHandler*> (aSelf);
   793         CGlxZoomPanEventHandler* self = static_cast <CGlxZoomPanEventHandler*> (aSelf);
   769         //retreive the UI state.
   794         //retreive the UI state.
   770         if(EUiOn == self->iZoomUiState)
   795         if(EUiOn == self->iZoomUiState)
   779 // ZoomOutTimerL
   804 // ZoomOutTimerL
   780 // ---------------------------------------------------------------------------
   805 // ---------------------------------------------------------------------------
   781 //  
   806 //  
   782 TInt CGlxZoomPanEventHandler::ZoomOutTimerL(TAny* aSelf)
   807 TInt CGlxZoomPanEventHandler::ZoomOutTimerL(TAny* aSelf)
   783     {
   808     {
   784     TRACER("CGlxZoomControl::ZoomOutTimerL");
   809     TRACER("CGlxZoomPanEventHandler::ZoomOutTimerL");
   785     if(aSelf)
   810     if(aSelf)
   786         {
   811         {
   787         CGlxZoomPanEventHandler* self = static_cast <CGlxZoomPanEventHandler*> (aSelf);
   812         CGlxZoomPanEventHandler* self = static_cast <CGlxZoomPanEventHandler*> (aSelf);
   788         self->CallZoomOutL();
   813         self->CallZoomOutL();
   789         }
   814         }
   822     {
   847     {
   823     TRACER("CGlxZoomPanEventHandler::DoPan ");
   848     TRACER("CGlxZoomPanEventHandler::DoPan ");
   824 
   849 
   825     TBool atPanThreshold = EFalse;
   850     TBool atPanThreshold = EFalse;
   826     TPoint topLeftCorner;
   851     TPoint topLeftCorner;
   827     iMathsEngine.Pan(iPanDirection, topLeftCorner, EGlxPanIncrementExponential,  &atPanThreshold);
   852     iMathsEngine.Pan(iPanDirection, topLeftCorner,
   828     
   853             EGlxPanIncrementExponential, &atPanThreshold);
   829     iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimekeyPan);
   854 
       
   855     iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner,
       
   856             KGlxAnimationTimekeyPan);
   830     
   857     
   831     if ( atPanThreshold )
   858     if ( atPanThreshold )
   832         {
   859         {
   833         CancelZoomPanTimer();
   860         CancelZoomPanTimer();
   834         }
   861         }
  1015 
  1042 
  1016             switch(EventID)
  1043             switch(EventID)
  1017                 {
  1044                 {
  1018                 case ETypePrimaryValueChange:
  1045                 case ETypePrimaryValueChange:
  1019                     {
  1046                     {
  1020                     GLX_LOG_INFO(" CGlxZoomPanEventHandler::HandleEvent: ETypePrimaryValueChange."  );
  1047                     GLX_LOG_INFO("CGlxZoomPanEventHandler::HandleEvent:ETypePrimaryValueChange");
  1021 
  1048 
  1022                     MulSliderPos* dataPtr = (MulSliderPos*)(aEvent.CustomEventData());  
  1049                     MulSliderPos* dataPtr = (MulSliderPos*)(aEvent.CustomEventData());  
  1023                     TInt currentSliderValue = dataPtr->mCurrentValue;
  1050                     TInt currentSliderValue = dataPtr->mCurrentValue;
  1024 
  1051 
  1025                     // Is current value within acceptable range? 
  1052                     // Is current value within acceptable range? 
  1039 
  1066 
  1040                 case ECustomEventIconClick :
  1067                 case ECustomEventIconClick :
  1041                      {
  1068                      {
  1042                      //The Slider is held by user,so cancel the UI Timer
  1069                      //The Slider is held by user,so cancel the UI Timer
  1043                      //When the slider is held ,the screen furniture shouldn't disappear
  1070                      //When the slider is held ,the screen furniture shouldn't disappear
  1044                      GLX_LOG_INFO( " CGlxZoomControl::offerEvent,ECustomEventIconClick");
  1071                      GLX_LOG_INFO("CGlxZoomPanEventHandler::HandleEvent, ECustomEventIconClick");
  1045                      CancelUITimer();    
  1072                      CancelUITimer();    
  1046                      eventHandledState = ETrue;           
  1073                      eventHandledState = ETrue;           
  1047                      }
  1074                      }
  1048                      break;
  1075                      break;
  1049 
  1076 
  1050                 case ECustomEventIconRelease:
  1077                 case ECustomEventIconRelease:
  1051                      {
  1078                      {
  1052                      //The slider is not held, by the user,start the ui timer to hide the screen furniture
  1079                      //The slider is not held, by the user,start the ui timer to hide the screen furniture
  1053                      GLX_LOG_INFO( " CGlxZoomControl::offerEvent,ECustomEventIconRelease");
  1080                      GLX_LOG_INFO( " CGlxZoomPanEventHandler::offerEvent,ECustomEventIconRelease");
  1054                      StartUITimer(KGlxScreenTimeout, KGlxScreenTimeout, TCallBack( UiTimeOut,this ) );
  1081                      StartUITimer(KGlxScreenTimeout, KGlxScreenTimeout,
       
  1082                             TCallBack(UiTimeOut, this));
  1055                      eventHandledState = ETrue;
  1083                      eventHandledState = ETrue;
  1056                      }
  1084                      }
  1057                      break;
  1085                      break;
  1058 
  1086 
  1059                 default:
  1087                 default:
  1110 
  1138 
  1111 // -----------------------------------------------------------------------------
  1139 // -----------------------------------------------------------------------------
  1112 // Zoom
  1140 // Zoom
  1113 // -----------------------------------------------------------------------------
  1141 // -----------------------------------------------------------------------------
  1114 //
  1142 //
  1115 void CGlxZoomPanEventHandler::Zoom(TInt aExpectedZoomLevel, TInt aRelativeZoomFactor, TZoomMode aZoomMode, TPoint* aZoomFocus)
  1143 void CGlxZoomPanEventHandler::Zoom(TInt aExpectedZoomLevel,
  1116     {
  1144         TInt aRelativeZoomFactor, TZoomMode aZoomMode, TPoint* aZoomFocus)
  1117     TRACER("CGlxZoomPanEventHandler::ZoomL( )");
  1145     {
       
  1146     TRACER("CGlxZoomPanEventHandler::Zoom()");
  1118     
  1147     
  1119     TPoint          viewPortTopLeft(0,0);
  1148     TPoint          viewPortTopLeft(0,0);
  1120     TSize           viewPortDimension(0,0);
  1149     TSize           viewPortDimension(0,0);
  1121     TBool           atZoomThreshold = EFalse;
  1150     TBool           atZoomThreshold = EFalse;
  1122     
  1151