tsrc/consoleplayer/player/src/playerwindow.cpp
changeset 33 e1b6d78dfe6a
equal deleted inserted replaced
29:b818131c88a3 33:e1b6d78dfe6a
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  * The source of the common Player Window functionality.
       
    16  * 
       
    17  */
       
    18 
       
    19 #include "playerwindow.h"
       
    20 #include "consoleplayer.h"
       
    21 
       
    22 const TInt  KDefaultScalePercentagesIndex = 5;
       
    23 const TInt  KScalePercentagesCount = 10;
       
    24 const TReal KScalePercentages[] = {10.0, 25.0, 50.0, 75.0, 100.0, 125.0, 150.0, 175.0, 200.0, 250.0};
       
    25 
       
    26 // this constant must be consistent with the Rectangle function
       
    27 const TInt KRectangleModeCount = 5;
       
    28 
       
    29 const TInt KMoveWindowDelta = 8;
       
    30 
       
    31 
       
    32 CPlayerWindow::CPlayerWindow( RFs& aFs, RWsSession& aWs, CWsScreenDevice& aScreenDevice, bool aSuppressGraphicsContext ) :
       
    33     iFs( aFs ),
       
    34     iWs( aWs ),
       
    35     iScreenDevice( aScreenDevice ),
       
    36     iWindow( aWs ),
       
    37 	iSuppressGraphicsContext( aSuppressGraphicsContext ),
       
    38     iCurrentVelocity( 100 ),
       
    39     iWidthScaleIndex( KDefaultScalePercentagesIndex ),
       
    40     iHeightScaleIndex( KDefaultScalePercentagesIndex )
       
    41     {    
       
    42     }
       
    43 
       
    44 void CPlayerWindow::BaseConstructL( const RWindowTreeNode &aParentWindow, TPoint aTopLeft, TSize aSize, bool aTransparent, TRgb aBackgroundColor )
       
    45     {
       
    46     // A graphics context should not be used with performance mode.
       
    47     if( !iSuppressGraphicsContext )
       
    48     {
       
    49         User::LeaveIfError( iScreenDevice.CreateContext(iGc) );
       
    50     }
       
    51     
       
    52     User::LeaveIfError( iWindow.Construct( aParentWindow, KNullWsHandle ) );
       
    53 
       
    54     iWindowTopLeft = aTopLeft;
       
    55     iDefaultWindowSize = aSize;
       
    56     iWindowSize = aSize;
       
    57     iWindowSizeDivisor = 1;
       
    58     
       
    59     iWindow.SetExtent( aTopLeft, aSize );
       
    60     if( aTransparent )
       
    61         {
       
    62         iWindow.SetTransparencyAlphaChannel();
       
    63         }
       
    64     else
       
    65         {
       
    66         iWindow.SetNonTransparent();    
       
    67         }
       
    68     iWindow.SetBackgroundColor(aBackgroundColor); 
       
    69     iWindow.SetVisible(false);
       
    70     iWindow.Activate();
       
    71     
       
    72     // enable drag events
       
    73     iWindow.PointerFilter(EPointerFilterDrag, 0);
       
    74     }
       
    75 
       
    76 CPlayerWindow::~CPlayerWindow()
       
    77     {
       
    78     delete iGc;
       
    79     iFile.Close();
       
    80     }
       
    81 
       
    82 void CPlayerWindow::StartWithFilenameL( const TDesC& aFullFilename,
       
    83                                         TAutoscaleMode aDefaultAutoscale,
       
    84                                         MPlayerWindowObserver* aObserver )
       
    85     {
       
    86     iFullFilename.Copy( aFullFilename );
       
    87     iObserver = aObserver;        
       
    88 
       
    89     SetDefaultAutoscaleMode( aDefaultAutoscale );
       
    90     
       
    91     User::LeaveIfError( iFile.Open( iFs, iFullFilename, EFileShareReadersOnly | EFileStream | EFileRead ) );
       
    92 
       
    93     iFile.Name( iFilename );
       
    94     
       
    95     PreparePlayerWithFile( iFile );
       
    96     
       
    97     // Now wait for subclass to call PrepareComplete.        
       
    98     }
       
    99 
       
   100 void CPlayerWindow::StartWithUrlL( const TDesC& aUrl,
       
   101                                    TAutoscaleMode aDefaultAutoscale,
       
   102                                    MPlayerWindowObserver* aObserver )
       
   103     {
       
   104     iUrl.Copy( aUrl );
       
   105     iObserver = aObserver;        
       
   106 
       
   107     SetDefaultAutoscaleMode( aDefaultAutoscale );
       
   108     
       
   109     PreparePlayerWithUrl( aUrl );
       
   110     
       
   111     // Now wait for subclass to call PrepareComplete.        
       
   112     }
       
   113 
       
   114 RWindow& CPlayerWindow::Window()
       
   115     {
       
   116     return iWindow;
       
   117     }
       
   118 
       
   119 const TDesC& CPlayerWindow::FullFilename()
       
   120     {
       
   121     return iFullFilename;
       
   122     }
       
   123 
       
   124 const TDesC& CPlayerWindow::Filename()
       
   125     {
       
   126     return iFilename;
       
   127     }
       
   128 
       
   129 const TDesC& CPlayerWindow::Url()
       
   130     {
       
   131     return iUrl;
       
   132     }
       
   133 
       
   134 void CPlayerWindow::PlayInitiated()
       
   135     {
       
   136     InitializeParameters( iVideoSize, 
       
   137                           iDuration, 
       
   138                           iMaxVolume, 
       
   139                           iCurrentVolume,
       
   140                           iBalanceCenter,
       
   141                           iBalanceMaxLeft,
       
   142                           iBalanceMaxRight,
       
   143                           iDefaultBalance, 
       
   144                           iCurrentBalance );
       
   145     
       
   146     iDurationInMs = iDuration.Int64() / 1000;
       
   147     
       
   148     if( iBorderColor != 0 )
       
   149         {
       
   150         DrawBorderAroundWindow();
       
   151         }
       
   152     
       
   153     iWindow.SetVisible(true);  
       
   154     
       
   155     iPlayState = EPlaying;
       
   156 
       
   157     if( iObserver )
       
   158         {
       
   159         iObserver->PlayInitiated();
       
   160         }
       
   161     }
       
   162 
       
   163 void CPlayerWindow::PlayComplete()
       
   164     {
       
   165     iPlayState = EStopped; 
       
   166     
       
   167     if( iObserver )
       
   168         {
       
   169         iObserver->PlayStateChanged();
       
   170         }       
       
   171     }
       
   172 
       
   173 void CPlayerWindow::Error( TInt aError, const char* pDescription )
       
   174     {
       
   175     if( pDescription != NULL )
       
   176         {
       
   177         RDebug::Printf( "CONSOLEPLAYER ERROR %i %s", pDescription );
       
   178         }
       
   179     
       
   180     if( iObserver )
       
   181         {
       
   182         iObserver->Error( aError );
       
   183         }       
       
   184     }
       
   185 
       
   186 void CPlayerWindow::CheckError( TInt aError, const char* pDescription )
       
   187     {
       
   188     if( aError != KErrNone )
       
   189         {
       
   190         Error( aError, pDescription );
       
   191         }
       
   192     }
       
   193 
       
   194 CPlayerWindow::TPlayState CPlayerWindow::PlayState()
       
   195     {
       
   196     return iPlayState;
       
   197     }
       
   198 
       
   199 TInt CPlayerWindow::PositionInMs()
       
   200     {    
       
   201     return Position().Int64() / 1000;
       
   202     }
       
   203 
       
   204 TInt CPlayerWindow::DurationInMs()
       
   205     {    
       
   206     return iDurationInMs;;
       
   207     }
       
   208 
       
   209 TSize CPlayerWindow::VideoSize()
       
   210     {    
       
   211     return iVideoSize;
       
   212     }
       
   213 
       
   214 TInt CPlayerWindow::Seek( TTimeIntervalMicroSeconds position )
       
   215     {
       
   216     RDebug::Printf( "CONSOLEPLAYER Seek %lu", position.Int64() );	
       
   217     	
       
   218     if( position < 0 )
       
   219         {
       
   220         position = 0;
       
   221         }           
       
   222     else if( position > iDuration )
       
   223         {
       
   224         position = iDuration;
       
   225         }
       
   226 
       
   227     TInt err = Pause();
       
   228     
       
   229     if( err == KErrNone )
       
   230         {
       
   231         err = SetPosition( position.Int64() );
       
   232         }
       
   233 
       
   234     if( (err == KErrNone) && (iPlayState == EPlaying) )
       
   235         {
       
   236         err = Play();
       
   237         }
       
   238     
       
   239     return err;
       
   240     }
       
   241 
       
   242 TInt CPlayerWindow::UpdateScaleFactor()
       
   243     {
       
   244     return SetScaleFactor(KScalePercentages[iWidthScaleIndex], KScalePercentages[iHeightScaleIndex]);
       
   245     }
       
   246 
       
   247 TInt CPlayerWindow::ResetToDefaults()
       
   248     {
       
   249     iWidthScaleIndex = KDefaultScalePercentagesIndex;
       
   250     iHeightScaleIndex = KDefaultScalePercentagesIndex;
       
   251     iExtentModeIndex = 0;
       
   252     iClipModeIndex = 0;
       
   253     iCurrentVelocity = 100;
       
   254     iCurrentVolume = iDefaultVolume;
       
   255     iCurrentBalance = iDefaultBalance;
       
   256     iWindowSize = iDefaultWindowSize;
       
   257     iWindowSizeDivisor = 1;
       
   258     ResetAutoscale();
       
   259     ResetRotation();    
       
   260     UpdateScaleFactor();
       
   261     SetClipRectangle(Rectangle(iClipModeIndex));
       
   262     SetVideoExtent(Rectangle(iExtentModeIndex));
       
   263     SetPlayVelocity(iCurrentVelocity);
       
   264     SetVolume(iCurrentVolume);
       
   265     SetBalance(iCurrentBalance);    
       
   266     return KErrNone;
       
   267     }
       
   268 
       
   269 // Iterates through a standard set of rectangles for the clipping and extent.
       
   270 TRect CPlayerWindow::Rectangle( TInt aModeIndex )
       
   271     {
       
   272     TRect rectangle;
       
   273     
       
   274     TSize windowSize = iWindow.Size();
       
   275         
       
   276     switch( aModeIndex )
       
   277         {
       
   278         case 0:
       
   279             // Full window.
       
   280             rectangle = TRect(windowSize); ;
       
   281             break;
       
   282         case 1:
       
   283             // 100x100 square in center of window.
       
   284             rectangle = TRect( windowSize.iWidth/2 - 50, windowSize.iHeight/2 - 50,
       
   285                                windowSize.iWidth/2 + 50, windowSize.iHeight/2 + 50 );
       
   286             break;
       
   287         case 2:
       
   288             // Top half of window.
       
   289             rectangle = TRect( 0, 0, windowSize.iWidth, windowSize.iHeight/2 );
       
   290             break;
       
   291         case 3:
       
   292             // Left half of window.
       
   293             rectangle = TRect( 0, 0, windowSize.iWidth/2, windowSize.iHeight );
       
   294             break;
       
   295         case 4:
       
   296             // Top-Left quarter of window.
       
   297             rectangle = TRect( 0, 0, windowSize.iWidth/2, windowSize.iHeight/2 );
       
   298             break;
       
   299         }
       
   300     
       
   301     return rectangle;        
       
   302     }
       
   303 
       
   304 // Checks to make sure that the second video window is within the limits of the display.
       
   305 void CPlayerWindow::CheckWindowLimits()
       
   306     {
       
   307     if( iWindowTopLeft.iX < 0 )
       
   308         {
       
   309         iWindowTopLeft.iX = 0;
       
   310         }
       
   311     else if( iWindowTopLeft.iX + iWindowSize.iWidth > iScreenDevice.SizeInPixels().iWidth )
       
   312         {
       
   313         iWindowTopLeft.iX = iScreenDevice.SizeInPixels().iWidth - iWindowSize.iWidth;
       
   314         }
       
   315 
       
   316     if( iWindowTopLeft.iY < 0 )
       
   317         {
       
   318         iWindowTopLeft.iY = 0;
       
   319         }
       
   320     else if( iWindowTopLeft.iY + iWindowSize.iHeight > iScreenDevice.SizeInPixels().iHeight )
       
   321         {
       
   322         iWindowTopLeft.iY = iScreenDevice.SizeInPixels().iHeight - iWindowSize.iHeight;
       
   323         }
       
   324     }
       
   325 
       
   326 TInt CPlayerWindow::ExecuteOperation( TInt aOperation )
       
   327     {
       
   328     TInt err = KErrNone;
       
   329     
       
   330     switch( aOperation )
       
   331         {
       
   332         case EOperation_StopPlay:
       
   333             {
       
   334             if( iPlayState == EStopped )
       
   335                 {
       
   336                 err = Play();
       
   337                 iPlayState = EPlaying;
       
   338                 }
       
   339             else
       
   340                 {
       
   341                 err = Stop();
       
   342                 iPlayState = EStopped;
       
   343                 }
       
   344             break;
       
   345             }
       
   346         case EOperation_PauseResume:
       
   347             {
       
   348             if( iPlayState == EPaused )
       
   349                 {
       
   350                 err = Play();
       
   351                 iPlayState = EPlaying;
       
   352                 }
       
   353             else if( iPlayState == EPlaying )
       
   354                 {
       
   355                 err = Pause();                    
       
   356                 iPlayState = EPaused;
       
   357                 }
       
   358             break;
       
   359             }
       
   360         case EOperation_Pause:
       
   361             {
       
   362             if( iPlayState == EPlaying )
       
   363                 {
       
   364                 err = Pause();                    
       
   365                 iPlayState = EPaused;
       
   366                 }
       
   367             break;
       
   368             }
       
   369         case EOperation_Resume:
       
   370             {
       
   371             if( iPlayState == EPaused )
       
   372                 {
       
   373                 err = Play();
       
   374                 iPlayState = EPlaying;
       
   375                 }
       
   376             break;
       
   377             }
       
   378         case EOperation_SeekBack:
       
   379             {
       
   380             // Reverse seek 5 seconds
       
   381             TInt64 pos = Position().Int64();
       
   382             pos -= 5000000;
       
   383             err = Seek( pos );
       
   384             break;
       
   385             }
       
   386         case EOperation_SeekForward:
       
   387             {
       
   388             // Forward 5 seconds
       
   389             TInt64 pos = Position().Int64();
       
   390             pos += 5000000;
       
   391             err = Seek( pos );
       
   392             break;
       
   393             }
       
   394         case EOperation_SeekStart:
       
   395             {
       
   396             err = Seek( 0 );
       
   397             break;
       
   398             }
       
   399         case EOperation_SeekEnd:
       
   400             {
       
   401             // Seek to 5 seconds before the end of the clip.
       
   402             TInt64 pos = iDuration.Int64() - 5000000;
       
   403             err = Seek( pos );
       
   404             break;
       
   405             }
       
   406         case EOperation_FrameStepForward:    
       
   407             {
       
   408             err = StepForward();
       
   409             break;
       
   410             }
       
   411         case EOperation_FrameStepBackward:    
       
   412             {
       
   413             err = StepBackward();
       
   414             break;
       
   415             }
       
   416         case EOperation_IncreasePlayVelocity:    
       
   417             {
       
   418             iCurrentVelocity += 50;
       
   419             err = SetPlayVelocity( iCurrentVelocity );
       
   420             break;
       
   421             }
       
   422         case EOperation_DecreasePlayVelocity:    
       
   423             {
       
   424             iCurrentVelocity -= 50;
       
   425             err = SetPlayVelocity( iCurrentVelocity );
       
   426             break;
       
   427             }
       
   428         case EOperation_IncreaseHeightScale:
       
   429             {
       
   430             if( iHeightScaleIndex < KScalePercentagesCount )
       
   431                 {
       
   432                 iHeightScaleIndex++;                            
       
   433                 }
       
   434             err = UpdateScaleFactor();
       
   435             break;
       
   436             }
       
   437         case EOperation_DecreaseHeightScale:
       
   438             {
       
   439             if( iHeightScaleIndex > 0 )
       
   440                 {
       
   441                 iHeightScaleIndex--;
       
   442                 }                    
       
   443             err = UpdateScaleFactor();
       
   444             break;
       
   445             }                
       
   446         case EOperation_IncreaseWidthScale:    
       
   447             {
       
   448             if( iWidthScaleIndex < KScalePercentagesCount )
       
   449                 {
       
   450                 iWidthScaleIndex++;                            
       
   451                 }                        
       
   452             err = UpdateScaleFactor();
       
   453             break;
       
   454             }                
       
   455         case EOperation_DecreaseWidthScale:    
       
   456             {
       
   457             if( iWidthScaleIndex > 0 )
       
   458                 {
       
   459                 iWidthScaleIndex--;                            
       
   460                 }                        
       
   461             err = UpdateScaleFactor();
       
   462             break;
       
   463             }
       
   464         case EOperation_Rotate:
       
   465             {
       
   466             err = NextRotationAngle();
       
   467             break;
       
   468             }                
       
   469         case EOperation_Autoscale:
       
   470             {
       
   471             err = NextAutoscaleMode();
       
   472             break;
       
   473             }                
       
   474         case EOperation_ClipRectangle:    
       
   475             {
       
   476             iClipModeIndex = (iClipModeIndex+1) % KRectangleModeCount;
       
   477             err = SetClipRectangle(Rectangle( iClipModeIndex ));                        
       
   478             break;
       
   479             }                
       
   480         case EOperation_Extent:    
       
   481             {
       
   482             // Advance to next extent mode.
       
   483             iExtentModeIndex = (iExtentModeIndex+1) % KRectangleModeCount;
       
   484             err = SetVideoExtent(Rectangle( iExtentModeIndex ));
       
   485             break;
       
   486             }                
       
   487         case EOperation_ResetToDefaults:    
       
   488             {
       
   489             err = ResetToDefaults();
       
   490             break;
       
   491             }
       
   492         case EOperation_IncreaseVolume:
       
   493             {
       
   494             err = SetVolume( iCurrentVolume + iMaxVolume / 10 );
       
   495             break;
       
   496             }
       
   497         case EOperation_DecreaseVolume:
       
   498             {
       
   499             err = SetVolume( iCurrentVolume - iMaxVolume / 10 );
       
   500             break;
       
   501             }
       
   502         case EOperation_MaximumVolume:
       
   503             {
       
   504             err = SetVolume( iMaxVolume );
       
   505             break;
       
   506             }            
       
   507         case EOperation_Mute:
       
   508             {
       
   509             err = SetVolume( 0 );
       
   510             break;
       
   511             }
       
   512         case EOperation_BalanceLeft:
       
   513             {
       
   514             err = SetBalance( iCurrentBalance - 10 );
       
   515             break;
       
   516             }
       
   517         case EOperation_BalanceRight:
       
   518             {
       
   519             err = SetBalance( iCurrentBalance + 10 );
       
   520             break;
       
   521             }
       
   522         case EOperation_BalanceCenter:
       
   523             {
       
   524             err = SetBalance( iBalanceCenter );
       
   525             break;
       
   526             }
       
   527         case EOperation_BalanceMaxLeft:
       
   528             {
       
   529             err = SetBalance( iBalanceMaxLeft );
       
   530             break;
       
   531             }
       
   532         case EOperation_BalanceMaxRight:
       
   533             {
       
   534             err = SetBalance( iBalanceMaxRight );
       
   535             break;
       
   536             }                 
       
   537         case EOperation_MoveWindowUp:
       
   538             {
       
   539             iWindowTopLeft.iY -= KMoveWindowDelta;
       
   540             CheckWindowLimits();
       
   541             iWindow.SetExtent( iWindowTopLeft, iWindowSize );
       
   542             break;
       
   543             }
       
   544         case EOperation_MoveWindowDown:
       
   545             {
       
   546             iWindowTopLeft.iY += KMoveWindowDelta;
       
   547             CheckWindowLimits();
       
   548             iWindow.SetExtent( iWindowTopLeft, iWindowSize );
       
   549             break;
       
   550             }
       
   551         case EOperation_MoveWindowLeft:
       
   552             {
       
   553             iWindowTopLeft.iX -= KMoveWindowDelta;
       
   554             CheckWindowLimits();
       
   555             iWindow.SetExtent( iWindowTopLeft, iWindowSize );
       
   556             break;
       
   557             }
       
   558         case EOperation_MoveWindowRight:
       
   559             {
       
   560             iWindowTopLeft.iX += KMoveWindowDelta;
       
   561             CheckWindowLimits();
       
   562             iWindow.SetExtent( iWindowTopLeft, iWindowSize );
       
   563             break;
       
   564             }
       
   565         case EOperation_ChangeWindowSize:                
       
   566             {
       
   567             iWindowSizeDivisor = (iWindowSizeDivisor % 5) + 1;
       
   568 
       
   569             iWindowSize = TSize(iDefaultWindowSize.iWidth/iWindowSizeDivisor,
       
   570                                 iDefaultWindowSize.iHeight/iWindowSizeDivisor);
       
   571             CheckWindowLimits();
       
   572             iWindow.SetExtent( iWindowTopLeft, iWindowSize);
       
   573             SetVideoExtent( TRect(iWindowSize) );
       
   574             
       
   575             if( iBorderColor != 0 )
       
   576                 {
       
   577                 DrawBorderAroundWindow();
       
   578                 }
       
   579             break;
       
   580             }
       
   581         case EOperation_ToggleWindowTransparency:                
       
   582             {
       
   583             // Black is completely transparent, and white is completely opaque.
       
   584             iWindowTransparent = !iWindowTransparent;
       
   585             iWindow.SetTransparencyFactor( KRgbGray );
       
   586             iWindow.SetSurfaceTransparency( iWindowTransparent );
       
   587             break;
       
   588             }
       
   589         case EOperation_DrawWhiteBorderAroundWindow:
       
   590             {
       
   591             iBorderColor = 0xfefefe;
       
   592             DrawBorderAroundWindow();
       
   593             break;
       
   594             }
       
   595         case EOperation_DrawRedBorderAroundWindow:
       
   596             {
       
   597             iBorderColor = KRgbRed;
       
   598             DrawBorderAroundWindow();
       
   599             break;
       
   600             }
       
   601         case EOperation_ClearBorderAroundWindow:
       
   602             {            
       
   603             iBorderColor = 0;
       
   604             if( iGc )
       
   605                 {
       
   606                 iGc->Activate(iWindow);            
       
   607                 iWindow.Invalidate();
       
   608                 iWindow.BeginRedraw();            
       
   609                 iGc->Reset();            
       
   610                 iWindow.EndRedraw();                        
       
   611                 iGc->Deactivate();
       
   612                 }
       
   613             break;
       
   614             }
       
   615         default:
       
   616             {
       
   617             // Give operation to subclass to execute.
       
   618             err = DoExecuteOperation( aOperation );
       
   619             break;
       
   620             }
       
   621         }    
       
   622     
       
   623     return err;
       
   624     }
       
   625 
       
   626 void CPlayerWindow::DrawBorderAroundWindow()
       
   627     {
       
   628     if( iGc )
       
   629         {
       
   630         iGc->Activate(iWindow);
       
   631         
       
   632         iWindow.Invalidate();
       
   633         iWindow.BeginRedraw();
       
   634         
       
   635         iGc->Reset();
       
   636         
       
   637         iGc->SetPenColor(iBorderColor);
       
   638         iGc->SetPenStyle(CWindowGc::ESolidPen);            
       
   639         iGc->DrawRect( TRect(iWindow.Size()) );
       
   640                     
       
   641         iWindow.EndRedraw();
       
   642         
       
   643         iGc->Deactivate();
       
   644         }
       
   645     }
       
   646 
       
   647 
       
   648 void CPlayerWindow::WriteAdvancedText( CWindowGc& aGc, TInt aColumn, TInt& aRow, TInt aRowIncrement )
       
   649     {
       
   650     TRect rect = Rectangle( iExtentModeIndex );
       
   651     iBuffer.Format( _L("Extent: (%i,%i) (%i,%i)"), rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY );
       
   652     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   653     aRow += aRowIncrement;
       
   654                     
       
   655     rect = Rectangle( iClipModeIndex );
       
   656     iBuffer.Format( _L("Clip: (%i,%i) (%i,%i)"), rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY );
       
   657     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   658     aRow += aRowIncrement;
       
   659     
       
   660     iBuffer.Copy( _L("Autoscale: ") );
       
   661     AppendAutoscaleModeText( iBuffer );
       
   662     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   663     aRow += aRowIncrement;
       
   664     
       
   665     aGc.DrawText( _L("Scale factor:"), TPoint(aColumn, aRow) );
       
   666     aRow += aRowIncrement;
       
   667     
       
   668     iBuffer.Format( _L("width=%.1f"), KScalePercentages[iWidthScaleIndex] );
       
   669     aGc.DrawText( iBuffer, TPoint(aColumn+25, aRow) );
       
   670     aRow += aRowIncrement;
       
   671     
       
   672     iBuffer.Format( _L("height=%.1f"), KScalePercentages[iHeightScaleIndex] );
       
   673     aGc.DrawText( iBuffer, TPoint(aColumn+25, aRow) );
       
   674     aRow += aRowIncrement;
       
   675     
       
   676     iBuffer.Format( _L("Rotation: %i"), RotationAngle() );
       
   677     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   678     aRow += aRowIncrement;
       
   679     
       
   680     iBuffer.Format( _L("Velocity: %i"), iCurrentVelocity );
       
   681     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   682     aRow += aRowIncrement;
       
   683     
       
   684     iBuffer.Format( _L("Volume: %i/%i"), iCurrentVolume, iMaxVolume );
       
   685     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   686     aRow += aRowIncrement;
       
   687     
       
   688     iBuffer.Format( _L("Balance: %i"), iCurrentBalance );
       
   689     aGc.DrawText( iBuffer, TPoint(aColumn, aRow) );
       
   690     aRow += aRowIncrement;    
       
   691     }
       
   692 
       
   693 void CPlayerWindow::MoveWindow( TPoint aCenter )
       
   694     {    
       
   695     iWindowTopLeft.iX = aCenter.iX - iWindowSize.iWidth / 2;
       
   696     iWindowTopLeft.iY = aCenter.iY- iWindowSize.iHeight / 2;;
       
   697     CheckWindowLimits();
       
   698     iWindow.SetExtent( iWindowTopLeft, iWindowSize );
       
   699     }
       
   700 
       
   701 void CPlayerWindow::SetOrdinalPosition( TInt aPosition )
       
   702     {
       
   703     iWindow.SetOrdinalPosition( aPosition );
       
   704     }