uifw/EikStd/dlgsrc/EIKCAPC.CPP
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
--- a/uifw/EikStd/dlgsrc/EIKCAPC.CPP	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/EikStd/dlgsrc/EIKCAPC.CPP	Wed Sep 01 12:16:19 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -80,18 +80,11 @@
 #include <aknmfnecommandobserver.h>
 #endif //if defined( RD_SCALABLE_UI_V2)
 
-
+#include "akntrace.h"
 
 GLREF_C void Panic(TEikDialogPanic aPanic);
 
 const TInt KViewHighlightColor = 244 ;
-// const TInt KViewHighlightShadowColor = 222 ; 
-// const TInt KNormalBackgroundColor = 0 ;
-
-
-// Do not reference these directly... Use MaximumNumberOfControlLinesOnVisiblePage() 
-// const TInt KMaxControlLinesOnPageSingleLineFormat =6;
-// const TInt KMaxControlLinesOnPageDoubleLineFormat =5;
 
 enum
     {// must carry on from TSpaceSharingFlags
@@ -111,15 +104,8 @@
     ENoBorder       = 0x20000
     };
 
-const TInt KDynamicEarMask=(ELeftEarDown|ERightEarDown|ELeftEarGrab|ERightEarGrab);
-
-const TInt KCapCDefaultHorzEdgeSpacing=0;
-const TInt KCapCDefaultVertEdgeSpacing=0; 
 const TInt KCapCCenterSpacing=0;
 const TInt KControlTrailerSpacing=0;
-// const TInt KCapCEarHeightTopHalf=0;
-// const TInt KCapCEarHeightBottomHalf=0;
-// const TInt KCapCEarHeight=KCapCEarHeightTopHalf+KCapCEarHeightBottomHalf;
 const TInt KCapCEarWidth=0;
 const TInt KCapCEarSpacing=0;
 const TInt KCapCVertCaptionOffset=0;
@@ -127,9 +113,6 @@
 const TInt KTrailCVertCaptionOffset=0;
 const TInt KCapCSeparatorAfterSpace=0;
 
-const TInt KCapCInitialEarRepeat=600000;    // 6 tenths of a second
-const TInt KCapCEarRepeat=100000; // one tenth of a second
-
 /*
  *  The following set of static functions return value which have been hard coded from the Series 60 Skins LAF v2.0
  *  If a layout DLL becomes available the hard-coded values may be replaced with equivalent Macros.
@@ -283,7 +266,8 @@
 * Extension class for additional data members.
 *
 */
-NONSHARABLE_CLASS( CEikCapCExtension ): public MEikFormAnimObserver
+NONSHARABLE_CLASS( CEikCapCExtension ) : public CBase,
+                                         public MEikFormAnimObserver
     {
     friend class CEikCaptionedControl ;
 
@@ -349,12 +333,7 @@
 public: // needs to be public because idle callback uses these members.
 	CIdle *iIdle;
 	CIdleCallbackData *iIdleData;
-    /** iPartiallyVisible is used as a protection from changing subcontrol positions of 
-      * partially-visible controls in PositionFormComponents(). This is needed only for
-      * dynamic screen size change.
-      */
-    TBool iPartiallyVisible;
-    
+
     /**
      * Boolean used to check if application is single touch compatible.
      */
@@ -379,7 +358,7 @@
     iViewModeHighlightControlContext ( NULL ) ,
     iEditModeHighlightControlContextPressed( NULL ),
     iViewModeHighlightControlContextPressed( NULL ),
-    iPreviousRect( TPoint(0, 0), TSize(0, 0) ) ,
+    iPreviousRect( 0, 0, 0, 0 ),
     iPreviousState( EFalse ) ,
     iPressDownEffect( EFalse ),
     iXOffsetForDataPaneInEditMode( ELayoutEmpty ) ,
@@ -389,25 +368,29 @@
 	, iIndicator(NULL),
 	iIndicator2(NULL),
 	iObserver(NULL),
+	iSimulatedDownEvent( EFalse ),
     iFeedback( MTouchFeedback::Instance() ),
 	iIdle(NULL),
-	iIdleData(NULL),
-    iPartiallyVisible( EFalse )
+	iIdleData(NULL)
     {
+    _AKNTRACE_FUNC_ENTER;
     if ( iAvkonAppUi )
         {
         iUsesSingleClick = iAvkonAppUi->IsSingleClickCompatible();
         }
-    };
+    _AKNTRACE_FUNC_EXIT;
+    }
 
 CEikCapCExtension::~CEikCapCExtension()
     {
+    _AKNTRACE_FUNC_ENTER;
     // Remember to unacquire animation
     if( iAnimation && iSelf )
         {
         if( iSelf->iDialogPage )
             iSelf->iDialogPage->AcquireAnim( EFalse, this );
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 TBool CEikCapCExtension::IsHighlightAnimated() const
@@ -424,6 +407,7 @@
 
 void CEikCapCExtension::SkinChanged()
     {
+    _AKNTRACE_FUNC_ENTER;
     iAnimation = NULL;
     if( iSelf->iDialogPage )
         iAnimation = iSelf->iDialogPage->AcquireAnim( ETrue, this );
@@ -432,10 +416,12 @@
         {
         iAnimation->SetHighlightSize( iSelf->Rect().Size() );
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 void CEikCapCExtension::HandleLayoutSwitch( const TSize& aSize )
     {
+    _AKNTRACE_FUNC_ENTER;
     if( iAnimation )
         {
         if( iAnimation->Size() == aSize )
@@ -449,6 +435,7 @@
             iAnimation->SetHighlightSize( aSize );
             }
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 void CEikCapCExtension::AnimFrameReady()
@@ -468,7 +455,7 @@
     MAknsControlContext* cc = AknsDrawUtils::ControlContext( iSelf->iDialogPage );
 
     return AknsDrawUtils::DrawBackground( skin, cc, iSelf->iDialogPage, aGc, TPoint(0,0),
-                                          iSelf->ViewRect(), KAknsDrawParamRGBOnly );
+                                          iSelf->Rect(), KAknsDrawParamRGBOnly );
     }
 
 
@@ -480,26 +467,24 @@
          && ( aPointerEvent.iType == TPointerEvent::EButton1Down 
             || aPointerEvent.iType == TPointerEvent::EButton1Up ) )
         {
-
         // Check control type
         TBool edwinControl( LaunchInputType() );
         TBool simulate = EFalse;
-        if ( aPointerEvent.iType == TPointerEvent::EButton1Down
-                && iSelf->Rect().Contains( aPointerEvent.iPosition )
-                && !iSelf->iControl->Rect().Contains(
-                        aPointerEvent.iPosition ) )
+
+        if ( iSelf->Rect().Contains( aPointerEvent.iPosition ) )
             {
-            iSimulatedDownEvent = ETrue;
-            if ( !edwinControl )
+            if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+                 !iSelf->iControl->Rect().Contains( aPointerEvent.iPosition ) )
+                {
+                iSimulatedDownEvent = ETrue;
+                simulate = ETrue;
+                }
+            else if ( aPointerEvent.iType == TPointerEvent::EButton1Up &&
+                      iSimulatedDownEvent )
                 {
                 simulate = ETrue;
                 }
             }
-        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up
-                && iSimulatedDownEvent )
-            {
-            simulate = ETrue;
-            }
 
         // Simulate pointer event to control
         if ( simulate && !edwinControl )
@@ -511,23 +496,39 @@
             }
 
         // With edwin do action directly (due to cursor problems)
-        else if ( edwinControl && simulate
-                && aPointerEvent.iType == TPointerEvent::EButton1Up )
+        else if ( edwinControl &&
+                  simulate &&
+                  ( aPointerEvent.iType == TPointerEvent::EButton1Up ||
+                    aPointerEvent.iType == TPointerEvent::EButton1Down ) )
             {
-            CAknExtendedInputCapabilities* input( NULL );
-            iSelf->iControl->InputCapabilities().ObjectProvider(
-                    )->MopGetObjectNoChaining( input );
-            if ( input )
+            // Basic list feedback is given instead of sensitive edit
+            // feedback when tapping editor fields in forms.
+            if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+                {
+                iFeedback->InstantFeedback( iSelf->iControl,
+                                            ETouchFeedbackList );
+                }
+            else
                 {
-                iFeedback->InstantFeedback(
-                        iSelf->iControl, ETouchFeedbackEditor,
-                        ETouchFeedbackVibra, aPointerEvent );
-                input->ReportEventL(
+                iFeedback->InstantFeedback( iSelf->iControl,
+                                            ETouchFeedbackList,
+                                            ETouchFeedbackVibra,
+                                            aPointerEvent );
+                
+                CAknExtendedInputCapabilities* input( NULL );
+                iSelf->iControl->InputCapabilities().ObjectProvider(
+                        )->MopGetObjectNoChaining( input );
+                
+                if ( input )
+                    {
+                    input->ReportEventL(
                         CAknExtendedInputCapabilities::\
-                        MAknEventObserver::EActivatePenInputRequest,
+                            MAknEventObserver::EActivatePenInputRequest,
                         NULL );
+                    }
                 }
             }
+
         if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
             {
             iSimulatedDownEvent = EFalse;
@@ -589,6 +590,7 @@
 */
 void CEikCaptionedControlFormHighlightLine::Draw(const TRect& /*aRect*/) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
     TBool drawn = EFalse;
 
@@ -658,6 +660,7 @@
                 }
             }
         }
+    _AKNTRACE_FUNC_EXIT;
     };
 
 
@@ -698,6 +701,7 @@
 
 TBool CEikCaptionedControlFormHighlightLine::DrawingSkins() const
     {
+    _AKNTRACE_FUNC_ENTER;
     TBool drawingSkins = EFalse;
     if ( AknsUtils::AvkonSkinEnabled() )
         {
@@ -706,17 +710,21 @@
         CWindowGc& gc = SystemGc();
         drawingSkins = AknsDrawUtils::Background( skin, cc, this, gc, Rect(), KAknsDrawParamPrepareOnly ); 
         }
+    _AKNTRACE_FUNC_EXIT;
     return drawingSkins;
     }
 
-EXPORT_C CEikCaptionedControl::CEikCaptionedControl() : iHasAppendedEditIndicator(EFalse)
+EXPORT_C CEikCaptionedControl::CEikCaptionedControl()
     {
+    _AKNTRACE_FUNC_ENTER;
     iNumberOfLines = 1 ;  // default starting value
     AKNTASHOOK_ADD( this, "CEikCaptionedControl" );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C CEikCaptionedControl::~CEikCaptionedControl()
     {
+    _AKNTRACE_FUNC_ENTER;
     AKNTASHOOK_REMOVE();
     AknsUtils::DeregisterControlPosition(this);
     AknsUtils::DeregisterControlPosition(iBitmap);
@@ -734,7 +742,6 @@
     delete iCaptionText;
     delete iCaption;
     delete iTrailer;
-    delete iToolTipText ;
     delete iBitmap ;
     delete iHighlightControl ;
     if ( iExtension )
@@ -749,6 +756,7 @@
   		delete iExtension->iIndicator2;
         }
     delete iExtension ; 
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CEikCaptionedControl::SetPointerEventObserver(MPointerEventObserver *aObserver)
@@ -792,12 +800,14 @@
 
 EXPORT_C TSize CEikCaptionedControl::MinimumSize()
     {
+    _AKNTRACE_FUNC_ENTER;
 // NTBD Add an extra line for those with the label on a separate 
     if ( iIsFormControl )
         {
         if (iControl->IsDimmed())
             {
             iSize = TSize( 0, 0) ; 
+            _AKNTRACE_FUNC_EXIT;
             return iSize;
             }
         // We can get the minimum size from the resource - and the size of the editor (EditorControlSize() in lines)
@@ -872,6 +882,7 @@
         // ------------------------
 
         iSize = layout.Size();
+        _AKNTRACE_FUNC_EXIT;
         return ( iSize ) ;
         }
     else
@@ -939,15 +950,11 @@
             size.iWidth+=KCapCEarWidth+KCapCEarSpacing;
             iCaptionWidth+=KCapCEarWidth+KCapCEarSpacing;
             }
-        size.iHeight+=2*iVertEdgeSpacing;
-        size.iWidth+=iCaptionWidth+2*iHorzEdgeSpacing;
+        size.iWidth+=iCaptionWidth;
         if (iCapCFlags&ESeparatorAfter)
             size.iHeight+=KCapCSeparatorAfterSpace;
-        iMinSize=size;
-
-        if ( iDoNotDisplay )
-            // This flag is set if the control is not to be shown - so set it's height to zero
-            iMinSize.iHeight = 0 ;
+
+        _AKNTRACE_FUNC_EXIT;
        return(size);
         }
     }
@@ -959,6 +966,7 @@
 */
 EXPORT_C void CEikCaptionedControl::SizeChanged()
     {
+    _AKNTRACE_FUNC_ENTER;
     // Resize the animation
     if( iIsFormControl && iExtension->iAnimation )
         {
@@ -1125,6 +1133,7 @@
             mfne->SetSuppressBackgroundDrawing( EFalse );
             }
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1133,14 +1142,13 @@
     if (iCapCFlags&EIfTooSmallDontStrech)
     	return;
     
-    TRect rect=Rect();
-    rect.Shrink(iHorzEdgeSpacing,iVertEdgeSpacing);
+    TRect rect(Rect());
     if (iCapCFlags&ESeparatorAfter)
         rect.iBr.iY-=KCapCSeparatorAfterSpace;
 
     const CFont* editorFont = AknLayoutUtils::FontFromId( iEditorFontId ) ;
 
-    TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels() + ( 2 * iVertEdgeSpacing ) ;
+    TInt normalEditorHeight = editorFont->HeightInPixels() + editorFont->DescentInPixels();
     if ( normalEditorHeight > rect.Height() )
         normalEditorHeight = rect.Height() ;
 
@@ -1148,8 +1156,8 @@
     // Note, if position of caption & bitmap is to be configurable this routine will have to be re structured
     if ( iBitmap )
         {       
-        TPoint bitmapTl = rect.iTl ;
-        TSize bitmapSize = iBitmap->MinimumSize() ;
+        TPoint bitmapTl( rect.iTl );
+        TSize bitmapSize( iBitmap->MinimumSize() );
         if ( bitmapSize.iHeight > normalEditorHeight )
             {
             // reduce the size of the bitmap whilst retaining proportion. (will clip the bitmap methinks)
@@ -1178,9 +1186,6 @@
         }
     rect.iTl.iX+=iCaptionWidth;
 
-    if ((iCapCFlags&EUsesEars) && !(iCapCFlags&ETrailerAfterEar))
-        rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
-
     if (iTrailer)
         {
         TSize trailSize=iTrailer->MinimumSize();
@@ -1191,8 +1196,6 @@
         iTrailer->SetExtent(TPoint(trailPosX,trailPosY),trailSize);
         rect.iBr.iX=trailPosX-KControlTrailerSpacing;
         }
-    if ((iCapCFlags&EUsesEars) && (iCapCFlags&ETrailerAfterEar))
-        rect.iBr.iX-=(KCapCEarWidth+KCapCEarSpacing);
 
     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && rect.Height()>iControl->MinimumSize().iHeight)
         rect.iBr.iY=rect.iTl.iY+iControl->MinimumSize().iHeight;
@@ -1203,26 +1206,6 @@
     }
 
 
-TInt CEikCaptionedControl::WidthForEars(TInt aWidthRemaining) const
-    {
-    TInt earWidth=0;
-    if(iCapCFlags&EUsesEars)
-        {
-        const TInt earAndMarginWidth=KCapCEarWidth+KCapCEarSpacing;
-        if(iTrailer || iCaption)
-            {
-            if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*earAndMarginWidth)
-                earWidth=earAndMarginWidth;
-            else if(aWidthRemaining>(2+(iTrailer?1:0)+(iCaption?1:0))*KCapCEarWidth)
-                earWidth=KCapCEarWidth;
-            }
-        else
-            earWidth=Min(aWidthRemaining/2,earAndMarginWidth);
-        }
-    return earWidth;
-    }
-
-
 void CEikCaptionedControl::SquashComponents()
     {
     TRect rect=Rect();
@@ -1231,14 +1214,14 @@
         rect.iBr.iY-=KCapCSeparatorAfterSpace;
 
     // Space required before the left of the control rect
-    TInt desiredLeft=iHorzEdgeSpacing;
+    TInt desiredLeft=0;
     if(iCaption)
         desiredLeft+=iCaption->MinimumSize().iWidth+KCapCCenterSpacing;
     if ( iBitmap )
         desiredLeft += iBitmap->MinimumSize().iWidth ; // + additional separation?
 
     // Space required after the right of the control rect
-    TInt desiredRight=iHorzEdgeSpacing;
+    TInt desiredRight=0;
     if(iTrailer)
         desiredRight+=iTrailer->MinimumSize().iWidth+KControlTrailerSpacing;
     
@@ -1258,10 +1241,6 @@
         widthRemaining-=controlWidth;
         }
     
-    // Decide if there is space for ears with margins, ears only, or no ears.
-    TInt earWidth=WidthForEars(widthRemaining);
-    widthRemaining-=2*earWidth;
-    
     // Space assigned for before the left of the control rect
     TInt actualLeft=0;
     actualLeft=ScaledSubLength(widthRemaining,desiredLeft,desiredLeft+desiredRight);
@@ -1296,9 +1275,8 @@
         if (iCapCFlags&EExtraAscent)
             rect.iTl.iY+=KCapCExtraAscent;
         
-        if(actualLeft>2*(KCapCCenterSpacing+iHorzEdgeSpacing))
+        if(actualLeft>2*(KCapCCenterSpacing))
                 {
-                captionRect.iTl.iX+=iHorzEdgeSpacing;
                 captionRect.iBr.iX-=KCapCCenterSpacing;
                 }
         const TSize capMin=iCaption->MinimumSize();
@@ -1311,30 +1289,15 @@
         {
         TInt leftAdjust=0;
         TInt rightAdjust=0;
-        TRect trailerRect=rect;
-        trailerRect.iTl.iX+=actualLeft+controlWidth+(iCapCFlags&EUsesEars ? earWidth : 0);
+        TRect trailerRect(rect);
+        trailerRect.iTl.iX+=actualLeft+controlWidth;
         trailerRect.iTl.iY+=KTrailCVertCaptionOffset;
 
-        if(actualRight>2*(iHorzEdgeSpacing+KControlTrailerSpacing))
+        if(actualRight>2*(KControlTrailerSpacing))
             {
-            if(iCapCFlags&ETrailerAfterEar)
-                {
-                leftAdjust=KControlTrailerSpacing+earWidth;
-                rightAdjust=iHorzEdgeSpacing;
-                }
-            else
-                {
-                rightAdjust=earWidth+iHorzEdgeSpacing;
-                leftAdjust=KControlTrailerSpacing;
-                }
+            leftAdjust=KControlTrailerSpacing;
             }
-        else
-            {
-            if(iCapCFlags&ETrailerAfterEar)
-                leftAdjust=earWidth;
-            else
-                rightAdjust=earWidth;
-            }
+
         trailerRect.iTl.iX+=leftAdjust;
         trailerRect.iBr.iX-=rightAdjust;
         iTrailer->SetExtent(trailerRect.iTl,TSize(trailerRect.Width(),
@@ -1342,16 +1305,14 @@
         }
     // Position and set the controls space
     TRect controlRect=rect;
-    controlRect.iTl.iX+=actualLeft+earWidth;
-    controlRect.iBr.iX-=(actualRight+earWidth);
+    controlRect.iTl.iX+=actualLeft;
+    controlRect.iBr.iX-=actualRight;
     if(iCapCFlags&EIfTooBigCtlStaysMinHeight && controlRect.Height()>iControl->MinimumSize().iHeight)
         controlRect.iBr.iY=controlRect.iTl.iY+iControl->MinimumSize().iHeight;
     iControl->SetRect(controlRect);
-    
     }
 
 
-
 /**
  * Sets the flags, aFlags, (see TSpaceSharingFlags), which determine
  * the way space is distributed if the captioned control is given too
@@ -1366,6 +1327,7 @@
 
 static TInt IdleCallback(TAny *aAny)
 {
+	_AKNTRACE_FUNC_ENTER;
 	CIdleCallbackData *data = (CIdleCallbackData*)aAny;
 	CEikCapCExtension *ext = data->iExt;
 	CEikCaptionedControl *ctrl = data->iCtrl;
@@ -1378,29 +1340,36 @@
 	ext->iIdle = NULL;
 	delete data;
 	ext->iIdleData = NULL;
+	_AKNTRACE_FUNC_EXIT;
 	return EFalse;	
 }
 
-void CEikCaptionedControl::ScrollBackEditor()
-{
-        //
-		// For long single-line edwin, scroll horizontally to show beginning of the edwin
-		// when focus changes away from the edwin.
-		// 
-      	if ( iIsEditable && ControlIsAnEdwin(iControlType) )
-			{
-			delete iExtension->iIdle;
-			delete iExtension->iIdleData;
-			iExtension->iIdleData = new (ELeave) CIdleCallbackData;
-			iExtension->iIdleData->iCtrl = this;
-			iExtension->iIdleData->iExt = iExtension;
-			iExtension->iIdle = CIdle::NewL(0);
-			iExtension->iIdle->Start(TCallBack(&IdleCallback, iExtension->iIdleData));
-			}	
-}
+void CEikCaptionedControl::ScrollBackEditorL()
+    {
+    _AKNTRACE_FUNC_ENTER;
+    //
+    // For long single-line edwin, scroll horizontally to show beginning
+    // of the edwin when focus changes away from the edwin.
+    // 
+    if ( iIsEditable && ControlIsAnEdwin( iControlType ) )
+        {
+        delete iExtension->iIdle;
+        iExtension->iIdle = NULL;
+        delete iExtension->iIdleData;
+        iExtension->iIdleData = NULL;
+        iExtension->iIdleData = new (ELeave) CIdleCallbackData;
+        iExtension->iIdleData->iCtrl = this;
+        iExtension->iIdleData->iExt = iExtension;
+        iExtension->iIdle = CIdle::NewL( 0 );
+        iExtension->iIdle->Start(
+            TCallBack( &IdleCallback, iExtension->iIdleData ) );
+        }
+    _AKNTRACE_FUNC_EXIT;
+    }
 
 EXPORT_C void CEikCaptionedControl::FocusChanged(TDrawNow aDrawNow)
     {    
+    _AKNTRACE_FUNC_ENTER;
     // Only form controls need to adapt animation to focus changes.
     if( iExtension->iAnimation && iIsFormControl )
         {
@@ -1411,7 +1380,7 @@
             }
         else if( iIsCurrentLine && !iIsEditable ) // Current and in view mode
             {
-            CAknAppUi* aui = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
+            CAknAppUi* aui = static_cast<CAknAppUi*>(iEikonEnv->AppUi());
             if( aui->IsForeground() )
                 {
                 iExtension->iAnimation->Play();
@@ -1477,38 +1446,10 @@
             iCaption->SetEmphasis(emphasis);
             }
         }
-    
-
-    if (aDrawNow && iCapCFlags&EUsesEars && IsReadyToDraw())
-        DrawEarsNow(EBothEars);
-    }
-
-
-
-void CEikCaptionedControl::DrawEarsNow(TWhichEars aEar) const
-    {
-    ActivateGc();
-    DrawEars(aEar);
-    DeactivateGc();
+
+    _AKNTRACE_FUNC_EXIT;
     }
 
-void CEikCaptionedControl::DrawEars(TWhichEars aEar) const
-    {
-    if (aEar&ELeftEar)
-        DrawSingleEar(ELeftEar,iCapCFlags&ELeftEarDown);
-    if (aEar&ERightEar)
-        DrawSingleEar(ERightEar,iCapCFlags&ERightEarDown);
-    }
-
-void CEikCaptionedControl::DrawSingleEar(TWhichEars /*aEar*/,TBool /*aPressed*/) const
-    {
-    // not needed in S60
-    }
-
-TRect CEikCaptionedControl::EarRect(TWhichEars /*aEar*/) const
-    {
-    return(TRect(0,0,0,0)); // not needed in S60
-    }
 
 EXPORT_C TInt CEikCaptionedControl::CountComponentControls() const
     {
@@ -1557,23 +1498,20 @@
 
 EXPORT_C void CEikCaptionedControl::Draw(const TRect& aRect) const
     {   
+    _AKNTRACE_FUNC_ENTER;
     if (iIsFormControl )
         DrawAsForm( aRect );
     else
         DrawAsEikonDialog( aRect );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 void CEikCaptionedControl::DrawAsForm( const TRect& aRect ) const
     {
-
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
 
     gc.SetPenStyle(CGraphicsContext::ENullPen);
-    if ( iRefresh )
-        {
-        gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
-        gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
-        }
 
     if ( iCaption )
         {
@@ -1609,20 +1547,16 @@
         DrawAsFormInViewMode( aRect );
     else
         DrawAsFormUnFocusedLine( aRect );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 void CEikCaptionedControl::DrawAsFormInEditMode( const TRect& /*aRect*/ ) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
 
     gc.SetPenStyle(CGraphicsContext::ENullPen);
 
-    if ( iRefresh )
-        {
-        gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
-        gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
-        }
-
     if (iDialogPage&& iHighlightControl)
         {
         TInt height(Rect().Height());
@@ -1684,23 +1618,19 @@
     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
     gc.SetPenColor( line2Rect.Color() ) ;   
     gc.DrawRect(line2Rect.Rect());
+    _AKNTRACE_FUNC_EXIT;
     }
 
 
 void CEikCaptionedControl::DrawAsFormInViewMode( const TRect& /*aRect*/ ) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
 
     gc.SetPenStyle(CGraphicsContext::ENullPen);
 
-    if ( iRefresh )
-        {
-        gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
-        gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
-        }
-
     // This gives the correct Rect for using the Layout functions
-    TRect viewRect=ViewRect(); 
+    TRect viewRect( Rect() ); 
 
     TAknLayoutRect line1Rect;
     line1Rect.LayoutRect( viewRect, AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_1 (viewRect) );
@@ -1749,21 +1679,15 @@
 
     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iBr.iY-1),
         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
+    _AKNTRACE_FUNC_EXIT;
     }
     
 void CEikCaptionedControl::DrawAsFormUnFocusedLine( const TRect& /*aRect*/ ) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
 
     gc.SetPenStyle(CGraphicsContext::ENullPen);
-
-    if ( iRefresh )
-        {
-        gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
-        gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
-        }
-
-    gc.SetPenStyle(CGraphicsContext::ENullPen);
     gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
     gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;  
 
@@ -1780,7 +1704,6 @@
     gc.SetBrushStyle( CGraphicsContext::ENullBrush ) ;
     gc.DrawLine(TPoint(iVerticalLineXPosition,Rect().iTl.iY),
         TPoint(iVerticalLineXPosition,Rect().iBr.iY+1));
-    // CEikCaptionedControl* visibleBelow=0; (NOT USED)
 
     if (iDialogPage) 
         {
@@ -1791,6 +1714,7 @@
         if (HasSeparator() && !atTopOfPage)
             DrawFormSeparator( gc );
         }
+    _AKNTRACE_FUNC_EXIT;
     } 
 
 
@@ -1800,14 +1724,14 @@
 //
 TAknsQsnTextColorsIndex CEikCaptionedControl::TextColorIndex() const
     {
-    TAknsQsnTextColorsIndex colorIndex = EAknsCIQsnTextColorsCG8;
+    TAknsQsnTextColorsIndex colorIndex = EAknsCIQsnTextColorsCG6;
 
     // Note control doesn't use highlight text color
     if ( iControlType != EAknCtNote )
         {
         if ( iIsCurrentLine && iDialogPage->HighlightVisible() )
             {
-            colorIndex = EAknsCIQsnTextColorsCG10;
+            colorIndex = EAknsCIQsnTextColorsCG8;
             }
         }
     
@@ -1815,24 +1739,15 @@
     }
 
 
-void CEikCaptionedControl::DrawAsEikonDialog( const TRect& aRect ) const
+void CEikCaptionedControl::DrawAsEikonDialog( const TRect& /*aRect*/ ) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CWindowGc& gc=SystemGc();
     gc.SetPenStyle(CGraphicsContext::ENullPen);
 
     if (iHighlightControl)
         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->SetTopOrBottom(CEikCaptionedControlFormHighlightLine::EUnset);
 
-    if ( iRefresh )
-        {
-        gc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
-        gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ) ;
-        }
-
-
-    TRect redrawRect=Rect();
-    redrawRect.Intersection(aRect);
-
     /*
     *
     * FIX TSW JTON-6HGAND - see also eikdpage.cpp
@@ -1843,19 +1758,17 @@
     * Most likely other places using gc.Clear() ( or gc.DrawRect() as 'clear'
     * should be fixed also.
     */
-    
     if (iCapCFlags&ESeparatorAfter)
         {
         TRect rect(Rect());
-        TPoint separatorStartPt(rect.iTl.iX+iHorzEdgeSpacing/2,rect.iBr.iY-1);
-        TPoint separatorEndPt(separatorStartPt.iX+(iFullWidth-iHorzEdgeSpacing), separatorStartPt.iY);
+        TPoint separatorStartPt(rect.iTl.iX,rect.iBr.iY-1);
+        TPoint separatorEndPt(separatorStartPt.iX, separatorStartPt.iY);
         gc.SetPenStyle(CGraphicsContext::ESolidPen);
         gc.SetPenColor(iEikonEnv->ControlColor(EColorWindowText, *this));
         gc.DrawLine(separatorStartPt, separatorEndPt);
-        };
-
-    if (iCapCFlags&EUsesEars)
-        DrawEars(EBothEars); 
+        }
+
+    _AKNTRACE_FUNC_EXIT;
     }
 
 /*
@@ -1869,15 +1782,18 @@
 
 EXPORT_C TKeyResponse CEikCaptionedControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
     {
+    _AKNTRACE_FUNC_ENTER;
     if ( !iIsFormControl) 
         return iControl->OfferKeyEventL(aKeyEvent,aType);
     else if ( iIsFormControl && iIsEditable )
         {
         TKeyResponse retVal ;
         retVal = iControl->OfferKeyEventL( aKeyEvent, aType ) ;
+        _AKNTRACE_FUNC_EXIT;
         return retVal ;
         }
     else
+        _AKNTRACE_FUNC_EXIT;
         return EKeyWasNotConsumed ;
     }
 
@@ -1888,6 +1804,7 @@
 
 EXPORT_C void CEikCaptionedControl::SetDimmed(TBool aDimmed)
     {
+    _AKNTRACE_FUNC_ENTER;
     CCoeControl::SetDimmed(aDimmed);
     if (iControl && iControl->IsVisible())
         {
@@ -1901,6 +1818,7 @@
         {
         iTrailer->SetDimmed(aDimmed);
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void* CEikCaptionedControl::ExtensionInterface( TUid /*aInterface*/ )
@@ -1910,98 +1828,75 @@
 
 EXPORT_C void CEikCaptionedControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
     {
-    if (!IsNonFocusing())
+    _AKNTRACE_FUNC_ENTER;
+    TBool edwinControl( ControlIsAnEdwin( iControlType ) );
+    
+     if ( iIsFormControl )
         {
-        TWhichEars ear=ENoEar;
-        if (aPointerEvent.iType!=TPointerEvent::EButton1Down)
+        if ( !PressedDownState() &&
+             aPointerEvent.iType == TPointerEvent::EButton1Down )
+            {
+            SetPressedDownState( ETrue );
+            DrawDeferred();
+            }
+        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
             {
-            if (iCapCFlags&ELeftEarGrab)
-                ear=ELeftEar;
-            else if (iCapCFlags&ERightEarGrab)
-                ear=ERightEar;
-            if (ear)
+            _AKNTRACE( "TPointerEvent::EButton1Up" );
+            SetPressedDownState( EFalse );
+            DrawDeferred();
+            }
+        
+        if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down || 
+               aPointerEvent.iType == TPointerEvent::EButton1Up ) &&
+             iIsEditable &&
+             edwinControl &&
+             iExtension &&
+             iExtension->iFeedback &&
+             iControl->Rect().Contains( aPointerEvent.iPosition ) )
+            {
+            CEikEdwin* edwin = static_cast<CEikEdwin*>( iControl );
+            if ( edwin &&
+                 ( edwin->UserFlags() & CEikEdwin::EDisplayOnly ||
+                   edwin->IsReadOnly() ) )
                 {
-                TInt oldDrawFlags=iCapCFlags&(ELeftEarDown|ERightEarDown);
-                if (aPointerEvent.iType==TPointerEvent::EButton1Up)
-                    iCapCFlags&=(~KDynamicEarMask);
+                // For edwins in view only mode we must produce the feedback
+                // here, as the edwin itself doesn't.
+                if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+                    {
+                    iExtension->iFeedback->InstantFeedback( iControl,
+                                                            ETouchFeedbackList );
+                    }
                 else
                     {
-                    iCapCFlags&=(~(ELeftEarDown|ERightEarDown));
-                    if (EarRect(ear).Contains(aPointerEvent.iPosition))
-                        {
-                        FireEarL(ear, KCapCEarRepeat);
-                        return;
-                        }
+                    iExtension->iFeedback->InstantFeedback( iControl,
+                                                            ETouchFeedbackList,
+                                                            ETouchFeedbackVibra,
+                                                            aPointerEvent );
                     }
-                if (oldDrawFlags!=(iCapCFlags&(ELeftEarDown|ERightEarDown)))
-                    DrawEarsNow(ear);
-                return;
-                }
-            }
-        else if (iCapCFlags&EUsesEars)
-            {
-            iCapCFlags&=(~KDynamicEarMask);
-            if (EarRect(ELeftEar).Contains(aPointerEvent.iPosition))
-                ear=ELeftEar;
-            else if (EarRect(ERightEar).Contains(aPointerEvent.iPosition))
-                ear=ERightEar;
-            if (ear)
-                {
-                FireEarL(ear, KCapCInitialEarRepeat);
-                return;
                 }
             }
         }
-     if (iIsFormControl)
-        {
-        if ( PressedDownState()&&
-            aPointerEvent.iType == TPointerEvent::EButton1Down )
-            {
-            SetPressedDownState( ETrue );
-            DrawDeferred();    
-            }
-        else if(aPointerEvent.iType == TPointerEvent::EButton1Up)
-            {
-            SetPressedDownState( EFalse );
-            DrawDeferred();
-            }       
-        }
     
-    if ( !iIsEditable && (ControlIsAnEdwin(iControlType) || ControlIsAMfne(iControlType))
+    if ( !iIsEditable && ( edwinControl || ControlIsAMfne( iControlType ) )
        &&( iDialogPage && CEikDialogPage::EDouble == iDialogPage->FormLayout() ))
         {
+        _AKNTRACE_FUNC_EXIT;
 		return;
         }
 
     CCoeControl::HandlePointerEventL(aPointerEvent);    
      
-    if ( iExtension )
+    if ( iExtension && iIsFormControl )
         {
         iExtension->SimulatePointerEventToControlL( aPointerEvent );
         }
     }
 
-void CEikCaptionedControl::FireEarL(TWhichEars aEar, TInt aEarRepeat)
-    {
-    Window().RequestPointerRepeatEvent(aEarRepeat, EarRect(aEar));
-    TKeyEvent key;
-    key.iModifiers=0;
-    if (aEar==ELeftEar)
-        {
-        key.iCode=EKeyLeftArrow;
-        iCapCFlags|=ELeftEarDown|ELeftEarGrab;
-        }
-    else
-        {
-        key.iCode=EKeyRightArrow;
-        iCapCFlags|=ERightEarDown|ERightEarGrab;
-        }
-    DrawEarsNow(aEar);
-    iControl->OfferKeyEventL(key,EEventKey);
-    }
 
 EXPORT_C void CEikCaptionedControl::SetCaptionL(const TDesC& aText)
     {
+    _AKNTRACE_FUNC_ENTER;
+    _AKNTRACE("aText = %s", &aText);    
     ConstructExtensionL() ; // One of several places where this is made
     if (!iCaption)
         {
@@ -2014,7 +1909,7 @@
         iCaptionText = aText.AllocL();
         }
         
-    if (iCaption->DrawableWindow() == NULL)    
+    if (!iCaption->DrawableWindow())    
         {
         iCaption->SetContainerWindowL(*this);
         iCaption->CopyControlContextFrom(this);
@@ -2028,6 +1923,7 @@
         DoFormCaptionSettingsL(aText);
     else
         iCaption->SetTextL(aText);
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CEikCaptionedControl::SetDrawNoWhiteBackground(TBool aEnabled)
@@ -2037,6 +1933,7 @@
 
 EXPORT_C void CEikCaptionedControl::SetTrailerL(const TDesC& aText)
     {
+    _AKNTRACE_FUNC_ENTER;
     if (!aText.Length())
         return;
     if (!iTrailer)
@@ -2049,6 +1946,8 @@
         iTrailer->SetNonFocusing();
         }
     iTrailer->SetTextL(aText);
+    _AKNTRACE( "SetTextL = %s" , &aText); 
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CEikCaptionedControl::SetCurrent(TBool aSelected)
@@ -2058,6 +1957,7 @@
 
 EXPORT_C void CEikCaptionedControl::ConstructFromResourceL(TResourceReader& aReader)
     {
+    _AKNTRACE_FUNC_ENTER;
     TPtrC capTextTPtrC = aReader.ReadTPtrC();
     iCaptionText = capTextTPtrC.AllocL();
     SetCaptionL(capTextTPtrC);
@@ -2124,10 +2024,6 @@
     TPtrC16 toolTip = aReader.ReadTPtrC() ;
     SetToolTipTextL( toolTip ) ; 
     
-    // Set the border spacing to the default value
-    SetVertEdgeSpacing( KCapCDefaultVertEdgeSpacing ) ;
-    SetHorzEdgeSpacing( KCapCDefaultHorzEdgeSpacing ) ;
-
     //Added to create new form box closer for edwins in forms.
     if (!iHighlightControl)
         {
@@ -2135,6 +2031,7 @@
         STATIC_CAST(CEikCaptionedControlFormHighlightLine*,iHighlightControl)->ConstructL() ;
         }
     ConstructExtensionL() ;
+    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2177,9 +2074,9 @@
 
 EXPORT_C void CEikCaptionedControl::ResetMinimumSizes()
     {
-    iMinSize.iWidth=0;
+	_AKNTRACE_FUNC_ENTER;
     iCaptionWidth=0;
-    iFullWidth=0;
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C TBool CEikCaptionedControl::IsLatent() const
@@ -2264,6 +2161,7 @@
  */
 EXPORT_C void CEikCaptionedControl::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
     {
+    _AKNTRACE_FUNC_ENTER;
     CCoeControl::GetColorUseListL(aColorUseList);
 
     TCoeColorUse colorUse;
@@ -2274,6 +2172,7 @@
     const TInt count=CountComponentControls();
     for(TInt ii=0;ii<count;ii++)
         ComponentControl(ii)->GetColorUseListL(aColorUseList);  
+    _AKNTRACE_FUNC_EXIT;
     }
 
 /**
@@ -2284,6 +2183,8 @@
  */
 EXPORT_C void CEikCaptionedControl::HandleResourceChange(TInt aType)
     {
+    _AKNTRACE_FUNC_ENTER;
+    _AKNTRACE( "[%s][%s][%d].", "CEikCaptionedControl", __FUNCTION__, aType );
     CCoeControl::HandleResourceChange(aType);
 
     // Animation is skin dependent, whenever skin changes animation changes
@@ -2307,6 +2208,7 @@
             }
         DrawDeferred();
         }
+    _AKNTRACE_FUNC_EXIT;
    }
 
 
@@ -2319,10 +2221,7 @@
 
 EXPORT_C const TDesC* CEikCaptionedControl::ToolTipText() const 
     {
-    if ( iToolTipText )
-        return  iToolTipText ;
-    else
-        return NULL ;
+    return NULL ;
     }
 
 /**
@@ -2382,6 +2281,8 @@
 
 EXPORT_C void CEikCaptionedControl::SetEditableL( TBool aEditable, TBool /*aShowEmptyFields*/ )
     {
+    _AKNTRACE_FUNC_ENTER;
+    _AKNTRACE( "CEikCaptionedControl::SetEditableL() aEditable: [%d]", aEditable );
     // Construct extension object if needed
     ConstructExtensionL() ;
 
@@ -2456,16 +2357,7 @@
 		if (IsReadyToDraw())
 			SizeChanged(); // needed because layout lines change when editable flag is switched.
         }
-    }
-
-void CEikCaptionedControl::SetVertEdgeSpacing( TInt aVertEdgeSpacing ) 
-    {
-    iVertEdgeSpacing = aVertEdgeSpacing ;
-    }
-
-void CEikCaptionedControl::SetHorzEdgeSpacing( TInt aHorzEdgeSpacing ) 
-    {
-    iHorzEdgeSpacing = aHorzEdgeSpacing ;
+    _AKNTRACE_FUNC_EXIT;
     }
 
 /**
@@ -2474,19 +2366,16 @@
 
 void CEikCaptionedControl::PositionFormComponents()
     {
-    if( iExtension->iPartiallyVisible )
+    _AKNTRACE_FUNC_ENTER;
+    MinimumSize() ;
+
+    // if control has no height, return now (no point laying out)
+    if (!Rect().Height())  
         return;
+
     TBool isFocused = iIsCurrentLine;
     TBool isSingleLineLayout = ( FormLayout() == CEikDialogPage::ESingle);
-    MinimumSize() ;
     TBool hasBitmaps = ShowBitmap();
-    
-/* 
-if control has no height, return now (no point laying out)
-*/
-    if (!Rect().Height())  
-        return;
-
     TAknWindowLineLayout verticalLine = AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_1 ; 
 
     // If double line layout update verticalLine
@@ -2515,11 +2404,10 @@
                 }
             }    
         }
-        TRect parentRect = Rect();
-        TAknLayoutRect layoutRect;
-        layoutRect.LayoutRect( parentRect, verticalLine );
-        TRect rectVerticalLine( layoutRect.Rect() );
-
+
+    TAknLayoutRect layoutRect;
+    layoutRect.LayoutRect( Rect(), verticalLine );
+    TRect rectVerticalLine( layoutRect.Rect() );
 
     // set vertical line position.  
     if ( AknLayoutUtils::LayoutMirrored() )
@@ -2550,12 +2438,10 @@
 "none of the above".
 */
         Panic(EEikFormPanicUnknownControlType);
-        };
-
-    //TRect layoutRectOfDataPane =(iIsEditable)? EditRect() : ViewRect();
+        }
 
    //view and edit data pane rect should be the same
-    TRect layoutRectOfDataPane = ViewRect();    
+    TRect layoutRectOfDataPane( Rect() );    
 
     if ( hasBitmaps )
         {
@@ -2698,6 +2584,7 @@
         }
         
     TRAP_IGNORE( SetElementTextColorsL(TRgb()));
+    _AKNTRACE_FUNC_EXIT;
     }
 
 TBool CEikCaptionedControl::ShowBitmap() const
@@ -2729,27 +2616,17 @@
         }
     }
 
-TSize CEikCaptionedControl::EditorControlSize() const 
-    {
-    return iEditorControlSize ;
-    }
-
 TInt CEikCaptionedControl::NumberOfLines() const
 	{
 	return iNumberOfLines;
 	}
 
-TInt CEikCaptionedControl::NumberOfLinesForScrollBar() const
-	{
-	if ( FormLayout() == CEikDialogPage::ESingle ) return NumberOfLines();
-	return NumberOfLines()+1;
-	}
-
 /**
  * Recalculates the number of required lines for a control.
  */
 void CEikCaptionedControl::CalculateNumberOfLinesForControl( TInt aLines )
     {
+	_AKNTRACE_FUNC_ENTER;
     // NB if new control types are added, ones which should be invisible in view mode
     // should be also added to IsDisplayable().
     if ( aLines == ENotSupplied )
@@ -2805,6 +2682,8 @@
             }
         }
     iNumberOfLines = aLines ;
+    _AKNTRACE( "iNumberOfLines: [%d]", iNumberOfLines );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CEikCaptionedControl::SetFormFlags( TInt aFlags ) 
@@ -2843,26 +2722,8 @@
         {
         AknLayoutUtils::OverrideControlColorL(*this, EColorControlText, textColor );
         }
-    
     }
 
-/**
- * Retrieves the Series 60 European LAF layout values from avkon.rh
- *
- */
-void CEikCaptionedControl::GetAknLayoutValuesL()
-    {
-    TAknWindowLineLayout l = AknLayoutScalable_Avkon::form_field_data_pane(0).LayoutLine();
-    TRect parentRect = iAvkonAppUi->ClientRect();
-    TAknLayoutRect layoutRect;
-    layoutRect.LayoutRect( parentRect, l );
-    TRect rectDataPane( layoutRect.Rect() );
-
-    iAknFormControlWidth = rectDataPane.Width();
-    iAknFormControlHeight = rectDataPane.Height();
-   }
-
-    
 
 TBool   CEikCaptionedControl::IsDisplayable() const
     {
@@ -2929,9 +2790,12 @@
         case EAknCtUnitEditor:
             return ETrue;
         }
-    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
-    if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived)
-        return ETrue;
+    if (iDialogPage)
+        {
+	    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
+        if (typeOfControlToLayout==MEikDialogPageObserver::EMfneDerived)
+            return ETrue;
+        }
     return EFalse;
     }
 
@@ -2964,9 +2828,12 @@
         case EAknCtNumericSecretEditor:
             return ETrue;
         }
-    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
-    if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived)
-        return ETrue;
+    if (iDialogPage)
+        {
+        TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
+        if (typeOfControlToLayout==MEikDialogPageObserver::ESecretEditorDerived)
+            return ETrue;
+        }
     return EFalse;
     }
 
@@ -2979,9 +2846,12 @@
         case EAknCtSlider :
             return ETrue;
         }
-    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
-    if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived)
-        return ETrue;
+    if (iDialogPage)
+        {
+        TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
+        if (typeOfControlToLayout==MEikDialogPageObserver::ESliderDerived)
+            return ETrue;
+        }
     return EFalse;
     }
 
@@ -3000,9 +2870,12 @@
         case EAknCtColourSelectionDialogNoneField:
             return ETrue;
         }
-    TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
-    if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived)
-        return ETrue;
+    if (iDialogPage)
+        {
+        TInt typeOfControlToLayout=iDialogPage->PageContainer()->PageSelector()->Dialg()->ConvertCustomControlTypeToBaseControlType(iControlType);
+        if (typeOfControlToLayout==MEikDialogPageObserver::EColourSelectionGridDerived)
+            return ETrue;
+        }
     return EFalse;
     }  
  
@@ -3019,15 +2892,16 @@
 EXPORT_C const TPtrC CEikCaptionedControl::GetFullCaptionText() const
     {
     return *iCaptionText;
-    };
+    }
 
 void CEikCaptionedControl::RegisterPageWithCaptionControl(CEikDialogPage* aPage)
     {
     iDialogPage=aPage;
-    };
+    }
 
 TInt CEikCaptionedControl::MaximumNumberOfControlLinesOnVisiblePage() const
     {
+	_AKNTRACE_FUNC_ENTER;
 	TInt maxItems = 0;
 	TAknLayoutScalableParameterLimits paneLimits;
 	if (IsPopupField(this))
@@ -3070,38 +2944,11 @@
             return defineHeight;
         }
 	//maxItems -= 1; // TODO: this is a temporary workaround for layout data being incorrect, it has too many options available
+    _AKNTRACE( "maxItems: [%d]", maxItems );
+    _AKNTRACE_FUNC_EXIT;
     return maxItems;
-    };
-
-
-TRect CEikCaptionedControl::ViewRect() const
-
-    {
-/* 
-The Rect that the view mode is expecting is:
-176 across 
-21 high
-set from 0,0
-
-We are
-174 across
-23 high
-set from (1,1) relative to viewwin.
-
-To convert we must:
-* Shrink(-1,1) to make Y cord and size equal, and X coord equal.
-* add 1 to the BR X coord. to make X size equal.
-*/
-    TRect viewRectConversion(EditRect());
-    viewRectConversion.Shrink(0,1);
-    return viewRectConversion;
     }
 
-TRect CEikCaptionedControl::EditRect() const
-    {
-    //The Rect provided by Rect() is fine  
-    return Rect();
-    } 
 
 void CEikCaptionedControl::FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines)
     {   
@@ -3251,8 +3098,7 @@
     	SetScrollRect(aEdwin, layoutRect, textLayout, aNumberOfLines);
 	    }
 
-	TBool isviewmode = !aIsEditable;
-	aEdwin->SetSuppressBackgroundDrawing(isviewmode);
+	aEdwin->SetSuppressBackgroundDrawing(!aIsEditable);
     }
 
 
@@ -3275,11 +3121,7 @@
     // Layout the label for the single line format
     if (aSingleLayout) 
         {
-        if (aIsEditable)
-            {
-            // Do nothing; this is the default used
-            }
-        else
+        if (!aIsEditable)
             {
             // This layout is dy
             if (aBitmapPresent)
@@ -3422,7 +3264,7 @@
         TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent,
         TBool /*aIsFocused*/)
     {
-    TRect layoutRect = aParent;
+    TRect layoutRect( aParent );
     TAknWindowLineLayout layoutData(AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1));
 	TAknTextLineLayout labelLayout(AknLayout::Form_data_field_texts_Line_2(0));
     if (!aNumberOfLines)
@@ -3445,65 +3287,32 @@
 		{
 		isText = ETrue;
 		}
- 
+	
     if (aSingleLayout)
         {
-        if (aIsEditable)
-            {
-            layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
-            }
-        else
-            {
-/* 
-popupfields not specified in lists.  
-Have to convert aParent to form equivalent and use that layout.
-*/
-            ConvertViewRectToEditRect(layoutRect);
-            layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
-            }
+        layoutData=AKN_LAYOUT_WINDOW_list_form_pane(aNumberOfLines-1);
         }
     else  // double layout
         {
         TInt newpar = ( aBitmapPresent ? 1 : 0 ) ;
-        if (!aBitmapPresent)
-            {
-            if (aIsEditable)
-                {
-                layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
-                }
-            else
-                {
-                // have to convert Rect before doing this.
-                ConvertViewRectToEditRect(layoutRect);
-                layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
-                }
-            }
-        else //AKN_LAYOUT_WINDOW_list_form_graphic_wide_pane
+        layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
+
+        if ( aBitmapPresent && !aIsEditable )
             {
-            if (aIsEditable)
-                {
-                layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
-                }
-            else
-                {
-                // have to convert Rect before doing this.
-                ConvertViewRectToEditRect(layoutRect);
-                layoutData=AKN_LAYOUT_WINDOW_list_form_wide_pane(newpar, aNumberOfLines-1);
-				//move bitmap's width for display second line text
-		        TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
-		        TAknLayoutRect bmpRect;
-		        TRect tempRect;
-		        bmpRect.LayoutRect( tempRect, l );
-				layoutRect.iTl.iX += bmpRect.Rect().Width();
-                }
+            //move bitmap's width for display second line text
+            TAknWindowLineLayout l = AknLayout::List_pane_elements__single_graphic_heading__Line_1();
+            TAknLayoutRect bmpRect;
+            TRect tempRect;
+            bmpRect.LayoutRect( tempRect, l );
+            layoutRect.iTl.iX += bmpRect.Rect().Width();
             }
-        };
+        }
 	aPopfield->SetFormFieldRect(layoutRect);
 	if (isText)
 		{ // popup field will be same size as text element
 		TAknLayoutText r;
 		r.LayoutText(layoutRect, labelLayout);
-		TRect resultRect = r.TextRect();
+		TRect resultRect( r.TextRect() );
 		aPopfield->SetRect(resultRect);
 		}
 	else
@@ -3528,7 +3337,6 @@
             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *aPopfield, EColorLabelText, textColor ) ); 
             }          
         }
-        
     }
 
 // Password editor
@@ -3600,61 +3408,26 @@
     {   
     if (!aNumberOfLines)
         return;
-    if (aSingleLayout)
-        {
-        if (aIsEditable)
-            {
-            aSlider->SetRect(aParent);
-            }
-        else
-            {
-/* 
-sliders not specified in lists.  
-Have to convert aParent to form equivalent and use that layout.
-*/
-            TRect conversionRect(aParent);
-            ConvertViewRectToEditRect(conversionRect);
-            aSlider->SetRect(conversionRect);
-            }
-        }
-    else 
+    
+    TRect parentRect( aParent );
+    
+    if ( !aSingleLayout )
         {
         // Not currently specified, so making temporary alterations here.
-        TInt baselineSkip= AKN_LAYOUT_MULTILINE_TEXT_Form_data_field_texts_Line_2(1).BaselineSkip();
-        TRect newParentRect(aParent);
-        //Only move the rect will cover a part or next dialogline, so decrease height of rect form iTl.
+        TInt baselineSkip = AKN_LAYOUT_MULTILINE_TEXT_Form_data_field_texts_Line_2(1).BaselineSkip();
+
+        // Only move the rect will cover a part or next dialogline, so decrease height of rect form iTl.
         if( !aIsEditable )
 	        {
-	        newParentRect.iTl.iX += baselineSkip;          	
+            parentRect.iTl.iX += baselineSkip;          	
 	        }
-        newParentRect.iTl.iY += baselineSkip;
-            
-        if (aIsEditable)
-            {
-            aSlider->SetRect(newParentRect);
-            }
-        else 
-            {
-            TRect conversionRect(newParentRect);
-            ConvertViewRectToEditRect(conversionRect);
-            aSlider->SetRect(conversionRect);
-            }
-        }   
-
-        // Exteded skin support for sliders coded in slider file: \s60\AvKon\src\Aknslider.cpp
+        
+        parentRect.iTl.iY += baselineSkip;
+        }
+    
+    aSlider->SetRect( parentRect );
     }
 
-void CEikCaptionedControl::ConvertViewRectToEditRect(TRect& aRect)
-    {
-    aRect.Grow(-1,1);
-    aRect.iBr.iX--;
-    }
-
-void CEikCaptionedControl::ConvertEditRectToViewRect(TRect& aRect)
-    {
-    aRect.Shrink(-1,1);
-    aRect.iBr.iX++;
-    }
 
 // Standard access method for the form layout from within captioned control
 CEikDialogPage::TFormLayoutSelection CEikCaptionedControl::FormLayout() const
@@ -3662,12 +3435,12 @@
     // There is no undefined style, but initialize to single...
     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
     if ( iDialogPage )
+        {
         ret = iDialogPage->FormLayout();
-    
-    if (!iDialogPage)
+        }
+    else if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
         {
-        if (iFlags & EEikFormUseDoubleSpacedFormat) // similar to CEikDialogPage::ConstructFormFromResourceL()
-            ret = CEikDialogPage::EDouble;
+        ret = CEikDialogPage::EDouble;
         }
     return ret;
     }
@@ -3679,23 +3452,11 @@
         {
         sepLineRect.LayoutRect
             (
-            ViewRect(), 
+            Rect(), 
             AKN_LAYOUT_WINDOW_List_pane_elements__single_heading__Line_2
             );
         sepLineRect.DrawRect(gc);
-
         }
-//  else
-//      {
-// Currently no LAF specification for separator in double mode
-//      sepLineRect.LayoutRect
-//          (
-//          ViewRect(), 
-//          AKN_LAYOUT_WINDOW_List_pane_elements__double_graphic__Line_??
-//          );
-//      sepLineRect.DrawRect(gc);
-//
-//      }
     }
 
 void CEikCaptionedControl::DrawClosingLine() const
@@ -3781,8 +3542,6 @@
         }
     else
         {
-        outerRect = ViewRect() ;
-        innerRect = outerRect ;
         innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr ;
         innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
         iExtension->iViewModeHighlightControlContext->SetFrameRects( outerRect, innerRect );
@@ -3811,79 +3570,68 @@
 void CEikCaptionedControl::DrawAsSkinnedForm( CWindowGc& aGc, const TRect& /*aRect*/ ) const
     {
     MAknsSkinInstance* skin = AknsUtils::SkinInstance() ;
+    TRgb textColor( KRgbBlack );
+    GetColor( EColorLabelText, textColor );
 
     if ( !iIsCurrentLine )
         {
+        AknListUtils::DrawSeparator( aGc, Rect(), textColor, skin );
         aGc.SetBrushStyle( CGraphicsContext::ENullBrush ) ; 
         }
     else // Highlight Skinning.  Requires Frame
         {
+        TRect outerRect( Rect() );
+        TRect innerRect( outerRect );
+        
         if ( iIsEditable )
             {
-            TRect innerRect( EditRect() ) ;
-            innerRect.iTl = EditFrameTopLeftRect( Rect() ).iBr ;
-            innerRect.iBr = EditFrameBottomRightRect( Rect() ).iTl ;
+            innerRect.iTl = EditFrameTopLeftRect( outerRect ).iBr ;
+            innerRect.iBr = EditFrameBottomRightRect( outerRect ).iTl ;
 
             MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ; 
-            AknsDrawUtils::Background( skin, parentCc, this, aGc, Rect() ) ;
-
+            AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
+
+            AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
+            
             // Set the rectangle(s) for the Frame context
-            iExtension->iEditModeHighlightControlContext->SetFrameRects( EditRect(), innerRect ) ;
-            iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( EditRect(), innerRect ) ;
+            iExtension->iEditModeHighlightControlContext->SetFrameRects( outerRect, innerRect ) ;
+            iExtension->iEditModeHighlightControlContextPressed->SetFrameRects( outerRect, innerRect ) ;
             
-            AknsDrawUtils::DrawFrame( skin, aGc, EditRect(), innerRect,
+            AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
                                       PressedDownState() ?
                                       KAknsIIDQsnFrListPressed : KAknsIIDQsnFrInput, KAknsIIDDefault );
             }
         else // View Mode highlight
             {
             TBool drawOk = EFalse;
-            if( iExtension->IsHighlightAnimated() ) // Draw animated highlight
+            innerRect.iTl = ViewFrameTopLeftRect( outerRect ).iBr;
+            innerRect.iBr = ViewFrameBottomRightRect( outerRect ).iTl ;
+    
+            // The bit around the outside must use the parent's control context
+            MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage );
+            AknsDrawUtils::Background( skin, parentCc, this, aGc, outerRect ) ;
+    
+            AknListUtils::DrawSeparator( aGc, outerRect, textColor, skin );
+
+            // Draw the animation itself
+            if ( iExtension->IsHighlightAnimated() 
+                    && iExtension->iAnimation->Animation() )
                 {
-                CAknsEffectAnim* anim = iExtension->iAnimation->Animation();
-
-                // TODO: Background is drawn first to prevent white stripes
-                // appearing above and below the highlight. Wasting resources
-                // here, you could create animation that is a tad bigger and
-                // remove background drawing from here.
-                TRect viewRect = ViewRect() ;
-                TRect innerRect( viewRect ) ;
-                innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr ;
-                innerRect.iTl.iX-- ; innerRect.iTl.iY-- ;  // not sure why this adjustment is required here and not above.
-                innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ;
-
-                // The bit around the outside must use the parent's control context
-                MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ;
-                AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, Rect() , innerRect ) ;
-
-                // Draw the animation itself
-                if( anim )
-                    {
-                    drawOk = anim->Render( aGc, ViewRect() );
-                    }
+                drawOk = iExtension->iAnimation->Animation()->Render( aGc, 
+                        outerRect );
                 }
-
-            if( !drawOk )
+    
+            if ( !drawOk )
                 {
-                // Code for skinning Highlight ( Using AVKON LAF highlight in place of
-                // Skins LAF to establish highlight outer rect )
-                TRect viewRect = ViewRect() ;
-                TRect innerRect( viewRect ) ;
-                innerRect.iTl = ViewFrameTopLeftRect( viewRect ).iBr ;
-                innerRect.iTl.iX-- ; innerRect.iTl.iY-- ;  // not sure why this adjustment is required here and not above.
-                innerRect.iBr = ViewFrameBottomRightRect( viewRect ).iTl ;
-
-                // The bit around the outside must use the parent's control context
-                MAknsControlContext* parentCc = GetDialogControlContext( iDialogPage ) ;
-                AknsDrawUtils::BackgroundBetweenRects( skin, parentCc, this, aGc, Rect() , innerRect ) ;
-
                 // Set the rectangle(s) for the Frame context
-                iExtension->iViewModeHighlightControlContext->SetFrameRects( viewRect, innerRect ) ;
-                iExtension->iViewModeHighlightControlContextPressed->SetFrameRects( viewRect, innerRect ) ;
+                iExtension->iViewModeHighlightControlContext->SetFrameRects( 
+                        outerRect, innerRect ) ;
+                iExtension->iViewModeHighlightControlContextPressed->
+                    SetFrameRects( outerRect, innerRect ) ;
                 
-                AknsDrawUtils::DrawFrame( skin, aGc, viewRect, innerRect,
-                                          PressedDownState() ?
-                                          KAknsIIDQsnFrListPressed : KAknsIIDQsnFrList, KAknsIIDDefault );
+                AknsDrawUtils::DrawFrame( skin, aGc, outerRect, innerRect,
+                        PressedDownState() ? KAknsIIDQsnFrListPressed : 
+                        KAknsIIDQsnFrList, KAknsIIDDefault );
                 }
             }
         }
@@ -4021,40 +3769,7 @@
         User::LeaveIfError(AknIconUtils::SetSize(aBitmap, 
                               rectElements.Size() ));
         }
-/*        
-    
-    if (iIsFormControl)
-        {
-        if (iIsEditable)
-            {
-            if (iBitmap && iBitmap->Bitmap())
-                {
-                AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
-                                        TSize(AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iW, 
-                                        AKN_LAYOUT_WINDOW_Form_data_field_elements_Line_4.iH));
-                }
-            }
-        else
-            {
-            if (iBitmap && iBitmap->Bitmap())
-                {
-                AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
-                                        TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
-                                        AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
-                }
-            }
-        }
-    else
-        {
-        if (iBitmap && iBitmap->Bitmap())
-            {
-            AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iBitmap->Bitmap()), 
-                        TSize(AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iW, 
-                        AKN_LAYOUT_WINDOW_List_pane_elements__single_graphic_heading__Line_1.iH));
-            }
-        }                       */
     }
-    
 
 
 // -----------------------------------------------------------------------------
@@ -4148,11 +3863,6 @@
     }
 
 
-void CEikCaptionedControl::SetPartiallyVisible( TBool aPVisible )
-    {
-    iExtension->iPartiallyVisible = aPVisible;
-    }
-    
 /*  
  * Special Label Class which appends colon to label text
  */