uifw/EikStd/dlgsrc/aknformphysics.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 50 a1caeb42b3a3
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    21 #include "aknformphysics.h"
    21 #include "aknformphysics.h"
    22 #include <aknphysics.h>
    22 #include <aknphysics.h>
    23 #include <coecntrl.h>
    23 #include <coecntrl.h>
    24 #include <coemain.h>
    24 #include <coemain.h>
    25 #include <eikdpage.h>
    25 #include <eikdpage.h>
    26 
    26 #include "akntrace.h"
    27 
    27 
    28 // ======== MEMBER FUNCTIONS ========
    28 // ======== MEMBER FUNCTIONS ========
    29 
    29 
    30 // ---------------------------------------------------------------------------
    30 // ---------------------------------------------------------------------------
    31 // CAknFormPhysics::CAknFormPhysics
    31 // CAknFormPhysics::CAknFormPhysics
    53 // ---------------------------------------------------------------------------
    53 // ---------------------------------------------------------------------------
    54 //
    54 //
    55 CAknFormPhysics* CAknFormPhysics::NewL( CEikDialogPage& aParent, 
    55 CAknFormPhysics* CAknFormPhysics::NewL( CEikDialogPage& aParent, 
    56     CAknRecordingGc& aRecordingGc )
    56     CAknRecordingGc& aRecordingGc )
    57     {
    57     {
       
    58     _AKNTRACE_FUNC_ENTER;
    58     CAknFormPhysics* self = new ( ELeave ) CAknFormPhysics( aParent, 
    59     CAknFormPhysics* self = new ( ELeave ) CAknFormPhysics( aParent, 
    59         aRecordingGc );
    60         aRecordingGc );
    60     CleanupStack::PushL( self );
    61     CleanupStack::PushL( self );
    61     self->ConstructL();
    62     self->ConstructL();
    62     CleanupStack::Pop( self );
    63     CleanupStack::Pop( self );
       
    64     _AKNTRACE_FUNC_EXIT;    
    63     return self;
    65     return self;
    64     }
    66     }
    65 
    67 
    66 
    68 
    67 // ---------------------------------------------------------------------------
    69 // ---------------------------------------------------------------------------
    68 // CAknFormPhysics::~CAknFormPhysics
    70 // CAknFormPhysics::~CAknFormPhysics
    69 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
    70 //
    72 //
    71 CAknFormPhysics::~CAknFormPhysics()
    73 CAknFormPhysics::~CAknFormPhysics()
    72     {
    74     {
       
    75     _AKNTRACE_FUNC_ENTER;
    73     delete iPhysics;
    76     delete iPhysics;
       
    77     _AKNTRACE_FUNC_EXIT;
    74     }
    78     }
    75 
    79 
    76 
    80 
    77 // ---------------------------------------------------------------------------
    81 // ---------------------------------------------------------------------------
    78 // CAknFormPhysics::InitPhysicsL
    82 // CAknFormPhysics::InitPhysicsL
    79 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    80 //
    84 //
    81 void CAknFormPhysics::InitPhysicsL( const TSize& aWorldSize, 
    85 void CAknFormPhysics::InitPhysicsL( const TSize& aWorldSize, 
    82     const TSize& aViewSize, const TPoint& aViewCenter )
    86     const TSize& aViewSize, const TPoint& aViewCenter )
    83     {
    87     {
       
    88     _AKNTRACE_FUNC_ENTER;
    84     iPhysics->InitPhysicsL( aWorldSize, aViewSize, EFalse );
    89     iPhysics->InitPhysicsL( aWorldSize, aViewSize, EFalse );
    85     iViewCenter = aViewCenter;
    90     iViewCenter = aViewCenter;
    86     iWorldSize = aWorldSize;
    91     iWorldSize = aWorldSize;
    87     iViewSize = aViewSize;
    92     iViewSize = aViewSize;
       
    93     _AKNTRACE_FUNC_EXIT;
    88     }
    94     }
    89 
    95 
    90 
    96 
    91 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
    92 // CAknFormPhysics::Stop
    98 // CAknFormPhysics::Stop
    93 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
    94 //
   100 //
    95 void CAknFormPhysics::Stop()
   101 void CAknFormPhysics::Stop()
    96     {
   102     {
       
   103     _AKNTRACE_FUNC_ENTER;
    97     iPhysics->StopPhysics();
   104     iPhysics->StopPhysics();
    98     iPhysics->ResetFriction();
   105     iPhysics->ResetFriction();
       
   106     _AKNTRACE_FUNC_EXIT;
    99     }
   107     }
   100     
   108     
   101 
   109 
   102 // ---------------------------------------------------------------------------
   110 // ---------------------------------------------------------------------------
   103 // CAknFormPhysics::StartFlick
   111 // CAknFormPhysics::StartFlick
   104 // ---------------------------------------------------------------------------
   112 // ---------------------------------------------------------------------------
   105 //
   113 //
   106 TBool CAknFormPhysics::StartFlick( const TPoint& aLength, 
   114 TBool CAknFormPhysics::StartFlick( const TPoint& aLength, 
   107                                    const TTime& aStartTime )
   115                                    const TTime& aStartTime )
   108     {
   116     {
       
   117     _AKNTRACE_FUNC_ENTER;
   109     if (  PhysicsAllowed() )
   118     if (  PhysicsAllowed() )
   110         {
   119         {
   111         TPoint drag( aLength );
   120         TPoint drag( aLength );
   112         if ( iPhysics->StartPhysics( drag, aStartTime ) )
   121         if ( iPhysics->StartPhysics( drag, aStartTime ) )
   113             {
   122             {
   117             return ETrue;
   126             return ETrue;
   118             }
   127             }
   119         }
   128         }
   120 
   129 
   121     PhysicEmulationEnded();
   130     PhysicEmulationEnded();
       
   131     _AKNTRACE_FUNC_EXIT;
   122     return EFalse;
   132     return EFalse;
   123     }
   133     }
   124 
   134 
   125 
   135 
   126 // ---------------------------------------------------------------------------
   136 // ---------------------------------------------------------------------------
   157 // CAknFormPhysics::SetPanningPosition
   167 // CAknFormPhysics::SetPanningPosition
   158 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   159 //
   169 //
   160 void CAknFormPhysics::SetPanningPosition( const TPoint& aDelta )
   170 void CAknFormPhysics::SetPanningPosition( const TPoint& aDelta )
   161     {
   171     {
       
   172     _AKNTRACE_FUNC_ENTER;
   162     if (  PhysicsAllowed() && iPhysics )
   173     if (  PhysicsAllowed() && iPhysics )
   163         {
   174         {
   164         iPhysics->RegisterPanningPosition( aDelta );
   175         iPhysics->RegisterPanningPosition( aDelta );
   165         }
   176         }
       
   177     _AKNTRACE_FUNC_EXIT;
   166     }
   178     }
   167 
   179 
   168 
   180 
   169 // ---------------------------------------------------------------------------
   181 // ---------------------------------------------------------------------------
   170 // CAknFormPhysics::ViewPositionChanged
   182 // CAknFormPhysics::ViewPositionChanged
   172 //
   184 //
   173 void CAknFormPhysics::ViewPositionChanged( const TPoint& aNewPosition,
   185 void CAknFormPhysics::ViewPositionChanged( const TPoint& aNewPosition,
   174                                            TBool aDrawNow,
   186                                            TBool aDrawNow,
   175                                            TUint /*aFlags*/ )
   187                                            TUint /*aFlags*/ )
   176     {
   188     {
       
   189     _AKNTRACE_FUNC_ENTER;
       
   190     _AKNTRACE( "The Position of aNewPosition are: ( %d, %d ) ", 
       
   191     		aNewPosition.iX, aNewPosition.iY );
   177     if ( !PhysicsAllowed() )
   192     if ( !PhysicsAllowed() )
   178         {
   193         {
   179         return;
   194         return;
   180         }
   195         }
   181     TInt fps = 0;
   196     TInt fps = 0;
   198 
   213 
   199     TBuf<128> msg;
   214     TBuf<128> msg;
   200     msg.Format( _L( "%dfps" ), fps );
   215     msg.Format( _L( "%dfps" ), fps );
   201 
   216 
   202     iParent.ScrollCacheByPixels( iViewCenter.iY, msg, aDrawNow );
   217     iParent.ScrollCacheByPixels( iViewCenter.iY, msg, aDrawNow );
       
   218     _AKNTRACE_FUNC_EXIT;
   203     }
   219     }
   204 
   220 
   205 
   221 
   206 // ---------------------------------------------------------------------------
   222 // ---------------------------------------------------------------------------
   207 // CAknFormPhysics::PhysicEmulationEnded
   223 // CAknFormPhysics::PhysicEmulationEnded
   208 // ---------------------------------------------------------------------------
   224 // ---------------------------------------------------------------------------
   209 //
   225 //
   210 void CAknFormPhysics::PhysicEmulationEnded()
   226 void CAknFormPhysics::PhysicEmulationEnded()
   211     {
   227     {
       
   228     _AKNTRACE_FUNC_ENTER;
   212     iParent.Synchronize();
   229     iParent.Synchronize();
   213     iFrameCount = -1;
   230     iFrameCount = -1;
       
   231     _AKNTRACE_FUNC_EXIT;
   214     }
   232     }
   215 
   233 
   216 
   234 
   217 // ---------------------------------------------------------------------------
   235 // ---------------------------------------------------------------------------
   218 // CAknFormPhysics::ViewPosition
   236 // CAknFormPhysics::ViewPosition