photosgallery/viewframework/views/zoomview/src/glxzoomcontrol.cpp
branchRCL_3
changeset 23 b023a8d2866a
parent 21 f9e827349359
child 24 ea65f74e6de4
equal deleted inserted replaced
21:f9e827349359 23:b023a8d2866a
    59 //zoom delay for animation while hdmi cable,
    59 //zoom delay for animation while hdmi cable,
    60 //is connected and zoom is initiated
    60 //is connected and zoom is initiated
    61 const TInt KHDMIZoomDelay = 250000; 
    61 const TInt KHDMIZoomDelay = 250000; 
    62 //Zoom level for the animation , assuming the innitial level is 1.
    62 //Zoom level for the animation , assuming the innitial level is 1.
    63 const TReal KGlxZoomLevel = 1.5;
    63 const TReal KGlxZoomLevel = 1.5;
    64 const TInt KGlxMinSmallImageZoomLevel =100;
       
    65 
    64 
    66 const TInt KGlxDecodingThreshold = 3000000; // pixels
    65 const TInt KGlxDecodingThreshold = 3000000; // pixels
    67 
    66 
    68 
    67 
    69 // ============================ MEMBER FUNCTIONS ===============================
    68 // ============================ MEMBER FUNCTIONS ===============================
   330                 maxVirtualImageSize.iWidth  = imageSize.iWidth  /  sideRatio ;
   329                 maxVirtualImageSize.iWidth  = imageSize.iWidth  /  sideRatio ;
   331                 }
   330                 }
   332             
   331             
   333             // Now since our maximum size possible is 3 MP. all our zoom percentages will be relative to it. 
   332             // Now since our maximum size possible is 3 MP. all our zoom percentages will be relative to it. 
   334             // So our initial zoom ratio will be different and cnsequently our minimum slider value too will change. 
   333             // So our initial zoom ratio will be different and cnsequently our minimum slider value too will change. 
   335             // Maximum is an
   334 
   336             TInt initialZoomRatio = GetInitialZoomLevel(maxVirtualImageSize);
   335             
   337             iZoomSliderModel->SetMinRange(initialZoomRatio);
   336             GLX_LOG_INFO1("ActivateZoomControlL: Slider MaxRange = %d   ", iZoomSliderModel->MaxRange() );
       
   337             GLX_LOG_INFO1("ActivateZoomControlL: Slider MinRange = %d   ", iZoomSliderModel->MinRange() );
       
   338             GLX_LOG_INFO1("ActivateZoomControlL: Slider PrimaryValue= %d", iZoomSliderModel->PrimaryValue() );
   338 
   339 
   339             iEventHandler->SetZoomActivated(ETrue);
   340             iEventHandler->SetZoomActivated(ETrue);
   340             if (aStartMode == EZoomStartSlider) 
   341             if (aStartMode == EZoomStartSlider) 
   341                 {
   342                 {
   342                 iEventHandler->ActivateZoom(aInitialZoomRatio,
   343                 iEventHandler->ActivateZoom(aInitialZoomRatio,
   343                         maxVirtualImageSize,
   344                         maxVirtualImageSize,
   344                         aStartMode,
   345                         aStartMode,
   345                         iZoomSliderModel->MinRange(), 
   346                         iZoomSliderModel->MinRange(), 
   346                         iZoomSliderModel->MaxRange(),
   347                         iZoomSliderModel->MaxRange(),
   347                         maxVirtualImageSize,
       
   348                         aZoomFocus);
   348                         aZoomFocus);
   349                 }
   349                 }
   350             else 
   350             else 
   351                 {
   351                 {
   352                 iEventHandler->ActivateZoom(initialZoomRatio,
   352                 iEventHandler->ActivateZoom(aInitialZoomRatio,
   353                         maxVirtualImageSize,
   353                         maxVirtualImageSize,
   354                         aStartMode,
   354                         aStartMode,
   355                         iZoomSliderModel->MinRange(), 
   355                         iZoomSliderModel->MinRange(), 
   356                         iZoomSliderModel->MaxRange(),
   356                         iZoomSliderModel->MaxRange(),
   357                         maxVirtualImageSize,
       
   358                         aZoomFocus);
   357                         aZoomFocus);
   359                 }
   358                 }
   360             TRAP_IGNORE(iImageTexture = 
   359             TRAP_IGNORE(iImageTexture = 
   361             &(iTextureMgr->CreateZoomedTextureL(aItem,thumbNailAttribute,idspace,this)));
   360             &(iTextureMgr->CreateZoomedTextureL(aItem,thumbNailAttribute,idspace,this)));
   362            
   361            
   792 
   791 
   793     if(aPrimarySliderRatio >= 0)
   792     if(aPrimarySliderRatio >= 0)
   794         {
   793         {
   795         iZoomSliderModel->SetPrimaryValue(aPrimarySliderRatio);
   794         iZoomSliderModel->SetPrimaryValue(aPrimarySliderRatio);
   796         }
   795         }
       
   796     
       
   797     GLX_LOG_INFO1(" CGlxZoomControl::UpdateViewPort aPrimarySliderRatio = [%d]", aPrimarySliderRatio);
       
   798     
   797     }
   799     }
   798 
   800 
   799 // -----------------------------------------------------------------------------
   801 // -----------------------------------------------------------------------------
   800 // HandleShowUi
   802 // HandleShowUi
   801 // -----------------------------------------------------------------------------
   803 // -----------------------------------------------------------------------------
   913 	    }
   915 	    }
   914     iEventHandler->SetPreviousEventCode(code);
   916     iEventHandler->SetPreviousEventCode(code);
   915     }
   917     }
   916 
   918 
   917 // -----------------------------------------------------------------------------
   919 // -----------------------------------------------------------------------------
   918 // GetInitialZoomLevel
       
   919 // -----------------------------------------------------------------------------
       
   920 //
       
   921 TInt CGlxZoomControl::GetInitialZoomLevel(TSize& aSize )
       
   922     {
       
   923     TRACER("CGlxZoomControl::InitialZoomLevel");
       
   924 
       
   925     TRect rect = AlfUtil::ScreenSize();
       
   926     TUint8 initialZoomLevel;
       
   927 
       
   928     if( rect.Width()>= aSize.iWidth && rect.Height() >= aSize.iHeight)
       
   929         {
       
   930         //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100
       
   931         initialZoomLevel = KGlxMinSmallImageZoomLevel;
       
   932         }
       
   933     else
       
   934         {
       
   935         //Calculate (Display Area Width)  /Image Width   * 100
       
   936         //Calculate (Display Area Height) /Image Height  * 100
       
   937         //Choose the Minimum Of the above.
       
   938         TReal32 imageWidthRatio  = ((TReal32) rect.Width()/ aSize.iWidth  )*100.0F;
       
   939         TReal32 imageHeightRatio = ((TReal32)rect.Height()/ aSize.iHeight )*100.0F;
       
   940         initialZoomLevel = Min(imageWidthRatio,imageHeightRatio);
       
   941         } 
       
   942     return initialZoomLevel;
       
   943     }
       
   944 // -----------------------------------------------------------------------------
       
   945 // HandleTvStatusChangedL 
   920 // HandleTvStatusChangedL 
   946 // -----------------------------------------------------------------------------
   921 // -----------------------------------------------------------------------------
   947 void CGlxZoomControl::HandleTvStatusChangedL( TTvChangeType aChangeType )
   922 void CGlxZoomControl::HandleTvStatusChangedL( TTvChangeType aChangeType )
   948     {
   923     {
   949     TRACER("CGlxZoomControl::HandleTvStatusChangedL()");
   924     TRACER("CGlxZoomControl::HandleTvStatusChangedL()");