idlehomescreen/xmluirendering/uiengine/src/xnuiengineimpl.cpp
branchRCL_3
changeset 30 b8fae6b8a148
parent 16 9674c1a575e9
child 34 d05a55b217df
equal deleted inserted replaced
16:9674c1a575e9 30:b8fae6b8a148
    20 #include <utf.h>
    20 #include <utf.h>
    21 #include <eikapp.h>
    21 #include <eikapp.h>
    22 #include <AknUtils.h>
    22 #include <AknUtils.h>
    23 #include <layoutmetadata.cdl.h>
    23 #include <layoutmetadata.cdl.h>
    24 #include <AknPriv.hrh> 
    24 #include <AknPriv.hrh> 
       
    25 #include <debug.h>
    25 
    26 
    26 // User includes
    27 // User includes
    27 #include "xnuiengine.h"
    28 #include "xnuiengine.h"
    28 #include "xnuiengineimpl.h"
    29 #include "xnuiengineimpl.h"
    29 #include "xnuistatelistener.h"
    30 #include "xnuistatelistener.h"
    33 #include "xndompropertyvalue.h"
    34 #include "xndompropertyvalue.h"
    34 #include "xnmenuadapter.h"
    35 #include "xnmenuadapter.h"
    35 #include "xnpopupcontroladapter.h"
    36 #include "xnpopupcontroladapter.h"
    36 #include "xnviewcontroladapter.h"
    37 #include "xnviewcontroladapter.h"
    37 #include "xnviewdata.h"
    38 #include "xnviewdata.h"
    38 #include "xnrootdata.h"
       
    39 #include "xnnodebreadthfirstiterator.h"
    39 #include "xnnodebreadthfirstiterator.h"
    40 #include "xntype.h"
    40 #include "xntype.h"
    41 #include "xnnodepluginif.h"
    41 #include "xnnodepluginif.h"
    42 #include "xncomponentnodeimpl.h"
    42 #include "xncomponentnodeimpl.h"
    43 #include "xnproperty.h"
    43 #include "xnproperty.h"
    56 #include "xnpanic.h"
    56 #include "xnpanic.h"
    57 #include "xneffectmanager.h"
    57 #include "xneffectmanager.h"
    58 #include "xneditor.h"
    58 #include "xneditor.h"
    59 #include "xnbackgroundmanager.h"
    59 #include "xnbackgroundmanager.h"
    60 #include "xntexteditor.h"
    60 #include "xntexteditor.h"
       
    61 #include "xnrootdata.h"
    61 
    62 
    62 #ifdef _XN_PERFORMANCE_TEST_
    63 #ifdef _XN_PERFORMANCE_TEST_
    63 #include "xntimemon.h"
    64 #include "xntimemon.h"
    64 #endif
    65 #endif
    65 
    66 
  8104            
  8105            
  8105     delete iEditMode;
  8106     delete iEditMode;
  8106     delete iHitTest;
  8107     delete iHitTest;
  8107 
  8108 
  8108     iFocusCandidateList.Reset();
  8109     iFocusCandidateList.Reset();
  8109     iRedrawRegions.ResetAndDestroy();
  8110 
       
  8111     if ( iRedrawRegions.Count() )
       
  8112         {
       
  8113         iRedrawRegions.ResetAndDestroy();
       
  8114         }
       
  8115 
  8110     iDirtyList.Reset();
  8116     iDirtyList.Reset();
  8111     }
  8117     }
  8112 
  8118 
  8113 // -----------------------------------------------------------------------------
  8119 // -----------------------------------------------------------------------------
  8114 // CXnUiEngineImpl::AppUiAdapter()
  8120 // CXnUiEngineImpl::AppUiAdapter()
  8325     
  8331     
  8326 #ifdef _XN3_DEBUG_
  8332 #ifdef _XN3_DEBUG_
  8327     TraceTreeL(iCurrentView );
  8333     TraceTreeL(iCurrentView );
  8328 #endif                          
  8334 #endif                          
  8329 
  8335 
       
  8336     __PRINTS("*** CXnUiEngineImpl::RenderUIL ***");
       
  8337     
  8330     for( TInt i=0; i<iRedrawRegions.Count(); i++)
  8338     for( TInt i=0; i<iRedrawRegions.Count(); i++)
  8331         {
  8339         {
  8332         CCoeControl* control = iRedrawRegions[i]->iControl;
  8340         CCoeControl* control = iRedrawRegions[i]->iControl;
  8333         RRegion& redrawRegion = iRedrawRegions[i]->iRegion;
  8341         RRegion& redrawRegion = iRedrawRegions[i]->iRegion;
  8334         
  8342         
  8335         if( redrawRegion.CheckError() )
  8343         if( redrawRegion.CheckError() )
  8336             {                
  8344             {                
  8337             // Mark tree rendered
  8345             // Mark tree rendered
  8338             iCurrentView->SetRenderedL();
  8346             iCurrentView->SetRenderedL();
  8339             // Error occured during dirty set, redraw whole window
  8347             // Error occured during dirty set, redraw whole window
  8340             control->DrawNow();                                              
  8348             control->DrawNow();               
       
  8349             
       
  8350             __PRINTS("* CXnUiEngineImpl::RenderUIL - redraw region error -> full redraw ***");
  8341             }                                        
  8351             }                                        
  8342         else 
  8352         else 
  8343             {
  8353             {
  8344             if( !redrawRegion.IsEmpty() )                                        
  8354             if( !redrawRegion.IsEmpty() )                                        
  8345                 {
  8355                 {
  8350                 if( count > 2 )
  8360                 if( count > 2 )
  8351                     {
  8361                     {
  8352                     // Make bounding rect over the dirty areas
  8362                     // Make bounding rect over the dirty areas
  8353                     TRect boundingRect( redrawRegion.BoundingRect() );
  8363                     TRect boundingRect( redrawRegion.BoundingRect() );
  8354                     
  8364                     
  8355                     control->DrawNow( boundingRect );
  8365                     __PRINT( __DBG_FORMAT( "* CXnUiEngineImpl::RenderUIL - redrawing bounding rect iTl.iX: %d, iTl.iY: %d, iBr.iX: %d, iBr.iY: %d" ),          
       
  8366                         boundingRect.iTl.iX, boundingRect.iTl.iY, boundingRect.iBr.iX, boundingRect.iBr.iY );                                         
       
  8367                     
       
  8368                     control->DrawNow( boundingRect );                    
  8356                     }                               
  8369                     }                               
  8357                 else
  8370                 else
  8358                     {
  8371                     {
  8359                     for( TInt i = 0; i < count; i++ )
  8372                     for( TInt i = 0; i < count; i++ )
  8360                         {
  8373                         {
  8361                         // Draw every dirty area separately
  8374                         // Draw every dirty area separately
  8362                         TRect redrawRect( redrawRegion[i] );
  8375                         TRect redrawRect( redrawRegion[i] );
  8363     
  8376 
       
  8377                         __PRINT( __DBG_FORMAT( "* CXnUiEngineImpl::RenderUIL - redrawing rect iTl.iX: %d, iTl.iY: %d, iBr.iX: %d, iBr.iY: %d" ),          
       
  8378                                 redrawRect.iTl.iX, redrawRect.iTl.iY, redrawRect.iBr.iX, redrawRect.iBr.iY );                                         
       
  8379                         
  8364                         control->DrawNow( redrawRect );
  8380                         control->DrawNow( redrawRect );
  8365                         }
  8381                         }
  8366                     }  
  8382                     }  
  8367                 }
  8383                 }
       
  8384             else
       
  8385                 {
       
  8386                 __PRINTS("* CXnUiEngineImpl::RenderUIL - nothing to redraw ***");
       
  8387                 }
  8368             }  
  8388             }  
       
  8389         
  8369         redrawRegion.Clear();  
  8390         redrawRegion.Clear();  
  8370         }
  8391         }
  8371 
  8392 
  8372     RefreshMenuL();
  8393     RefreshMenuL();
  8373 
  8394 
  8374     iLayoutControl &= ~XnLayoutControl::ERenderUI;
  8395     iLayoutControl &= ~XnLayoutControl::ERenderUI;
  8375     
  8396     
  8376     iAppUiAdapter.EffectManager()->UiRendered();
  8397     iAppUiAdapter.EffectManager()->UiRendered();
       
  8398     
       
  8399     __PRINTS("*** CXnUiEngineImpl::RenderUIL - done ***");
  8377     }
  8400     }
  8378 
  8401 
  8379 // -----------------------------------------------------------------------------
  8402 // -----------------------------------------------------------------------------
  8380 // CXnUiEngineImpl::RootNode()
  8403 // CXnUiEngineImpl::RootNode()
  8381 // -----------------------------------------------------------------------------
  8404 // -----------------------------------------------------------------------------
  8523 
  8546 
  8524     CleanupStack::Pop( array );
  8547     CleanupStack::Pop( array );
  8525 
  8548 
  8526     return array;
  8549     return array;
  8527     }
  8550     }
  8528 
  8551     
  8529 // -----------------------------------------------------------------------------
  8552 // -----------------------------------------------------------------------------
  8530 // CXnUiEngineImpl::FindContentSourceNodesL()
  8553 // CXnUiEngineImpl::FindContentSourceNodesL()
  8531 // -----------------------------------------------------------------------------
  8554 // -----------------------------------------------------------------------------
  8532 //
  8555 //
  8533 CXnPointerArray* CXnUiEngineImpl::FindContentSourceNodesL(
  8556 CXnPointerArray* CXnUiEngineImpl::FindContentSourceNodesL(
  8582    
  8605    
  8583     CleanupStack::Pop( array );
  8606     CleanupStack::Pop( array );
  8584 
  8607 
  8585     return array;
  8608     return array;
  8586     }
  8609     }
  8587     
  8610 
  8588 // -----------------------------------------------------------------------------
  8611 // -----------------------------------------------------------------------------
  8589 // CXnUiEngineImpl::Resources()
  8612 // CXnUiEngineImpl::Resources()
  8590 // -----------------------------------------------------------------------------
  8613 // -----------------------------------------------------------------------------
  8591 //
  8614 //
  8592 CArrayPtrSeg< CXnResource >& CXnUiEngineImpl::Resources()
  8615 CArrayPtrSeg< CXnResource >& CXnUiEngineImpl::Resources()
  9068     if ( !ActiveView() )
  9091     if ( !ActiveView() )
  9069         {
  9092         {
  9070         return;
  9093         return;
  9071         }
  9094         }
  9072 
  9095 
       
  9096     // remove focus
       
  9097     iAppUiAdapter.HideFocus();
       
  9098 
  9073     // Update client rect
  9099     // Update client rect
  9074     SetClientRectL( iAppUiAdapter.ClientRect(), EFalse );
  9100     SetClientRectL( iAppUiAdapter.ClientRect(), EFalse );
  9075 
  9101 
  9076     // Update background rect
  9102     // Update background rect
  9077     // Bg rect is always screen size.
  9103     // Bg rect is always screen size.
  9086     
  9112     
  9087     RootNode()->SetDirtyL();
  9113     RootNode()->SetDirtyL();
  9088 
  9114 
  9089     ReportScreenDeviceChangeL();
  9115     ReportScreenDeviceChangeL();
  9090             
  9116             
       
  9117     if ( !iControlAdapterList )
       
  9118         {
       
  9119         iControlAdapterList = &iViewManager.Controls();
       
  9120         }
  9091     for ( TInt i = 0; i < iControlAdapterList->Count(); i++ )
  9121     for ( TInt i = 0; i < iControlAdapterList->Count(); i++ )
  9092         {
  9122         {
  9093         CXnControlAdapter* adapter( ( *iControlAdapterList )[i] );
  9123         CXnControlAdapter* adapter( ( *iControlAdapterList )[i] );
  9094         
  9124         
  9095         adapter->HandleScreenDeviceChangedL();
  9125         adapter->HandleScreenDeviceChangedL();
  9400     
  9430     
  9401         if ( aNode == RootNode() )
  9431         if ( aNode == RootNode() )
  9402             {
  9432             {
  9403             // Force relayout and redraw from current view
  9433             // Force relayout and redraw from current view
  9404             iDirtyList.Reset();
  9434             iDirtyList.Reset();
       
  9435             if ( !iCurrentView )
       
  9436                 {
       
  9437                 iCurrentView = iViewManager.ViewNode();
       
  9438                 }
  9405             iDirtyList.AppendL( iCurrentView );
  9439             iDirtyList.AppendL( iCurrentView );
  9406             TXnDirtyRegion* dirtyRegion = FindDirtyRegionL( *iCurrentView );
  9440             TXnDirtyRegion* dirtyRegion = FindDirtyRegionL( *iCurrentView );
  9407             if( dirtyRegion )
  9441             if( dirtyRegion )
  9408                 {
  9442                 {
  9409                 dirtyRegion->iRegion.Clear();        
  9443                 dirtyRegion->iRegion.Clear();        
  9514         {
  9548         {
  9515         iClientRect = aRect;
  9549         iClientRect = aRect;
  9516         
  9550         
  9517         UpdateInternalUnits( iHorizontalUnitInPixels, iVerticalUnitInPixels,
  9551         UpdateInternalUnits( iHorizontalUnitInPixels, iVerticalUnitInPixels,
  9518             iClientRect );
  9552             iClientRect );
  9519                
  9553         
  9520         if ( aDrawNow )
  9554         if ( aDrawNow )
  9521             {
  9555             {
  9522             RootNode()->SetDirtyL();
  9556             RootNode()->SetDirtyL();
  9523             iUiEngine->RenderUIL();
  9557             iUiEngine->RenderUIL();
  9524             }
  9558             }
  9858         iSplitScreenState.iPartialScreenEditorNode = &aNode;           
  9892         iSplitScreenState.iPartialScreenEditorNode = &aNode;           
  9859 
  9893 
  9860         // make sure that we always get up event
  9894         // make sure that we always get up event
  9861         CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(  
  9895         CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(  
  9862             iViewManager.ActiveViewData().ViewNode()->Control() );            
  9896             iViewManager.ActiveViewData().ViewNode()->Control() );            
  9863                 
  9897                    
  9864         control->ResetGrabbing();
  9898         control->ResetGrabbing();  
  9865 
  9899 
  9866         // Hide all plugins except the one that contains given editor node
  9900         // Hide all plugins except the one that contains given editor node
  9867         RPointerArray< CXnNode >& plugins( *Plugins() );                   
  9901         RPointerArray< CXnNode >& plugins( *Plugins() );                   
  9868         for( TInt i=0; i<plugins.Count(); i++ )
  9902         for( TInt i=0; i<plugins.Count(); i++ )
  9869              {         
  9903              {         
 10094     
 10128     
 10095     if(parent)
 10129     if(parent)
 10096         {
 10130         {
 10097         CXnProperty* blocProgressionProperty( 
 10131         CXnProperty* blocProgressionProperty( 
 10098           parent->GetPropertyL( XnPropertyNames::style::common::KBlockProgression ) );               
 10132           parent->GetPropertyL( XnPropertyNames::style::common::KBlockProgression ) );               
 10099         
 10133         if ( !blocProgressionProperty )
       
 10134             {
       
 10135             User::Leave( KErrNotFound );
       
 10136             }
 10100         HBufC* blocProgressionValue (blocProgressionProperty->StringValueL());
 10137         HBufC* blocProgressionValue (blocProgressionProperty->StringValueL());
       
 10138         if ( !blocProgressionValue )
       
 10139             {
       
 10140             User::Leave( KErrNotFound );
       
 10141             }
 10101         CleanupStack::PushL( blocProgressionValue );
 10142         CleanupStack::PushL( blocProgressionValue );
 10102         if(iSplitScreenState.iPartialScreenBlock)
 10143         if(iSplitScreenState.iPartialScreenBlock)
 10103             {
 10144             {
 10104             delete iSplitScreenState.iPartialScreenBlock;
 10145             delete iSplitScreenState.iPartialScreenBlock;
 10105             iSplitScreenState.iPartialScreenBlock = NULL;
 10146             iSplitScreenState.iPartialScreenBlock = NULL;