uifw/EikStd/dlgsrc/aknformphysics.cpp
branchRCL_3
changeset 50 a1caeb42b3a3
parent 4 8ca85d2f0db7
child 55 aecbbf00d063
equal deleted inserted replaced
38:c52421ed5f07 50:a1caeb42b3a3
   113 //
   113 //
   114 TBool CAknFormPhysics::StartFlick( const TPoint& aLength, 
   114 TBool CAknFormPhysics::StartFlick( const TPoint& aLength, 
   115                                    const TTime& aStartTime )
   115                                    const TTime& aStartTime )
   116     {
   116     {
   117     _AKNTRACE_FUNC_ENTER;
   117     _AKNTRACE_FUNC_ENTER;
   118     if (  PhysicsAllowed() )
   118     TPoint drag( aLength );
       
   119 
       
   120     if ( iPhysics->StartPhysics( drag, aStartTime ) )
   119         {
   121         {
   120         TPoint drag( aLength );
   122         return ETrue;
   121         if ( iPhysics->StartPhysics( drag, aStartTime ) )
       
   122             {
       
   123             // reset benchmark variables
       
   124             iStartTime.HomeTime();
       
   125             iFrameCount = 0;
       
   126             return ETrue;
       
   127             }
       
   128         }
   123         }
   129 
   124 
   130     PhysicEmulationEnded();
   125     PhysicEmulationEnded();
   131     _AKNTRACE_FUNC_EXIT;
   126     _AKNTRACE_FUNC_EXIT;
   132     return EFalse;
   127     return EFalse;
   168 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
   169 //
   164 //
   170 void CAknFormPhysics::SetPanningPosition( const TPoint& aDelta )
   165 void CAknFormPhysics::SetPanningPosition( const TPoint& aDelta )
   171     {
   166     {
   172     _AKNTRACE_FUNC_ENTER;
   167     _AKNTRACE_FUNC_ENTER;
   173     if (  PhysicsAllowed() && iPhysics )
   168     if ( iPhysics )
   174         {
   169         {
   175         iPhysics->RegisterPanningPosition( aDelta );
   170         iPhysics->RegisterPanningPosition( aDelta );
   176         }
   171         }
   177     _AKNTRACE_FUNC_EXIT;
   172     _AKNTRACE_FUNC_EXIT;
   178     }
   173     }
   187                                            TUint /*aFlags*/ )
   182                                            TUint /*aFlags*/ )
   188     {
   183     {
   189     _AKNTRACE_FUNC_ENTER;
   184     _AKNTRACE_FUNC_ENTER;
   190     _AKNTRACE( "The Position of aNewPosition are: ( %d, %d ) ", 
   185     _AKNTRACE( "The Position of aNewPosition are: ( %d, %d ) ", 
   191     		aNewPosition.iX, aNewPosition.iY );
   186     		aNewPosition.iX, aNewPosition.iY );
   192     if ( !PhysicsAllowed() )
   187 
   193         {
       
   194         return;
       
   195         }
       
   196     TInt fps = 0;
       
   197     iViewCenter = aNewPosition;
   188     iViewCenter = aNewPosition;
   198 
   189     iParent.ScrollCacheByPixels( iViewCenter.iY, aDrawNow );
   199     // benchmark / debug part
       
   200     if ( iFrameCount != -1 )
       
   201         {
       
   202         ++iFrameCount;
       
   203         TTime now;
       
   204         now.HomeTime();
       
   205         
       
   206         TInt64 duration = now.MicroSecondsFrom( iStartTime ).Int64();
       
   207         
       
   208         if ( duration > 0 )
       
   209             {
       
   210             fps = iFrameCount * 1000000 / duration;
       
   211             }
       
   212         }
       
   213 
       
   214     TBuf<128> msg;
       
   215     msg.Format( _L( "%dfps" ), fps );
       
   216 
       
   217     iParent.ScrollCacheByPixels( iViewCenter.iY, msg, aDrawNow );
       
   218     _AKNTRACE_FUNC_EXIT;
   190     _AKNTRACE_FUNC_EXIT;
   219     }
   191     }
   220 
   192 
   221 
   193 
   222 // ---------------------------------------------------------------------------
   194 // ---------------------------------------------------------------------------
   225 //
   197 //
   226 void CAknFormPhysics::PhysicEmulationEnded()
   198 void CAknFormPhysics::PhysicEmulationEnded()
   227     {
   199     {
   228     _AKNTRACE_FUNC_ENTER;
   200     _AKNTRACE_FUNC_ENTER;
   229     iParent.Synchronize();
   201     iParent.Synchronize();
   230     iFrameCount = -1;
       
   231     _AKNTRACE_FUNC_EXIT;
   202     _AKNTRACE_FUNC_EXIT;
   232     }
   203     }
   233 
   204 
   234 
   205 
   235 // ---------------------------------------------------------------------------
   206 // ---------------------------------------------------------------------------
   298 //
   269 //
   299 TPoint CAknFormPhysics::ViewCenter() const
   270 TPoint CAknFormPhysics::ViewCenter() const
   300     {
   271     {
   301     return iViewCenter;
   272     return iViewCenter;
   302     }
   273     }
   303 
   274 	
   304 
       
   305 // ---------------------------------------------------------------------------
       
   306 // CAknFormPhysics::PhysicsAllowed
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 TBool CAknFormPhysics::PhysicsAllowed() const
       
   310     {
       
   311     return ETrue;
       
   312     }