idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp
branchRCL_3
changeset 19 79311d856354
parent 18 d05a55b217df
child 23 7be2816dbabd
--- a/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Wed Apr 14 15:47:59 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Tue Apr 27 16:26:12 2010 +0300
@@ -27,6 +27,7 @@
 #include <aifwdefs.h>
 #include <gfxtranseffect/gfxtranseffect.h>
 #include <akntransitionutils.h>
+#include <layoutmetadata.cdl.h>
 
 // User includes
 #include "xnapplication.h"
@@ -325,6 +326,8 @@
     
     iComposer = CXnComposer::NewL( *iHspsWrapper );
     
+    iIsLandscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
+    
     DoRobustnessCheckL();
     }
 
@@ -866,7 +869,6 @@
         if ( next.Load() == KErrNoMemory )
             {
             next.ShowOutOfMemError();
-            
             return;
             }
         }
@@ -885,21 +887,42 @@
         
         TInt ret( GfxTransEffect::BeginGroup() );
         
-        CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() );
+        CFbsBitmap* currentBg( ActiveViewData().WallpaperImage() );
+        CFbsBitmap* nextBg( next.WallpaperImage() );
         
-        GfxTransEffect::Begin( bg, KGfxControlActionAppear );
-
-        GfxTransEffect::SetDemarcation( bg, bg->Position() );
-        GfxTransEffect::End( bg );        
+        if ( currentBg || nextBg )
+            {
+            CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() );
+            
+            if ( !currentBg && nextBg )
+                {
+                GfxTransEffect::Begin( bg, KGfxControlActionBgAnimToImgAppear );
+                }
+            else
+                {
+                GfxTransEffect::Begin( bg, KGfxControlActionBgImgToImgAppear );
+                }
+            
+            GfxTransEffect::SetDemarcation( bg, bg->Position() );
+            GfxTransEffect::End( bg );
+            }
         
-        GfxTransEffect::Begin( thisView, KGfxControlActionDisappear );
+        if ( iIsLandscapeOrientation )
+            {
+            GfxTransEffect::Begin( thisView, KGfxControlActionDisappearLsc );
+            GfxTransEffect::Begin( nextView, KGfxControlActionAppearLsc );
+            }
+        else
+            {
+            GfxTransEffect::Begin( thisView, KGfxControlActionDisappearPrt );
+            GfxTransEffect::Begin( nextView, KGfxControlActionAppearPrt );
+            }
         
-        iAppUiAdapter.ViewAdapter().ActivateContainerL( next );
+        TRAP_IGNORE( iAppUiAdapter.ViewAdapter().ActivateContainerL( next ) );
         
         GfxTransEffect::SetDemarcation( thisView, thisView->Position() );
         GfxTransEffect::End( thisView );
-                
-        GfxTransEffect::Begin( nextView, KGfxControlActionAppear );
+        
         GfxTransEffect::SetDemarcation( nextView, nextView->Position() );
         GfxTransEffect::End( nextView );
                                 
@@ -924,7 +947,6 @@
         if ( prev.Load() == KErrNoMemory )
             {
             prev.ShowOutOfMemError();
-            
             return;
             }
         }
@@ -942,23 +964,43 @@
         GfxTransEffect::Register( prevView, KGfxContextActivatePrevView );
     
         TInt ret( GfxTransEffect::BeginGroup() );
-            
-        CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() );
+        
+        CFbsBitmap* currentBg( ActiveViewData().WallpaperImage() );
+        CFbsBitmap* prevBg( prev.WallpaperImage() );
         
-        GfxTransEffect::Begin( bg, KGfxControlActionAppear );
-    
-        GfxTransEffect::SetDemarcation( bg, bg->Position() );
-        GfxTransEffect::End( bg );        
+        if ( currentBg || prevBg )
+            {
+            CCoeControl* bg( &iAppUiAdapter.ViewAdapter().BgManager() );
+            
+            if ( !currentBg && prevBg )
+                {
+                GfxTransEffect::Begin( bg, KGfxControlActionBgAnimToImgAppear );
+                }
+            else
+                {
+                GfxTransEffect::Begin( bg, KGfxControlActionBgImgToImgAppear );
+                }
+            
+            GfxTransEffect::SetDemarcation( bg, bg->Position() );
+            GfxTransEffect::End( bg );
+            }
         
-        GfxTransEffect::Begin( thisView, KGfxControlActionDisappear );
+        if ( iIsLandscapeOrientation )
+            {
+            GfxTransEffect::Begin( thisView, KGfxControlActionDisappearLsc );
+            GfxTransEffect::Begin( prevView, KGfxControlActionAppearLsc );
+            }
+        else
+            {
+            GfxTransEffect::Begin( thisView, KGfxControlActionDisappearPrt );
+            GfxTransEffect::Begin( prevView, KGfxControlActionAppearPrt );
+            }
         
-        iAppUiAdapter.ViewAdapter().ActivateContainerL( prev );
+        TRAP_IGNORE( iAppUiAdapter.ViewAdapter().ActivateContainerL( prev ) );
         
         GfxTransEffect::SetDemarcation( thisView, thisView->Position() );
         GfxTransEffect::End( thisView );
-                
-        GfxTransEffect::Begin( prevView, KGfxControlActionAppear );
-                              
+                                      
         GfxTransEffect::SetDemarcation( prevView, prevView->Position() );
         GfxTransEffect::End( prevView );
                                 
@@ -1772,4 +1814,12 @@
         }           
     }
 
+// -----------------------------------------------------------------------------
+// CXnViewManager::OrientationChanged 
+// -----------------------------------------------------------------------------
+void CXnViewManager::OrientationChanged()
+    {
+    iIsLandscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();    
+    }
+
 // End of file