textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp
branchRCL_3
changeset 20 ebd48d2de13c
parent 19 ac7e4d1d9209
child 21 ecbabf52600f
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp	Thu Aug 19 10:15:25 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp	Tue Aug 31 15:31:50 2010 +0300
@@ -46,10 +46,6 @@
 #include "peninputlayoutsmiley.h"
 
 #include <gdi.h>
-
-#include <e32std.h>
-#include <e32const.h>
-
 const TInt KParagraphSeperator = 0x2029;
 const TInt KSecretUpdateTimer = 1000000; // 1s
 const TInt KSecretInstantShowTimer = 100000; // 100ms
@@ -57,10 +53,8 @@
 const TUint16 KSegment = 0x0020;
 // separator between prompt text and normal text,
 // should use localized character soon
-//const TUint16 KSeparator = 0x003a;
-//const TUint16 KSeparatorcn = 0xff1a;
-const TUint16 KColon = 0x003a;
-const TUint16 KColoncn = 0xff1a; 
+const TUint16 KSeparator = 0x003a;
+const TUint16 KSeparatorcn = 0xff1a;
 _LIT(KLineSeparator, "\n");
 const TInt KStar = '*';
 
@@ -69,9 +63,6 @@
 const TInt KMsgBubblePosAdjustValueX = 3;
 const TInt KMsgBubblePosAdjustValueY = 2;
 const TInt KPromptAdjustLen = 5;
-// Tooltip position adjust
-const TInt KTooltipPosAdjustValueY = 5;
-
 EXPORT_C CFepLayoutMultiLineIcfEditor* CFepLayoutMultiLineIcfEditor::NewL(TRect aRect,
                                                               CFepUiLayout* aUiLayout,
                                                               TInt aControlId,
@@ -117,8 +108,8 @@
     if(aUiLayout)
     	{
     	//Advanced Tactile feedback REQ417-47932
-    	SetTactileFeedbackType(ETouchFeedbackSensitiveInput);    	
-    	aUiLayout->RegisterFeedbackArea(reinterpret_cast<TInt>(this),aRect,ETouchFeedbackSensitiveInput);
+    	SetTactileFeedbackType(ETouchFeedbackSensitiveKeypad);    	
+    	aUiLayout->RegisterFeedbackArea(reinterpret_cast<TInt>(this),aRect,ETouchFeedbackSensitiveKeypad);
     	}
 #endif //RD_TACTILE_FEEDBACK     
     }
@@ -156,11 +147,11 @@
         delete iFormExtendedInterfaceProvider;
         iFormExtendedInterfaceProvider = NULL;
         }
-    iCoeEnv->ScreenDevice()->ReleaseFont(CONST_CAST(CFont*, iFont));
+    
     delete iSmileyManager;
     }
 
-void CFepLayoutMultiLineIcfEditor::InitTextLayoutL(const CFont *aFont)
+void CFepLayoutMultiLineIcfEditor::InitTextLayoutL()
     {
 	iParaFormatLayer=CParaFormatLayer::NewL();
 	iCharFormatLayer=CCharFormatLayer::NewL();
@@ -190,7 +181,7 @@
     //iCtrl->SetContainerWindowL(*iWin);    
     //iWin->Construct(iCoeEnv->RootWin(),reinterpret_cast<TInt>(iCtrl));
     //ctrl->SetExtent(iViewRect.iTl, iViewRect.Size());
-    SetFontL(aFont);
+
 	iTextView = CTextView::NewL(iLayout, 
 	                            iViewRect,
                         		BitmapDevice(),
@@ -277,8 +268,8 @@
     iAlignment = aAlignment;
     }
 
-void CFepLayoutMultiLineIcfEditor::BaseConstructL(TInt /*aFontHeight*/, 
-                                            TInt /*aMaxFontHeight*/, 
+void CFepLayoutMultiLineIcfEditor::BaseConstructL(TInt aFontHeight, 
+                                            TInt aMaxFontHeight, 
                                             const CFont* aFont)
     {
     CFepUiBaseCtrl::BaseConstructL();
@@ -287,10 +278,10 @@
     //iMaxFontHeight = aMaxFontHeight;
     //iFontHeight = aFontHeight;
     //iFont = aFont;
-    InitTextLayoutL(aFont);
+    InitTextLayoutL();
     iInsertionPoint = UiLayout()->CreateCursor();
     iInsertionPoint->SetOwner(this);
-    //SetFontL(aFont);
+    SetFontL(aFontHeight, aMaxFontHeight, aFont);
 
     iSecretTextTimer = CPeriodic::NewL(CActive::EPriorityStandard);
 
@@ -349,6 +340,7 @@
 
 void CFepLayoutMultiLineIcfEditor::RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText)
     {
+    // recalculate cursor pos
     AdjustSelectionL(TCursorSelection(iTextView->Selection().iCursorPos + aNewPromptText.Length() - iPromptTextLen,
                      iTextView->Selection().iAnchorPos + aNewPromptText.Length() - iPromptTextLen));
 
@@ -360,6 +352,7 @@
     iPreAutoEndPos += (aNewPromptText.Length() - iPromptTextLen);
     iPreTextSelStartPos += (aNewPromptText.Length() - iPromptTextLen);
     iPreTextSelEndPos += (aNewPromptText.Length() - iPromptTextLen);
+
     }
 
 const HBufC* CFepLayoutMultiLineIcfEditor::PromptText()
@@ -369,6 +362,7 @@
 	
 void CFepLayoutMultiLineIcfEditor::SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent)
     {
+    
     if ( aCleanContent )
     	{
     	//clean all the content (include prompt text) on the ICF
@@ -380,24 +374,15 @@
         iNoMatchState = EFalse;
     	}
     else 
-        {   
-        if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| 
+        {
+        /*if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| 
             ( iInitPromptText && *iInitPromptText == aPromptText && 
             iPromptText && TextWidth(*iPromptText) <= iViewRect.Width()) )
     	    {
     	    //prompt text has not been change then need not to be reset
     	    //but iLineSeparator may be changed, need reset prompt text
-            TBool newLineSeparator = iLineSeparator;
-            if ( !iLineSeparator )
-                {
-                newLineSeparator = ( TBidiText::TextDirectionality( aPromptText )
-                                                     == TBidiText:: ERightToLeft );
-                }
-            if ( newLineSeparator == iLineSeparator )
-                {
-                return;
-                }
-            }
+    	    return;
+            }*/
         //prompt text need to be reset and not clean the content
         iRichText->DeleteL( 0,  iPromptTextLen );
         iTextView->HandleInsertDeleteL(TCursorSelection(0, 0), iPromptTextLen );
@@ -445,31 +430,19 @@
     iPromptText = HBufC::NewL(prompttextLen);
     TPtr text = iPromptText->Des();
 
-        TBuf<1> ptrEllipsis;
-        ptrEllipsis.Append( KEllipsis );
-
-        TPtrC ptrSpace(&KSegment, 1);
-        TPtrC ptrColon(&KColon, 1);
-    
-        TInt separatorLen = TextWidth(ptrSpace) + TextWidth(ptrColon) + TextWidth(ptrEllipsis);     
-        TInt textWidth = TextWidth(aPromptText);
+    TBuf<1> ptr0;
+    ptr0.Append( KEllipsis );
 
-        if ((aPromptText.LocateReverse(KColon) != aPromptText.Length() - 1) && 
-           (aPromptText.LocateReverse(KColoncn) != aPromptText.Length() - 1))
-           {
-            textWidth += TextWidth(ptrSpace) + TextWidth(ptrColon);
-            }
-
-        else
-                {
-                textWidth += TextWidth(ptrSpace);
-                }     
-
-        TBool truncated = EFalse;
+    TPtrC ptr1(&KSegment, 1);
+    TPtrC ptr2(&KSeparator, 1);
     
-        if (textWidth > iViewRect.Width() )
-            {
-            truncated = ETrue;
+    TInt separatorLen = TextWidth(ptr1) + TextWidth(ptr2) + TextWidth(ptr0);
+    TInt textWidth = TextWidth(aPromptText) + separatorLen;
+    TBool ret = EFalse;
+    
+    if (textWidth >= iViewRect.Width() )
+        {
+        ret = ETrue;
         AknBidiTextUtils::ConvertToVisualAndClip(aPromptText,
                                                  text,
                                                  *iFont,
@@ -491,23 +464,23 @@
 		text.Delete( text.Length()-1, 1 );
 	    }
 		
-        if ((text.LocateReverse(KColon) != text.Length() - 1) && 
-            (text.LocateReverse(KColoncn) != text.Length() - 1))
+    if ((text.LocateReverse(KSeparator) != text.Length() - 1) && 
+        (text.LocateReverse(KSeparatorcn) != text.Length() - 1))
         {
         // if sent prompt text already include separator, then no need to 
         // append it again
-            if (truncated)
-                {
-                text.Append( ptrEllipsis );
-                }
-            text.Append(ptrColon);
-           }
-        else if (truncated)
+        if ( ret )
             {
-            text.Insert( text.Length()-1, ptrEllipsis );
-            }        
+            text.Append( ptr0 );
+            }
+        text.Append(ptr2);
+        }
+    else if ( ret )
+        {
+        text.Insert( text.Length()-1, ptr0 );
+        }        
 
-    text.Append(ptrSpace); // segment between prompt text and official text
+    text.Append(ptr1); // segment between prompt text and official text
     textWidth = TextWidth(text);
     
     iRichText->InsertL(0, text);
@@ -559,7 +532,6 @@
                 iRichText->DeleteL(iPromptTextLen, delLen );
                 iTextView->HandleInsertDeleteL(TCursorSelection(iPromptTextLen, iPromptTextLen), 
                                                delLen);
-                iTextView->SetSelectionL(TCursorSelection(iPromptTextLen, iPromptTextLen));
                 }
             ptr.Copy(icfdata.iText);
             }
@@ -593,7 +565,6 @@
         iCursorSel.iAnchorPos = icfdata.iCurSel.iAnchorPos + iPromptTextLen;
         DrawMfneText();
         iSynCursor = EFalse;
-        iOldMfneText.Close();
         iOldMfneText.CreateL(ptr);
         }
         
@@ -681,8 +652,7 @@
             
             AdjustSelectionL( icfdata.iCurSel );
             RecalcualteTextPositionL();
-            //SetMsgBubbleRect();
-            SetMsgBubbleRectAccordingToLanguage();
+            SetMsgBubbleRect();
             Draw();
             }
             break;
@@ -838,8 +808,7 @@
         }
     else
         {
-        //SetMsgBubbleRect();
-		SetMsgBubbleRectAccordingToLanguage();
+        SetMsgBubbleRect();
         SetInfoBubbleRect();
         }    
     }
@@ -981,40 +950,26 @@
         }
     TPtrC icftext = editArea->iRichText->Read(editArea->iPromptTextLen, 
                                               editArea->iRichText->DocumentLength());
-    
-    for (TInt i = 0; i < icftext.Length(); i++)
-        {
-        if (icftext[i] != KStar)//find only one none-star char
-            {
-            TInt startPos = i + editArea->iPromptTextLen;
-            TBuf<1> buf;
-            buf.Append(KStar);
+    TInt startPos = icftext.LocateReverse(KStar) + 1 + editArea->iPromptTextLen;
 
-            TInt textlen = editArea->iRichText->DocumentLength();
+    TBuf<1> buf;
+    buf.Append(KStar);
+
+    TInt textlen = editArea->iRichText->DocumentLength();
 
-            if (startPos < textlen)
-                {
-                editArea->iRichText->DeleteL(startPos, 1);
-                editArea->iTextView->HandleInsertDeleteL(TCursorSelection(
-                        startPos, startPos), 1);
-                editArea->iRichText->InsertL(startPos, buf);
-                editArea->iTextView->HandleInsertDeleteL(TCursorSelection(
-                        startPos, startPos + buf.Length()), 0);
+    if (startPos < textlen)
+        {
+        editArea->iRichText->DeleteL(startPos, 1);
+        editArea->iTextView->HandleInsertDeleteL(TCursorSelection(startPos, startPos), 1);
+        editArea->iRichText->InsertL(startPos, buf);
+        editArea->iTextView->HandleInsertDeleteL(TCursorSelection(startPos, startPos+buf.Length()),
+                                                 0);
 
-                if (startPos == textlen - 1)
-                    {
-                    editArea->iSecretTextTimer->Cancel();
-                    }
-                }
-            break;
+        if (startPos == textlen - 1)
+            {
+            editArea->iSecretTextTimer->Cancel();
             }
         }
-    
-    if ( editArea->iCursorVisible )
-    	{
-        editArea->SetSelectionL( editArea->iCursorSel );
-        editArea->Draw();
-    	}
     editArea->UpdateArea(editArea->Rect(),EFalse);
     return KErrNone;
     }
@@ -1038,9 +993,11 @@
     iDimmed = aDimFlag;
     }
 
-void CFepLayoutMultiLineIcfEditor::SetFontL(const CFont* aFont)
+void CFepLayoutMultiLineIcfEditor::SetFontL(TInt aFontHeight, 
+                                            TInt aMaxFontHeight, 
+                                            const CFont* aFont)
     {
-    TInt newHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(aFont->HeightInPixels());
+    TInt newHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(aFontHeight);
     TInt OldHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight);
     
     if( newHeightInPixel == OldHeightInPixel )
@@ -1052,16 +1009,9 @@
         iFormatChange = ETrue;
         }    
     
-    TFontSpec fontSpec;
-    fontSpec = aFont->FontSpecInTwips();
-    fontSpec.iHeight = aFont->HeightInPixels();
-    CFont*  font;
-    iCoeEnv->ScreenDevice()->ReleaseFont(CONST_CAST(CFont*, iFont));
-    iCoeEnv->ScreenDevice()->GetNearestFontInPixels((CFont*&)font,fontSpec);
-    
-    iMaxFontHeight = font->FontMaxHeight();
-    iFontHeight = font->HeightInPixels();
-    iFont = font;
+    iMaxFontHeight = aMaxFontHeight;
+    iFontHeight = aFontHeight;
+    iFont = aFont;
     
         
     iCharFormatMask.ClearAttrib( EAttFontUnderline );
@@ -1072,7 +1022,6 @@
     iCharFormat.iFontSpec.iHeight = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight);
     iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
     iCharFormat.iFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
-    iCharFormat.iFontSpec.iTypeface = iFont->FontSpecInTwips().iTypeface;
 
     iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, iRichText->DocumentLength());    
     if( InlineStateOn() || AutoCompletionStateOn() )
@@ -1080,11 +1029,8 @@
         iCharFormatMask.ClearAll();
         iCharFormatMask.SetAttrib( EAttFontUnderline );        
         iCharFormat.iFontPresentation.iUnderline = EUnderlineOn ;
-        if( iPreInlineStartPos >= 0 && iPreInlineEndPos <= iRichText->DocumentLength() + 1 )
-            {
-            iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, 
-                                        iPreInlineEndPos - iPreInlineStartPos);
-            }
+        iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, 
+                                    iPreInlineEndPos - iPreInlineStartPos);
         }
     
     //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, iRichText->DocumentLength() - iPromptTextLen);
@@ -1151,7 +1097,7 @@
         TRect innerrect = Rect();
   	    //innerrect.Shrink(4, 4);
 
-        AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), 
+        AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), 
    		                         *gc, 
    		                         Rect(), 
    		                         innerrect,
@@ -1208,7 +1154,7 @@
     TInt baseLine = iFont->AscentInPixels()/2 + rect.Height()/2;
     
     TRect clipRect = 
-        TRect( TPoint(Rect().iTl.iX + 1, rect.iTl.iY), TPoint( Rect().iBr.iX - 1, rect.iBr.iY));
+        TRect( TPoint(Rect().iTl.iX, rect.iTl.iY), TPoint( Rect().iBr.iX, rect.iBr.iY));    
     
     gc->SetClippingRect( clipRect );
     gc->Clear( clipRect );
@@ -1218,7 +1164,7 @@
 
     if (iSkinIdSet)
         {
-   		AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), 
+   		AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), 
     	                         *gc, 
     	                         Rect(), 
     	                         Rect(),
@@ -1328,9 +1274,7 @@
         }
 
     TRAP_IGNORE(RecalcualteTextPositionL());        
-    
-    //SetMsgBubbleRect();
-    SetMsgBubbleRectAccordingToLanguage();
+    SetMsgBubbleRect();
     }
 
 void CFepLayoutMultiLineIcfEditor::ResetViewHeightL()
@@ -1382,31 +1326,6 @@
     iTextView->SetViewRect(iViewRect);
     }
 
-void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRectAccordingToLanguage()
-	{
-	if ( iPreLanguageID == ELangPrcChinese || 
-		 iPreLanguageID == ELangHongKongChinese ||
-		 iPreLanguageID == ELangTaiwanChinese ||
-		 iPreLanguageID == ELangKorean )
-		{
-		SetMsgBubbleRect();
-		return;
-		}
-	else
-		{
-		if(( !iMsgBubble->IsShowing() && !iHideBubbleTemp ) ||
-				iLineMaxCount < 1 || iCursorSel.iCursorPos < 0 )
-			{
-			return;
-			}
-		
-		iMsgBubble->Popup( iMsgBubble->Rect());		        
-		iHideBubbleTemp = EFalse;
-		
-		return;
-		}
-	}
-
 void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRect()
     {
     if( ( !iMsgBubble->IsShowing() && !iHideBubbleTemp ) ||
@@ -1647,9 +1566,7 @@
     iInfoBubble->SetRect( TRect(leftTop,aSize) ) ;        
     }
 
-void CFepLayoutMultiLineIcfEditor::ShowTooltipL( const TDesC& aText, 
-		                                         const TRect& aRect,
-		                                         TInt aLangCode )
+void CFepLayoutMultiLineIcfEditor::ShowTooltipL(const TDesC& aText)
 	{
 	if ( !iTooltip )
 	    {
@@ -1657,34 +1574,28 @@
 	    }
 
     iTooltip->SetTextL( aText );
-    iTooltip->SetLangCode( aLangCode );
-    TPoint tl( 0, 0 ), br( 0, 0 );
-    InlineTextPos( tl, br );    
-    
+    TPoint tl = iInsertionPoint->Position();
     if ( iLineMaxCount > 1 )
 	    {
 		TBool firstLine =  iLayout->FirstLineInBand() == iLineNumber;
 		if ( firstLine )
-		    {				
-		    tl.iY += KTooltipPosAdjustValueY;
+		    {
+			tl.iY += iInsertionPoint->Height();
 			}
 		else
 		    {
-			tl.iY -= ( iFormatLineHeight + aRect.Height() - KTooltipPosAdjustValueY );			
+			tl.iY -= iTooltip->Rect().Height();
 			}
-		}       
+		}
+    TRect tooltipRect = TRect( tl, iTooltip->Rect().Size() );
     
-    TRect tooltipRect = TRect( tl, aRect.Size() );
-    
-    // Make sure the right border of tooltip isn't be out of icf rect
     TInt moveX = tooltipRect.iBr.iX - Rect().iBr.iX;
     if ( moveX > 0 )
     	{
     	tooltipRect.iBr.iX -= moveX;
     	tooltipRect.iTl.iX -= moveX;
     	}
-    
-    // Make sure tooltip isn't overlapped by msg bubble.
+		
 	if ( tooltipRect.Intersects( iMsgBubble->Rect() ) )
 	    {
 		moveX = tooltipRect.iBr.iX - iMsgBubble->Rect().iTl.iX;
@@ -1699,13 +1610,7 @@
 	    	tooltipRect.iBr.iX += moveX;
 	    	tooltipRect.iTl.iX += moveX;
 	    	}
-	    }		
-
-	if (( iTooltip->Rect().iTl != tooltipRect.iTl ) && ( iTooltip->Rect().iBr != tooltipRect.iBr ))
-	    {
-        iTooltip->Close();
 	    }
-
     iTooltip->Popup( tooltipRect );
 	}
 
@@ -1729,15 +1634,15 @@
     }
 
 void CFepLayoutMultiLineIcfEditor::SizeChangedL(const TRect& aRect,
-                                                TInt /*aFontHeight*/,
-                                                TInt /*aMaxFontHeight*/,
+                                                TInt aFontHeight,
+                                                TInt aMaxFontHeight,
                                                 const CFont* aFont)
     {   
     TRect oriRect = Rect();
     
     AdjustBmpDeviceIfNeeded();
     // apply font formats 
-    SetFontL( aFont);
+    SetFontL(aFontHeight, aMaxFontHeight, aFont);
     
     if ( !iFormatChange && oriRect == aRect )
         {
@@ -1764,10 +1669,10 @@
 
     iLayout->SetAmountToFormat(CTextLayout::EFFormatAllText);    
     
-//    if ( iFormatChange )
-//        {
-//        iTextView->HandleGlobalChangeNoRedrawL();
-//        }
+    if ( iFormatChange )
+        {
+        iTextView->HandleGlobalChangeNoRedrawL();
+        }
     
     TBool ready = Ready();
     if( ready )
@@ -1781,19 +1686,13 @@
 	    SetReady( ETrue );    
 	    }
 
-//    if ( iFormatChange )	    
-//        {
-//        iTextView->SetSelectionL( iTextView->Selection() );
-//        RecalcualteTextPositionL();
-//        SetMsgBubbleRect();
-//        Draw();
-//        }
-		iTextView->HandleGlobalChangeNoRedrawL();
-		iTextView->SetSelectionL( iTextView->Selection() );
-		RecalcualteTextPositionL();
-		//SetMsgBubbleRect();
-		SetMsgBubbleRectAccordingToLanguage();
-		Draw();
+    if ( iFormatChange )	    
+        {
+        iTextView->SetSelectionL( iTextView->Selection() );
+        RecalcualteTextPositionL();
+        SetMsgBubbleRect();
+        Draw();
+        }
     }
 
 TBool CFepLayoutMultiLineIcfEditor::BelongToPromptText(TInt aPos)
@@ -1916,8 +1815,8 @@
             break;
         case CFepLayoutMultiLineIcf::EIcfAutoComplete:
             {
-            if ( iTextView->Selection().iCursorPos >= iPreInlineStartPos 
-                 && iTextView->Selection().iCursorPos < iPreAutoEndPos )
+            if (iTextView->Selection().iCursorPos >= iPreInlineStartPos && 
+                iTextView->Selection().iCursorPos < iPreInlineEndPos )
                 {
                 iPntDownOnInline = ETrue;
                 CapturePointer(EFalse);                 
@@ -1930,6 +1829,18 @@
                     ReportEvent(EEventPointerDownOnInline);
                     }
                 }
+            else
+                {
+                // do nothing
+                //submit autocomplete when set text
+                if (iTooltip && !iTooltip->IsShowing())
+                    {
+    	            ReportEvent( EEventControlFocusGained );
+                    UiLayout()->SignalOwner( ESignalCommitITIInlineText );
+			        SetInlineStateL( EFalse, iPreInlineStartPos, iPreInlineEndPos );
+			        SetAutoCompleteStateL( EFalse );
+                    }
+                }
             }
             break;
         case CFepLayoutMultiLineIcf::EIcfNormal:
@@ -1987,19 +1898,6 @@
         iCursorSel = TCursorSelection(cursorPos+iPromptTextLen, 
                                       iCursorSel.iAnchorPos);
         AdjustFepCursorPosForPromptText( ETrue );
-        
-        TAmPmName amName(EAm);
-        TAmPmName pmName(EPm);
-        TInt offset = iMfneIcfData->Find(amName)!= KErrNotFound?
-                        iMfneIcfData->Find(amName):iMfneIcfData->Find(pmName);
-	    //if current is 12-hour format and touch on correct position
-        if(offset != KErrNotFound &&
-           iCursorSel.LowerPos()-iPromptTextLen>= offset &&
-           iCursorSel.LowerPos()-iPromptTextLen<= offset+amName.Length())
-            {
-            UiLayout()->SignalOwner(ESignalChangeAmPm);
-            }
-
         return this;
         }
         
@@ -2028,6 +1926,10 @@
         else
             {
             AdjustFepCursorPosForPromptText( !iPntDownOnInline );
+            if(iState != CFepLayoutMultiLineIcf::EIcfNormal)
+                {
+                UiLayout()->SignalOwner( ESignalStartInlineText );
+                }
             }
         }
 
@@ -2164,7 +2066,7 @@
         {
         if ( iLastCursorPos != iCursorSel.iCursorPos ) 
             {
-            UiLayout()->DoTactileFeedback(ETouchFeedbackEdit);
+            UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveKeypad);
             iLastCursorPos = iCursorSel.iCursorPos;
             }
         }
@@ -2552,10 +2454,7 @@
     iCharFormat.iFontPresentation.iTextColor = iTextColor;
 
     // set prompt text as bold
-    if( aPromptTextLen <= iRichText->DocumentLength() + 1)
-        {
-        iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1
-        }
+    iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1
     iTextView->HandleRangeFormatChangeL(TCursorSelection(0, aPromptTextLen ), ETrue);//- 1
 
     // set remain text as non-bold
@@ -2593,13 +2492,12 @@
         
     iCharFormatMask.SetAttrib(aAttribute);
 
-    // comment for updating format anyway.
-    //if (IsTextPosValid(aPreStartPos) && IsTextPosValid(aPreEndPos))
-        //{
-    iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, 
+    if (IsTextPosValid(aPreStartPos) && IsTextPosValid(aPreEndPos))
+        {
+        iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, 
                                     iRichText->DocumentLength());
         //iTextView->HandleRangeFormatChangeL(TCursorSelection(aPreStartPos, aPreEndPos), ETrue);    
-        //} 
+        } 
 
     aPreStartPos = 0;
     aPreEndPos = 0;
@@ -2619,23 +2517,17 @@
             }
         iCharFormatMask.SetAttrib(aAttribute);
 
-        TInt aPos = Min( aStartPos, aEndPos );
-        TInt aLength = Abs( aEndPos - aStartPos );
         if (aNoMatchState)
             {
-            if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength())
-                {
-                iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aPos, aLength + 1);
-                iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue);
-                }
+            iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 
+                                        Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) + 1);
+            iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue);
             }
         else
             {
-            if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength() + 1 )
-                {
-                iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aStartPos, aLength );
-                iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue);
-                }
+            iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 
+                                        Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) );
+            iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue);
             }
 
         aPreStartPos = aStartPos;
@@ -2744,16 +2636,17 @@
     {
     TRAP_IGNORE(iMsgBubble->SetTextL(aText));
     iHideBubbleTemp = ETrue;
-    //SetMsgBubbleRect();
-    SetMsgBubbleRectAccordingToLanguage();
+    SetMsgBubbleRect();
     }
     
 void CFepLayoutMultiLineIcfEditor::ShowByteWarningBubble(const TDesC& aInfo)
     {
     TSize size = iInfoBubble->Rect().Size();
-    CFont::TMeasureTextInput input;// = new (ELeave) CFont::TMeasureTextInput;
-    input.iMaxBounds = iRect.Width();
-    TInt width = iFont->MeasureText(aInfo, &input, NULL);
+    CFont::TMeasureTextInput*  input = new (ELeave) CFont::TMeasureTextInput;
+    CleanupStack::PushL(input);
+    input->iMaxBounds = iRect.Width();
+    TInt width = iFont->MeasureText(aInfo, input, NULL);
+    CleanupStack::PopAndDestroy();
     size.SetSize(width, size.iHeight);
     SetInfoBubbleCtrlSize(size);
     TRAP_IGNORE(iInfoBubble->SetTextL(aInfo));
@@ -2781,7 +2674,7 @@
     {
     if( !iFormatChange )
         {
-        return ;
+        return;
         }
     //apply line space
     CParaFormat* paraFormat=CParaFormat::NewL();
@@ -2823,12 +2716,12 @@
     
 void CFepLayoutMultiLineIcfEditor::ResetApplyFont()
     {
-    //TInt fontHeight = iFontHeight; 
-    //TInt maxFontHeight = iMaxFontHeight;
+    TInt fontHeight = iFontHeight; 
+    TInt maxFontHeight = iMaxFontHeight;
     const CFont *font = iFont;
     
     iFontHeight = 0;
-    TRAP_IGNORE(SetFontL(font));
+    TRAP_IGNORE(SetFontL(fontHeight, maxFontHeight, font));
     }
 
 void CFepLayoutMultiLineIcfEditor::TryDisplayMaxTextL( TInt aCursorPos )
@@ -2845,8 +2738,7 @@
             {
             iTextView->SetViewLineAtTopL(( lineIndex + 1 ) - ( iLineMaxCount - 1 ));
             RecalcualteTextPositionL();
-            //SetMsgBubbleRect();
-            SetMsgBubbleRectAccordingToLanguage();
+            SetMsgBubbleRect();
             }
         }
     
@@ -2865,8 +2757,7 @@
                                    lineCount - pageCount + 1 < 1 ? 1 : lineCount - pageCount + 1 );
             
             RecalcualteTextPositionL();
-            //SetMsgBubbleRect();
-            SetMsgBubbleRectAccordingToLanguage();
+            SetMsgBubbleRect();
             }
         }
     }
@@ -2904,13 +2795,13 @@
    
     if ( BelongToPromptText(aCurSel.iCursorPos) )
         {
-        //why to use iPromptText->Length() instead of iPromptTextLen 
+        //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen 
         //iCursorSel.iCursorPos = iPromptTextLen;
         iCursorSel.iCursorPos = iPromptText->Length();
         }
     if ( BelongToPromptText(aCurSel.iAnchorPos) )
         {
-        //why to use iPromptText->Length() instead of iPromptTextLen
+        //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen
         //iCursorSel.iAnchorPos = iPromptTextLen;
         iCursorSel.iAnchorPos = iPromptText->Length();
         }
@@ -2994,7 +2885,7 @@
     }
 
 void CFepLayoutMultiLineIcfEditor::CalcSmileyClipRegionL( RRegion& aRgn, 
-                                                          CGraphicsContext& /*aGc*/, 
+                                                          CGraphicsContext& aGc, 
                                                           CFont& aFont,  
                                                           const TDesC& aText, 
                                                           TPoint& aBasePoint, 
@@ -3070,6 +2961,7 @@
             CPeninputSmileyImage* smiley = iSmileyManager->SmileyImage( code );
             if ( smiley )
                 {
+                gc.SetBrushColor( TRgb(255,0,0) );
                 gc.SetBrushStyle( CGraphicsContext::ENullBrush );
                 
                 smiley->SetImageSize( rect.Size() );