photosgallery/viewframework/uiutilities/src/glxuiutility.cpp
branchRCL_3
changeset 18 bcb43dc84c44
parent 14 ce1c7ad1f18b
child 22 2dac0fdba72b
equal deleted inserted replaced
14:ce1c7ad1f18b 18:bcb43dc84c44
   121 void CGlxUiUtility::ConstructL()
   121 void CGlxUiUtility::ConstructL()
   122     {
   122     {
   123     TRACER("CGlxUiUtility::ConstructL()");
   123     TRACER("CGlxUiUtility::ConstructL()");
   124     iSettingsModel = CGlxSettingsModel::InstanceL();
   124     iSettingsModel = CGlxSettingsModel::InstanceL();
   125     
   125     
   126 
   126 	iOrientation = EGlxOrientationDefault; // Always start in default orientation
   127 	// Always start in default orientation
       
   128     //SetAppOrientationL(EGlxOrientationDefault);
       
   129 
       
   130 	iOrientation = EGlxOrientationDefault;
       
   131     // in emulator use bitgdi as open GL does not support changing orientation
       
   132 
       
   133     // Ferhan (28/06/07) : commenting out usage of opengl because causing drawing problems when using
       
   134     // the preview list (gldrawelements method in opengl seems to hang)
       
   135    // iEnv = CHuiEnv::Static();
       
   136    	//@ Fix for error id EABI-7RJA8C
       
   137     iEnv = CAlfEnv::Static();
   127     iEnv = CAlfEnv::Static();
   138     if (!iEnv)
   128     if (!iEnv)
   139        {
   129        {
   140        iEnv = CAlfEnv::NewL();
   130        iEnv = CAlfEnv::NewL();
   141        // change to this on hw that supports opengl
       
   142        // iEnv = CHuiEnv::NewL( EHuiRendererGles10 );
       
   143        }
   131        }
   144     else
   132     else
   145        {
   133        {
   146        iShared = ETrue;
   134        iShared = ETrue;
   147        }
   135        }
   161     iAlfDisplay = &iEnv->NewDisplayL(rect,
   149     iAlfDisplay = &iEnv->NewDisplayL(rect,
   162             CAlfEnv::ENewDisplayAsCoeControl | CAlfEnv::ENewDisplayFullScreen );
   150             CAlfEnv::ENewDisplayAsCoeControl | CAlfEnv::ENewDisplayFullScreen );
   163             
   151             
   164      iEnv->AddActionObserverL (this);
   152      iEnv->AddActionObserverL (this);
   165      
   153      
   166     // Use the Avkon skin background as the display background.    
       
   167     //iAlfDisplay->SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground);
       
   168     
       
   169     // create the resoltuion manager - needs to be informed when screen size 
   154     // create the resoltuion manager - needs to be informed when screen size 
   170     // changes
   155     // changes
   171     iGlxResolutionManager = CGlxResolutionManager::NewL();
   156     iGlxResolutionManager = CGlxResolutionManager::NewL();
   172     
   157     
   173     iGlxTvOut = CGlxTv::NewL(*this);
   158     iGlxTvOut = CGlxTv::NewL(*this);
   175     // Is the TV Out display on
   160     // Is the TV Out display on
   176     // Note that this also sets the initial size for the resolution manager
   161     // Note that this also sets the initial size for the resolution manager
   177     HandleTvStatusChangedL( ETvConnectionChanged );
   162     HandleTvStatusChangedL( ETvConnectionChanged );
   178     
   163     
   179     iScreenFurniture = CGlxScreenFurniture::NewL(*this);
   164     iScreenFurniture = CGlxScreenFurniture::NewL(*this);
   180     
       
   181 //    iContextUtility = CHgContextUtility::NewL();
       
   182 //    iContextUtility->RePublishWhenFgL( ETrue );
       
   183 	}
   165 	}
   184 
   166 
   185 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   186 // Destructor
   168 // Destructor
   187 // -----------------------------------------------------------------------------
   169 // -----------------------------------------------------------------------------
   189 CGlxUiUtility::~CGlxUiUtility()
   171 CGlxUiUtility::~CGlxUiUtility()
   190     {
   172     {
   191     TRACER("CGlxUiUtility::~CGlxUiUtility()");
   173     TRACER("CGlxUiUtility::~CGlxUiUtility()");
   192     GLX_LOG_INFO("~CGlxUiUtility");
   174     GLX_LOG_INFO("~CGlxUiUtility");
   193     delete iScreenFurniture;
   175     delete iScreenFurniture;
   194 /*    if (iContextUtility)
       
   195         {
       
   196         delete iContextUtility;
       
   197         iContextUtility = NULL;
       
   198         }
       
   199 */
       
   200     // Destroy TV Out related objects
   176     // Destroy TV Out related objects
   201     delete iGlxTvOut;
   177     delete iGlxTvOut;
   202     delete iGlxResolutionManager;
   178     delete iGlxResolutionManager;
   203     DestroyTvOutDisplay();
   179     DestroyTvOutDisplay();
   204     
   180     
   323 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------
   324 //
   300 //
   325 EXPORT_C TSize CGlxUiUtility::DisplaySize() const
   301 EXPORT_C TSize CGlxUiUtility::DisplaySize() const
   326     {
   302     {
   327     TRACER("CGlxUiUtility::DisplaySize()");
   303     TRACER("CGlxUiUtility::DisplaySize()");
   328     //return Env()->PrimaryDisplay().Size();
       
   329     const TRect& rect = Env()->PrimaryDisplay().VisibleArea();
   304     const TRect& rect = Env()->PrimaryDisplay().VisibleArea();
   330 	return rect.Size();
   305 	return rect.Size();
   331     }
   306     }
   332 
   307 
   333 // -----------------------------------------------------------------------------
   308 // -----------------------------------------------------------------------------
   448 EXPORT_C TSize CGlxUiUtility::GetGridIconSize()
   423 EXPORT_C TSize CGlxUiUtility::GetGridIconSize()
   449     {
   424     {
   450 	 TRACER("CGlxUiUtility::GetGridIconSize()");
   425 	 TRACER("CGlxUiUtility::GetGridIconSize()");
   451     return iGridIconSize;
   426     return iGridIconSize;
   452     }    
   427     }    
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 // SetGridToolBar
       
   431 // -----------------------------------------------------------------------------
       
   432 //
       
   433 EXPORT_C void CGlxUiUtility::SetGridToolBar(CAknToolbar* aToolbar)
       
   434     {
       
   435     TRACER("CGlxUiUtility::SetGridToolBar()");
       
   436     iToolbar = aToolbar;
       
   437     }
       
   438 
       
   439 // -----------------------------------------------------------------------------
       
   440 // GetGridToolBar
       
   441 // -----------------------------------------------------------------------------
       
   442 //
       
   443 EXPORT_C CAknToolbar* CGlxUiUtility::GetGridToolBar()
       
   444     {
       
   445     TRACER("CGlxUiUtility::GetGridToolBar()");
       
   446     if(iToolbar)
       
   447         {
       
   448         return iToolbar;
       
   449         }
       
   450     return NULL;     
       
   451     }
       
   452 
   453 // -----------------------------------------------------------------------------
   453 // -----------------------------------------------------------------------------
   454 // HandleTvStatusChangedL
   454 // HandleTvStatusChangedL
   455 // -----------------------------------------------------------------------------
   455 // -----------------------------------------------------------------------------
   456 //
   456 //
   457 EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType aChangeType )
   457 EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType aChangeType )
   542     TRACER("CGlxUiUtility::DestroyTvOutDisplay()");
   542     TRACER("CGlxUiUtility::DestroyTvOutDisplay()");
   543     if (iTvDisplay)
   543     if (iTvDisplay)
   544         {
   544         {
   545         delete iTvDisplay;
   545         delete iTvDisplay;
   546         iTvDisplay = NULL; 
   546         iTvDisplay = NULL; 
   547         // Remove Primary Window Refresh observer
   547 
   548         //Display()->iRefreshObservers.Remove( *this );  
       
   549         iEnv->PauseRefresh();
   548         iEnv->PauseRefresh();
       
   549 
   550         // Disable Primary Window Visibility events
   550         // Disable Primary Window Visibility events
   551         CCoeControl* contl = (CCoeControl*)iEnv->PrimaryDisplay().ObjectProvider();
   551         CCoeControl* contl = (CCoeControl*)iEnv->PrimaryDisplay().ObjectProvider();
   552         contl->DrawableWindow()->DisableVisibilityChangeEvents();
   552         contl->DrawableWindow()->DisableVisibilityChangeEvents();
   553         }
   553         }
   554     }
   554     }
   574     // Scale the tv display size to match that of the phone display size
   574     // Scale the tv display size to match that of the phone display size
   575     tvOutDisplaySz = TSize (tvOutDisplaySz.iHeight * phoneDisplaySz.iWidth 
   575     tvOutDisplaySz = TSize (tvOutDisplaySz.iHeight * phoneDisplaySz.iWidth 
   576                           / phoneDisplaySz.iHeight, tvOutDisplaySz.iHeight );
   576                           / phoneDisplaySz.iHeight, tvOutDisplaySz.iHeight );
   577     const TRect tvOutDisplayBuffer( tvOutDisplaySz );
   577     const TRect tvOutDisplayBuffer( tvOutDisplaySz );
   578  
   578  
   579 	// Commenting out Creation of second display as it goes into posting surface, 
       
   580 	// Right now, only cloning is going to be the funcationality and posting would be done
       
   581 	// only for specific views (FS , Zoom and Slideshow)
       
   582 //    if (!iTvDisplay)
       
   583 //	    {
       
   584 //        iTvDisplay = &iEnv->NewDisplayL( tvOutDisplayBuffer, 
       
   585 //                 CAlfEnv::ENewDisplayAsCoeControl, 
       
   586 //                 iGlxTvOut->IsWidescreen() ? CAlfDisplay::EDisplayTvOutWide :
       
   587 //                 CAlfDisplay::EDisplayTvOut );
       
   588 //        
       
   589 //        if (iTvDisplay)                                 
       
   590 //            {
       
   591 //            // Use the Avkon skin background as the display background.
       
   592 //            iTvDisplay->SetClearBackgroundL( 
       
   593 //                                        CAlfDisplay::EClearWithSkinBackground );
       
   594 //            //Todo
       
   595 //            // Primary Window Refresh observer
       
   596 //            iEnv->SetRefreshMode(EAlfRefreshModeAutomatic);
       
   597 //            }
       
   598 //	    }
       
   599 			
       
   600 	// Set the TV screen size    
   579 	// Set the TV screen size    
   601     iGlxResolutionManager->SetScreenSizeL( tvOutDisplaySz );   
   580     iGlxResolutionManager->SetScreenSizeL( tvOutDisplaySz );   
   602 	}
   581 	}
   603 
   582 
   604 // -----------------------------------------------------------------------------
   583 // -----------------------------------------------------------------------------