44 #include "AknEdwinFormExtendedInterfaceProvider.h" |
44 #include "AknEdwinFormExtendedInterfaceProvider.h" |
45 #include "AknCompositeInlineTextSource.h" |
45 #include "AknCompositeInlineTextSource.h" |
46 #include "peninputlayoutsmiley.h" |
46 #include "peninputlayoutsmiley.h" |
47 |
47 |
48 #include <gdi.h> |
48 #include <gdi.h> |
49 |
|
50 #include <e32std.h> |
|
51 #include <e32const.h> |
|
52 |
|
53 const TInt KParagraphSeperator = 0x2029; |
49 const TInt KParagraphSeperator = 0x2029; |
54 const TInt KSecretUpdateTimer = 1000000; // 1s |
50 const TInt KSecretUpdateTimer = 1000000; // 1s |
55 const TInt KSecretInstantShowTimer = 100000; // 100ms |
51 const TInt KSecretInstantShowTimer = 100000; // 100ms |
56 |
52 |
57 const TUint16 KSegment = 0x0020; |
53 const TUint16 KSegment = 0x0020; |
58 // separator between prompt text and normal text, |
54 // separator between prompt text and normal text, |
59 // should use localized character soon |
55 // should use localized character soon |
60 //const TUint16 KSeparator = 0x003a; |
56 const TUint16 KSeparator = 0x003a; |
61 //const TUint16 KSeparatorcn = 0xff1a; |
57 const TUint16 KSeparatorcn = 0xff1a; |
62 const TUint16 KColon = 0x003a; |
|
63 const TUint16 KColoncn = 0xff1a; |
|
64 _LIT(KLineSeparator, "\n"); |
58 _LIT(KLineSeparator, "\n"); |
65 const TInt KStar = '*'; |
59 const TInt KStar = '*'; |
66 |
60 |
67 const TInt KMaxMfneDataLen = 30; |
61 const TInt KMaxMfneDataLen = 30; |
68 // Message bubble position adjust |
62 // Message bubble position adjust |
69 const TInt KMsgBubblePosAdjustValueX = 3; |
63 const TInt KMsgBubblePosAdjustValueX = 3; |
70 const TInt KMsgBubblePosAdjustValueY = 2; |
64 const TInt KMsgBubblePosAdjustValueY = 2; |
71 const TInt KPromptAdjustLen = 5; |
65 const TInt KPromptAdjustLen = 5; |
72 // Tooltip position adjust |
|
73 const TInt KTooltipPosAdjustValueY = 5; |
|
74 |
|
75 EXPORT_C CFepLayoutMultiLineIcfEditor* CFepLayoutMultiLineIcfEditor::NewL(TRect aRect, |
66 EXPORT_C CFepLayoutMultiLineIcfEditor* CFepLayoutMultiLineIcfEditor::NewL(TRect aRect, |
76 CFepUiLayout* aUiLayout, |
67 CFepUiLayout* aUiLayout, |
77 TInt aControlId, |
68 TInt aControlId, |
78 TInt aFontHeight, |
69 TInt aFontHeight, |
79 TInt aMaxFontHeight, |
70 TInt aMaxFontHeight, |
115 #ifdef RD_TACTILE_FEEDBACK |
106 #ifdef RD_TACTILE_FEEDBACK |
116 //register the area for tactile feedback |
107 //register the area for tactile feedback |
117 if(aUiLayout) |
108 if(aUiLayout) |
118 { |
109 { |
119 //Advanced Tactile feedback REQ417-47932 |
110 //Advanced Tactile feedback REQ417-47932 |
120 SetTactileFeedbackType(ETouchFeedbackSensitiveInput); |
111 SetTactileFeedbackType(ETouchFeedbackSensitiveKeypad); |
121 aUiLayout->RegisterFeedbackArea(reinterpret_cast<TInt>(this),aRect,ETouchFeedbackSensitiveInput); |
112 aUiLayout->RegisterFeedbackArea(reinterpret_cast<TInt>(this),aRect,ETouchFeedbackSensitiveKeypad); |
122 } |
113 } |
123 #endif //RD_TACTILE_FEEDBACK |
114 #endif //RD_TACTILE_FEEDBACK |
124 } |
115 } |
125 |
116 |
126 CFepLayoutMultiLineIcfEditor::~CFepLayoutMultiLineIcfEditor() |
117 CFepLayoutMultiLineIcfEditor::~CFepLayoutMultiLineIcfEditor() |
154 if(iFormExtendedInterfaceProvider) |
145 if(iFormExtendedInterfaceProvider) |
155 { |
146 { |
156 delete iFormExtendedInterfaceProvider; |
147 delete iFormExtendedInterfaceProvider; |
157 iFormExtendedInterfaceProvider = NULL; |
148 iFormExtendedInterfaceProvider = NULL; |
158 } |
149 } |
159 iCoeEnv->ScreenDevice()->ReleaseFont(CONST_CAST(CFont*, iFont)); |
150 |
160 delete iSmileyManager; |
151 delete iSmileyManager; |
161 } |
152 } |
162 |
153 |
163 void CFepLayoutMultiLineIcfEditor::InitTextLayoutL(const CFont *aFont) |
154 void CFepLayoutMultiLineIcfEditor::InitTextLayoutL() |
164 { |
155 { |
165 iParaFormatLayer=CParaFormatLayer::NewL(); |
156 iParaFormatLayer=CParaFormatLayer::NewL(); |
166 iCharFormatLayer=CCharFormatLayer::NewL(); |
157 iCharFormatLayer=CCharFormatLayer::NewL(); |
167 |
158 |
168 iRichText = CRichText::NewL(iParaFormatLayer, iCharFormatLayer); |
159 iRichText = CRichText::NewL(iParaFormatLayer, iCharFormatLayer); |
188 // when (screen resolution changed) |
179 // when (screen resolution changed) |
189 //iCtrl = new (ELeave) CCoeControl; |
180 //iCtrl = new (ELeave) CCoeControl; |
190 //iCtrl->SetContainerWindowL(*iWin); |
181 //iCtrl->SetContainerWindowL(*iWin); |
191 //iWin->Construct(iCoeEnv->RootWin(),reinterpret_cast<TInt>(iCtrl)); |
182 //iWin->Construct(iCoeEnv->RootWin(),reinterpret_cast<TInt>(iCtrl)); |
192 //ctrl->SetExtent(iViewRect.iTl, iViewRect.Size()); |
183 //ctrl->SetExtent(iViewRect.iTl, iViewRect.Size()); |
193 SetFontL(aFont); |
184 |
194 iTextView = CTextView::NewL(iLayout, |
185 iTextView = CTextView::NewL(iLayout, |
195 iViewRect, |
186 iViewRect, |
196 BitmapDevice(), |
187 BitmapDevice(), |
197 iCoeEnv->ScreenDevice(), |
188 iCoeEnv->ScreenDevice(), |
198 iWin, |
189 iWin, |
275 CleanupStack::PopAndDestroy(paraFormat); |
266 CleanupStack::PopAndDestroy(paraFormat); |
276 |
267 |
277 iAlignment = aAlignment; |
268 iAlignment = aAlignment; |
278 } |
269 } |
279 |
270 |
280 void CFepLayoutMultiLineIcfEditor::BaseConstructL(TInt /*aFontHeight*/, |
271 void CFepLayoutMultiLineIcfEditor::BaseConstructL(TInt aFontHeight, |
281 TInt /*aMaxFontHeight*/, |
272 TInt aMaxFontHeight, |
282 const CFont* aFont) |
273 const CFont* aFont) |
283 { |
274 { |
284 CFepUiBaseCtrl::BaseConstructL(); |
275 CFepUiBaseCtrl::BaseConstructL(); |
285 |
276 |
286 iCoeEnv = CCoeEnv::Static(); |
277 iCoeEnv = CCoeEnv::Static(); |
287 //iMaxFontHeight = aMaxFontHeight; |
278 //iMaxFontHeight = aMaxFontHeight; |
288 //iFontHeight = aFontHeight; |
279 //iFontHeight = aFontHeight; |
289 //iFont = aFont; |
280 //iFont = aFont; |
290 InitTextLayoutL(aFont); |
281 InitTextLayoutL(); |
291 iInsertionPoint = UiLayout()->CreateCursor(); |
282 iInsertionPoint = UiLayout()->CreateCursor(); |
292 iInsertionPoint->SetOwner(this); |
283 iInsertionPoint->SetOwner(this); |
293 //SetFontL(aFont); |
284 SetFontL(aFontHeight, aMaxFontHeight, aFont); |
294 |
285 |
295 iSecretTextTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
286 iSecretTextTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
296 |
287 |
297 SetAutoCompleteTextColor(KRgbGray); |
288 SetAutoCompleteTextColor(KRgbGray); |
298 |
289 |
347 } |
338 } |
348 } |
339 } |
349 |
340 |
350 void CFepLayoutMultiLineIcfEditor::RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText) |
341 void CFepLayoutMultiLineIcfEditor::RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText) |
351 { |
342 { |
|
343 // recalculate cursor pos |
352 AdjustSelectionL(TCursorSelection(iTextView->Selection().iCursorPos + aNewPromptText.Length() - iPromptTextLen, |
344 AdjustSelectionL(TCursorSelection(iTextView->Selection().iCursorPos + aNewPromptText.Length() - iPromptTextLen, |
353 iTextView->Selection().iAnchorPos + aNewPromptText.Length() - iPromptTextLen)); |
345 iTextView->Selection().iAnchorPos + aNewPromptText.Length() - iPromptTextLen)); |
354 |
346 |
355 // set new cursor position |
347 // set new cursor position |
356 |
348 |
358 iPreInlineEndPos += (aNewPromptText.Length() - iPromptTextLen); |
350 iPreInlineEndPos += (aNewPromptText.Length() - iPromptTextLen); |
359 iPreAutoStartPos += (aNewPromptText.Length() - iPromptTextLen); |
351 iPreAutoStartPos += (aNewPromptText.Length() - iPromptTextLen); |
360 iPreAutoEndPos += (aNewPromptText.Length() - iPromptTextLen); |
352 iPreAutoEndPos += (aNewPromptText.Length() - iPromptTextLen); |
361 iPreTextSelStartPos += (aNewPromptText.Length() - iPromptTextLen); |
353 iPreTextSelStartPos += (aNewPromptText.Length() - iPromptTextLen); |
362 iPreTextSelEndPos += (aNewPromptText.Length() - iPromptTextLen); |
354 iPreTextSelEndPos += (aNewPromptText.Length() - iPromptTextLen); |
|
355 |
363 } |
356 } |
364 |
357 |
365 const HBufC* CFepLayoutMultiLineIcfEditor::PromptText() |
358 const HBufC* CFepLayoutMultiLineIcfEditor::PromptText() |
366 { |
359 { |
367 return iPromptText; |
360 return iPromptText; |
368 } |
361 } |
369 |
362 |
370 void CFepLayoutMultiLineIcfEditor::SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent) |
363 void CFepLayoutMultiLineIcfEditor::SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent) |
371 { |
364 { |
|
365 |
372 if ( aCleanContent ) |
366 if ( aCleanContent ) |
373 { |
367 { |
374 //clean all the content (include prompt text) on the ICF |
368 //clean all the content (include prompt text) on the ICF |
375 TInt length = iRichText->DocumentLength(); |
369 TInt length = iRichText->DocumentLength(); |
376 iRichText->DeleteL( 0, length); |
370 iRichText->DeleteL( 0, length); |
378 iTextView->SetSelectionL( TCursorSelection(0, 0) ); |
372 iTextView->SetSelectionL( TCursorSelection(0, 0) ); |
379 iCursorSel = TCursorSelection(0, 0); |
373 iCursorSel = TCursorSelection(0, 0); |
380 iNoMatchState = EFalse; |
374 iNoMatchState = EFalse; |
381 } |
375 } |
382 else |
376 else |
383 { |
377 { |
384 if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| |
378 /*if ( ( ( !iInitPromptText && aPromptText.Length() == 0 ) )|| |
385 ( iInitPromptText && *iInitPromptText == aPromptText && |
379 ( iInitPromptText && *iInitPromptText == aPromptText && |
386 iPromptText && TextWidth(*iPromptText) <= iViewRect.Width()) ) |
380 iPromptText && TextWidth(*iPromptText) <= iViewRect.Width()) ) |
387 { |
381 { |
388 //prompt text has not been change then need not to be reset |
382 //prompt text has not been change then need not to be reset |
389 //but iLineSeparator may be changed, need reset prompt text |
383 //but iLineSeparator may be changed, need reset prompt text |
390 TBool newLineSeparator = iLineSeparator; |
384 return; |
391 if ( !iLineSeparator ) |
385 }*/ |
392 { |
|
393 newLineSeparator = ( TBidiText::TextDirectionality( aPromptText ) |
|
394 == TBidiText:: ERightToLeft ); |
|
395 } |
|
396 if ( newLineSeparator == iLineSeparator ) |
|
397 { |
|
398 return; |
|
399 } |
|
400 } |
|
401 //prompt text need to be reset and not clean the content |
386 //prompt text need to be reset and not clean the content |
402 iRichText->DeleteL( 0, iPromptTextLen ); |
387 iRichText->DeleteL( 0, iPromptTextLen ); |
403 iTextView->HandleInsertDeleteL(TCursorSelection(0, 0), iPromptTextLen ); |
388 iTextView->HandleInsertDeleteL(TCursorSelection(0, 0), iPromptTextLen ); |
404 } |
389 } |
405 |
390 |
443 prompttextLen = aPromptText.Length() + TBidiLogicalToVisual::KMinCharAvailable + 3 : |
428 prompttextLen = aPromptText.Length() + TBidiLogicalToVisual::KMinCharAvailable + 3 : |
444 prompttextLen = aPromptText.Length() + TBidiLogicalToVisual::KMinCharAvailable + 2; |
429 prompttextLen = aPromptText.Length() + TBidiLogicalToVisual::KMinCharAvailable + 2; |
445 iPromptText = HBufC::NewL(prompttextLen); |
430 iPromptText = HBufC::NewL(prompttextLen); |
446 TPtr text = iPromptText->Des(); |
431 TPtr text = iPromptText->Des(); |
447 |
432 |
448 TBuf<1> ptrEllipsis; |
433 TBuf<1> ptr0; |
449 ptrEllipsis.Append( KEllipsis ); |
434 ptr0.Append( KEllipsis ); |
450 |
435 |
451 TPtrC ptrSpace(&KSegment, 1); |
436 TPtrC ptr1(&KSegment, 1); |
452 TPtrC ptrColon(&KColon, 1); |
437 TPtrC ptr2(&KSeparator, 1); |
453 |
438 |
454 TInt separatorLen = TextWidth(ptrSpace) + TextWidth(ptrColon) + TextWidth(ptrEllipsis); |
439 TInt separatorLen = TextWidth(ptr1) + TextWidth(ptr2) + TextWidth(ptr0); |
455 TInt textWidth = TextWidth(aPromptText); |
440 TInt textWidth = TextWidth(aPromptText) + separatorLen; |
456 |
441 TBool ret = EFalse; |
457 if ((aPromptText.LocateReverse(KColon) != aPromptText.Length() - 1) && |
442 |
458 (aPromptText.LocateReverse(KColoncn) != aPromptText.Length() - 1)) |
443 if (textWidth >= iViewRect.Width() ) |
459 { |
444 { |
460 textWidth += TextWidth(ptrSpace) + TextWidth(ptrColon); |
445 ret = ETrue; |
461 } |
|
462 |
|
463 else |
|
464 { |
|
465 textWidth += TextWidth(ptrSpace); |
|
466 } |
|
467 |
|
468 TBool truncated = EFalse; |
|
469 |
|
470 if (textWidth > iViewRect.Width() ) |
|
471 { |
|
472 truncated = ETrue; |
|
473 AknBidiTextUtils::ConvertToVisualAndClip(aPromptText, |
446 AknBidiTextUtils::ConvertToVisualAndClip(aPromptText, |
474 text, |
447 text, |
475 *iFont, |
448 *iFont, |
476 iViewRect.Width() - separatorLen - KPromptAdjustLen, |
449 iViewRect.Width() - separatorLen - KPromptAdjustLen, |
477 iViewRect.Width() - separatorLen - KPromptAdjustLen, |
450 iViewRect.Width() - separatorLen - KPromptAdjustLen, |
489 for ( ;(text.Length() > 0 && text.LocateReverse(KSegment) == text.Length()-1 ); ) |
462 for ( ;(text.Length() > 0 && text.LocateReverse(KSegment) == text.Length()-1 ); ) |
490 { |
463 { |
491 text.Delete( text.Length()-1, 1 ); |
464 text.Delete( text.Length()-1, 1 ); |
492 } |
465 } |
493 |
466 |
494 if ((text.LocateReverse(KColon) != text.Length() - 1) && |
467 if ((text.LocateReverse(KSeparator) != text.Length() - 1) && |
495 (text.LocateReverse(KColoncn) != text.Length() - 1)) |
468 (text.LocateReverse(KSeparatorcn) != text.Length() - 1)) |
496 { |
469 { |
497 // if sent prompt text already include separator, then no need to |
470 // if sent prompt text already include separator, then no need to |
498 // append it again |
471 // append it again |
499 if (truncated) |
472 if ( ret ) |
500 { |
473 { |
501 text.Append( ptrEllipsis ); |
474 text.Append( ptr0 ); |
502 } |
475 } |
503 text.Append(ptrColon); |
476 text.Append(ptr2); |
504 } |
477 } |
505 else if (truncated) |
478 else if ( ret ) |
506 { |
479 { |
507 text.Insert( text.Length()-1, ptrEllipsis ); |
480 text.Insert( text.Length()-1, ptr0 ); |
508 } |
481 } |
509 |
482 |
510 text.Append(ptrSpace); // segment between prompt text and official text |
483 text.Append(ptr1); // segment between prompt text and official text |
511 textWidth = TextWidth(text); |
484 textWidth = TextWidth(text); |
512 |
485 |
513 iRichText->InsertL(0, text); |
486 iRichText->InsertL(0, text); |
514 iTextView->HandleInsertDeleteL(TCursorSelection(0, text.Length()), |
487 iTextView->HandleInsertDeleteL(TCursorSelection(0, text.Length()), |
515 0); |
488 0); |
557 { |
530 { |
558 TInt delLen = iRichText->DocumentLength() - iPromptTextLen; |
531 TInt delLen = iRichText->DocumentLength() - iPromptTextLen; |
559 iRichText->DeleteL(iPromptTextLen, delLen ); |
532 iRichText->DeleteL(iPromptTextLen, delLen ); |
560 iTextView->HandleInsertDeleteL(TCursorSelection(iPromptTextLen, iPromptTextLen), |
533 iTextView->HandleInsertDeleteL(TCursorSelection(iPromptTextLen, iPromptTextLen), |
561 delLen); |
534 delLen); |
562 iTextView->SetSelectionL(TCursorSelection(iPromptTextLen, iPromptTextLen)); |
|
563 } |
535 } |
564 ptr.Copy(icfdata.iText); |
536 ptr.Copy(icfdata.iText); |
565 } |
537 } |
566 break; |
538 break; |
567 case EPeninputICFReplace: |
539 case EPeninputICFReplace: |
979 editArea->iSecretTextTimer->Cancel(); |
948 editArea->iSecretTextTimer->Cancel(); |
980 return KErrNone; |
949 return KErrNone; |
981 } |
950 } |
982 TPtrC icftext = editArea->iRichText->Read(editArea->iPromptTextLen, |
951 TPtrC icftext = editArea->iRichText->Read(editArea->iPromptTextLen, |
983 editArea->iRichText->DocumentLength()); |
952 editArea->iRichText->DocumentLength()); |
984 |
953 TInt startPos = icftext.LocateReverse(KStar) + 1 + editArea->iPromptTextLen; |
985 for (TInt i = 0; i < icftext.Length(); i++) |
954 |
986 { |
955 TBuf<1> buf; |
987 if (icftext[i] != KStar)//find only one none-star char |
956 buf.Append(KStar); |
988 { |
957 |
989 TInt startPos = i + editArea->iPromptTextLen; |
958 TInt textlen = editArea->iRichText->DocumentLength(); |
990 TBuf<1> buf; |
959 |
991 buf.Append(KStar); |
960 if (startPos < textlen) |
992 |
961 { |
993 TInt textlen = editArea->iRichText->DocumentLength(); |
962 editArea->iRichText->DeleteL(startPos, 1); |
994 |
963 editArea->iTextView->HandleInsertDeleteL(TCursorSelection(startPos, startPos), 1); |
995 if (startPos < textlen) |
964 editArea->iRichText->InsertL(startPos, buf); |
996 { |
965 editArea->iTextView->HandleInsertDeleteL(TCursorSelection(startPos, startPos+buf.Length()), |
997 editArea->iRichText->DeleteL(startPos, 1); |
966 0); |
998 editArea->iTextView->HandleInsertDeleteL(TCursorSelection( |
967 |
999 startPos, startPos), 1); |
968 if (startPos == textlen - 1) |
1000 editArea->iRichText->InsertL(startPos, buf); |
969 { |
1001 editArea->iTextView->HandleInsertDeleteL(TCursorSelection( |
970 editArea->iSecretTextTimer->Cancel(); |
1002 startPos, startPos + buf.Length()), 0); |
971 } |
1003 |
972 } |
1004 if (startPos == textlen - 1) |
|
1005 { |
|
1006 editArea->iSecretTextTimer->Cancel(); |
|
1007 } |
|
1008 } |
|
1009 break; |
|
1010 } |
|
1011 } |
|
1012 |
|
1013 if ( editArea->iCursorVisible ) |
|
1014 { |
|
1015 editArea->SetSelectionL( editArea->iCursorSel ); |
|
1016 editArea->Draw(); |
|
1017 } |
|
1018 editArea->UpdateArea(editArea->Rect(),EFalse); |
973 editArea->UpdateArea(editArea->Rect(),EFalse); |
1019 return KErrNone; |
974 return KErrNone; |
1020 } |
975 } |
1021 |
976 |
1022 void CFepLayoutMultiLineIcfEditor::UpdateSecretTextL() |
977 void CFepLayoutMultiLineIcfEditor::UpdateSecretTextL() |
1036 void CFepLayoutMultiLineIcfEditor::SetDimmed(TBool aDimFlag) |
991 void CFepLayoutMultiLineIcfEditor::SetDimmed(TBool aDimFlag) |
1037 { |
992 { |
1038 iDimmed = aDimFlag; |
993 iDimmed = aDimFlag; |
1039 } |
994 } |
1040 |
995 |
1041 void CFepLayoutMultiLineIcfEditor::SetFontL(const CFont* aFont) |
996 void CFepLayoutMultiLineIcfEditor::SetFontL(TInt aFontHeight, |
1042 { |
997 TInt aMaxFontHeight, |
1043 TInt newHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(aFont->HeightInPixels()); |
998 const CFont* aFont) |
|
999 { |
|
1000 TInt newHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(aFontHeight); |
1044 TInt OldHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight); |
1001 TInt OldHeightInPixel = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight); |
1045 |
1002 |
1046 if( newHeightInPixel == OldHeightInPixel ) |
1003 if( newHeightInPixel == OldHeightInPixel ) |
1047 { |
1004 { |
1048 return; |
1005 return; |
1050 else |
1007 else |
1051 { |
1008 { |
1052 iFormatChange = ETrue; |
1009 iFormatChange = ETrue; |
1053 } |
1010 } |
1054 |
1011 |
1055 TFontSpec fontSpec; |
1012 iMaxFontHeight = aMaxFontHeight; |
1056 fontSpec = aFont->FontSpecInTwips(); |
1013 iFontHeight = aFontHeight; |
1057 fontSpec.iHeight = aFont->HeightInPixels(); |
1014 iFont = aFont; |
1058 CFont* font; |
|
1059 iCoeEnv->ScreenDevice()->ReleaseFont(CONST_CAST(CFont*, iFont)); |
|
1060 iCoeEnv->ScreenDevice()->GetNearestFontInPixels((CFont*&)font,fontSpec); |
|
1061 |
|
1062 iMaxFontHeight = font->FontMaxHeight(); |
|
1063 iFontHeight = font->HeightInPixels(); |
|
1064 iFont = font; |
|
1065 |
1015 |
1066 |
1016 |
1067 iCharFormatMask.ClearAttrib( EAttFontUnderline ); |
1017 iCharFormatMask.ClearAttrib( EAttFontUnderline ); |
1068 iCharFormatMask.SetAttrib(EAttFontHeight); |
1018 iCharFormatMask.SetAttrib(EAttFontHeight); |
1069 iCharFormatMask.SetAttrib(EAttFontStrokeWeight); |
1019 iCharFormatMask.SetAttrib(EAttFontStrokeWeight); |
1070 iCharFormatMask.SetAttrib(EAttFontTypeface); |
1020 iCharFormatMask.SetAttrib(EAttFontTypeface); |
1071 |
1021 |
1072 iCharFormat.iFontSpec.iHeight = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight); |
1022 iCharFormat.iFontSpec.iHeight = iCoeEnv->ScreenDevice()->VerticalPixelsToTwips(iFontHeight); |
1073 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
1023 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
1074 iCharFormat.iFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
1024 iCharFormat.iFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
1075 iCharFormat.iFontSpec.iTypeface = iFont->FontSpecInTwips().iTypeface; |
|
1076 |
1025 |
1077 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, iRichText->DocumentLength()); |
1026 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, iRichText->DocumentLength()); |
1078 if( InlineStateOn() || AutoCompletionStateOn() ) |
1027 if( InlineStateOn() || AutoCompletionStateOn() ) |
1079 { |
1028 { |
1080 iCharFormatMask.ClearAll(); |
1029 iCharFormatMask.ClearAll(); |
1081 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
1030 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
1082 iCharFormat.iFontPresentation.iUnderline = EUnderlineOn ; |
1031 iCharFormat.iFontPresentation.iUnderline = EUnderlineOn ; |
1083 if( iPreInlineStartPos >= 0 && iPreInlineEndPos <= iRichText->DocumentLength() + 1 ) |
1032 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, |
1084 { |
1033 iPreInlineEndPos - iPreInlineStartPos); |
1085 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, |
|
1086 iPreInlineEndPos - iPreInlineStartPos); |
|
1087 } |
|
1088 } |
1034 } |
1089 |
1035 |
1090 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, iRichText->DocumentLength() - iPromptTextLen); |
1036 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, iRichText->DocumentLength() - iPromptTextLen); |
1091 |
1037 |
1092 SetPromptTextFormatL( iPromptTextLen ); |
1038 SetPromptTextFormatL( iPromptTextLen ); |
1206 iInsertionPoint->SetPosition( TPoint(rect.iTl.iX + width1 + iOffset,rect.iTl.iY )); |
1152 iInsertionPoint->SetPosition( TPoint(rect.iTl.iX + width1 + iOffset,rect.iTl.iY )); |
1207 |
1153 |
1208 TInt baseLine = iFont->AscentInPixels()/2 + rect.Height()/2; |
1154 TInt baseLine = iFont->AscentInPixels()/2 + rect.Height()/2; |
1209 |
1155 |
1210 TRect clipRect = |
1156 TRect clipRect = |
1211 TRect( TPoint(Rect().iTl.iX + 1, rect.iTl.iY), TPoint( Rect().iBr.iX - 1, rect.iBr.iY)); |
1157 TRect( TPoint(Rect().iTl.iX, rect.iTl.iY), TPoint( Rect().iBr.iX, rect.iBr.iY)); |
1212 |
1158 |
1213 gc->SetClippingRect( clipRect ); |
1159 gc->SetClippingRect( clipRect ); |
1214 gc->Clear( clipRect ); |
1160 gc->Clear( clipRect ); |
1215 |
1161 |
1216 DrawOpaqueMaskBackground( clipRect ); |
1162 DrawOpaqueMaskBackground( clipRect ); |
1217 DrawBackground( clipRect ); |
1163 DrawBackground( clipRect ); |
1218 |
1164 |
1219 if (iSkinIdSet) |
1165 if (iSkinIdSet) |
1220 { |
1166 { |
1221 AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), |
1167 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), |
1222 *gc, |
1168 *gc, |
1223 Rect(), |
1169 Rect(), |
1224 Rect(), |
1170 Rect(), |
1225 BgImgSkinId(), |
1171 BgImgSkinId(), |
1226 KAknsIIDDefault); |
1172 KAknsIIDDefault); |
1379 { |
1323 { |
1380 iViewRect.iBr.iY -= margin; |
1324 iViewRect.iBr.iY -= margin; |
1381 } |
1325 } |
1382 iTextView->SetViewRect(iViewRect); |
1326 iTextView->SetViewRect(iViewRect); |
1383 } |
1327 } |
1384 |
|
1385 void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRectAccordingToLanguage() |
|
1386 { |
|
1387 if ( iPreLanguageID == ELangPrcChinese || |
|
1388 iPreLanguageID == ELangHongKongChinese || |
|
1389 iPreLanguageID == ELangTaiwanChinese || |
|
1390 iPreLanguageID == ELangKorean ) |
|
1391 { |
|
1392 SetMsgBubbleRect(); |
|
1393 return; |
|
1394 } |
|
1395 else |
|
1396 { |
|
1397 if(( !iMsgBubble->IsShowing() && !iHideBubbleTemp ) || |
|
1398 iLineMaxCount < 1 || iCursorSel.iCursorPos < 0 ) |
|
1399 { |
|
1400 return; |
|
1401 } |
|
1402 |
|
1403 iMsgBubble->Popup( iMsgBubble->Rect()); |
|
1404 iHideBubbleTemp = EFalse; |
|
1405 |
|
1406 return; |
|
1407 } |
|
1408 } |
|
1409 |
1328 |
1410 void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRect() |
1329 void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRect() |
1411 { |
1330 { |
1412 if( ( !iMsgBubble->IsShowing() && !iHideBubbleTemp ) || |
1331 if( ( !iMsgBubble->IsShowing() && !iHideBubbleTemp ) || |
1413 iLineMaxCount < 1 || iCursorSel.iCursorPos < 0 ) |
1332 iLineMaxCount < 1 || iCursorSel.iCursorPos < 0 ) |
1645 { |
1564 { |
1646 TPoint leftTop = TPoint(Rect().iBr.iX-iInfoBubble->Rect().Width(),Rect().iTl.iY); |
1565 TPoint leftTop = TPoint(Rect().iBr.iX-iInfoBubble->Rect().Width(),Rect().iTl.iY); |
1647 iInfoBubble->SetRect( TRect(leftTop,aSize) ) ; |
1566 iInfoBubble->SetRect( TRect(leftTop,aSize) ) ; |
1648 } |
1567 } |
1649 |
1568 |
1650 void CFepLayoutMultiLineIcfEditor::ShowTooltipL( const TDesC& aText, |
1569 void CFepLayoutMultiLineIcfEditor::ShowTooltipL(const TDesC& aText) |
1651 const TRect& aRect, |
|
1652 TInt aLangCode ) |
|
1653 { |
1570 { |
1654 if ( !iTooltip ) |
1571 if ( !iTooltip ) |
1655 { |
1572 { |
1656 return; |
1573 return; |
1657 } |
1574 } |
1658 |
1575 |
1659 iTooltip->SetTextL( aText ); |
1576 iTooltip->SetTextL( aText ); |
1660 iTooltip->SetLangCode( aLangCode ); |
1577 TPoint tl = iInsertionPoint->Position(); |
1661 TPoint tl( 0, 0 ), br( 0, 0 ); |
|
1662 InlineTextPos( tl, br ); |
|
1663 |
|
1664 if ( iLineMaxCount > 1 ) |
1578 if ( iLineMaxCount > 1 ) |
1665 { |
1579 { |
1666 TBool firstLine = iLayout->FirstLineInBand() == iLineNumber; |
1580 TBool firstLine = iLayout->FirstLineInBand() == iLineNumber; |
1667 if ( firstLine ) |
1581 if ( firstLine ) |
1668 { |
1582 { |
1669 tl.iY += KTooltipPosAdjustValueY; |
1583 tl.iY += iInsertionPoint->Height(); |
1670 } |
1584 } |
1671 else |
1585 else |
1672 { |
1586 { |
1673 tl.iY -= ( iFormatLineHeight + aRect.Height() - KTooltipPosAdjustValueY ); |
1587 tl.iY -= iTooltip->Rect().Height(); |
1674 } |
1588 } |
1675 } |
1589 } |
1676 |
1590 TRect tooltipRect = TRect( tl, iTooltip->Rect().Size() ); |
1677 TRect tooltipRect = TRect( tl, aRect.Size() ); |
1591 |
1678 |
|
1679 // Make sure the right border of tooltip isn't be out of icf rect |
|
1680 TInt moveX = tooltipRect.iBr.iX - Rect().iBr.iX; |
1592 TInt moveX = tooltipRect.iBr.iX - Rect().iBr.iX; |
1681 if ( moveX > 0 ) |
1593 if ( moveX > 0 ) |
1682 { |
1594 { |
1683 tooltipRect.iBr.iX -= moveX; |
1595 tooltipRect.iBr.iX -= moveX; |
1684 tooltipRect.iTl.iX -= moveX; |
1596 tooltipRect.iTl.iX -= moveX; |
1685 } |
1597 } |
1686 |
1598 |
1687 // Make sure tooltip isn't overlapped by msg bubble. |
|
1688 if ( tooltipRect.Intersects( iMsgBubble->Rect() ) ) |
1599 if ( tooltipRect.Intersects( iMsgBubble->Rect() ) ) |
1689 { |
1600 { |
1690 moveX = tooltipRect.iBr.iX - iMsgBubble->Rect().iTl.iX; |
1601 moveX = tooltipRect.iBr.iX - iMsgBubble->Rect().iTl.iX; |
1691 if ( moveX > 0 && tooltipRect.iTl.iX - moveX >= Rect().iTl.iX ) |
1602 if ( moveX > 0 && tooltipRect.iTl.iX - moveX >= Rect().iTl.iX ) |
1692 { |
1603 { |
1727 } |
1632 } |
1728 } |
1633 } |
1729 } |
1634 } |
1730 |
1635 |
1731 void CFepLayoutMultiLineIcfEditor::SizeChangedL(const TRect& aRect, |
1636 void CFepLayoutMultiLineIcfEditor::SizeChangedL(const TRect& aRect, |
1732 TInt /*aFontHeight*/, |
1637 TInt aFontHeight, |
1733 TInt /*aMaxFontHeight*/, |
1638 TInt aMaxFontHeight, |
1734 const CFont* aFont) |
1639 const CFont* aFont) |
1735 { |
1640 { |
1736 TRect oriRect = Rect(); |
1641 TRect oriRect = Rect(); |
1737 |
1642 |
1738 AdjustBmpDeviceIfNeeded(); |
1643 AdjustBmpDeviceIfNeeded(); |
1739 // apply font formats |
1644 // apply font formats |
1740 SetFontL( aFont); |
1645 SetFontL(aFontHeight, aMaxFontHeight, aFont); |
1741 |
1646 |
1742 if ( !iFormatChange && oriRect == aRect ) |
1647 if ( !iFormatChange && oriRect == aRect ) |
1743 { |
1648 { |
1744 return; |
1649 return; |
1745 } |
1650 } |
1779 if( ready ) |
1684 if( ready ) |
1780 { |
1685 { |
1781 SetReady( ETrue ); |
1686 SetReady( ETrue ); |
1782 } |
1687 } |
1783 |
1688 |
1784 // if ( iFormatChange ) |
1689 if ( iFormatChange ) |
1785 // { |
1690 { |
1786 // iTextView->SetSelectionL( iTextView->Selection() ); |
1691 iTextView->SetSelectionL( iTextView->Selection() ); |
1787 // RecalcualteTextPositionL(); |
1692 RecalcualteTextPositionL(); |
1788 // SetMsgBubbleRect(); |
1693 SetMsgBubbleRect(); |
1789 // Draw(); |
1694 Draw(); |
1790 // } |
1695 } |
1791 iTextView->HandleGlobalChangeNoRedrawL(); |
|
1792 iTextView->SetSelectionL( iTextView->Selection() ); |
|
1793 RecalcualteTextPositionL(); |
|
1794 //SetMsgBubbleRect(); |
|
1795 SetMsgBubbleRectAccordingToLanguage(); |
|
1796 Draw(); |
|
1797 } |
1696 } |
1798 |
1697 |
1799 TBool CFepLayoutMultiLineIcfEditor::BelongToPromptText(TInt aPos) |
1698 TBool CFepLayoutMultiLineIcfEditor::BelongToPromptText(TInt aPos) |
1800 { |
1699 { |
1801 if (!iPromptText || iPromptText->Length() == 0 ) |
1700 if (!iPromptText || iPromptText->Length() == 0 ) |
1914 |
1813 |
1915 } |
1814 } |
1916 break; |
1815 break; |
1917 case CFepLayoutMultiLineIcf::EIcfAutoComplete: |
1816 case CFepLayoutMultiLineIcf::EIcfAutoComplete: |
1918 { |
1817 { |
1919 if ( iTextView->Selection().iCursorPos >= iPreInlineStartPos |
1818 if (iTextView->Selection().iCursorPos >= iPreInlineStartPos && |
1920 && iTextView->Selection().iCursorPos < iPreAutoEndPos ) |
1819 iTextView->Selection().iCursorPos < iPreInlineEndPos ) |
1921 { |
1820 { |
1922 iPntDownOnInline = ETrue; |
1821 iPntDownOnInline = ETrue; |
1923 CapturePointer(EFalse); |
1822 CapturePointer(EFalse); |
1924 if (iTooltip && iTooltip->IsShowing()) |
1823 if (iTooltip && iTooltip->IsShowing()) |
1925 { |
1824 { |
1928 else |
1827 else |
1929 { |
1828 { |
1930 ReportEvent(EEventPointerDownOnInline); |
1829 ReportEvent(EEventPointerDownOnInline); |
1931 } |
1830 } |
1932 } |
1831 } |
|
1832 else |
|
1833 { |
|
1834 // do nothing |
|
1835 //submit autocomplete when set text |
|
1836 if (iTooltip && !iTooltip->IsShowing()) |
|
1837 { |
|
1838 ReportEvent( EEventControlFocusGained ); |
|
1839 UiLayout()->SignalOwner( ESignalCommitITIInlineText ); |
|
1840 SetInlineStateL( EFalse, iPreInlineStartPos, iPreInlineEndPos ); |
|
1841 SetAutoCompleteStateL( EFalse ); |
|
1842 } |
|
1843 } |
1933 } |
1844 } |
1934 break; |
1845 break; |
1935 case CFepLayoutMultiLineIcf::EIcfNormal: |
1846 case CFepLayoutMultiLineIcf::EIcfNormal: |
1936 { |
1847 { |
1937 if (preCursorPos != iCursorSel.iCursorPos) |
1848 if (preCursorPos != iCursorSel.iCursorPos) |
1985 { |
1896 { |
1986 TInt cursorPos = iFont->TextCount(iMfneIcfData->Des(), aPt.iX - iViewRect.iTl.iX - iOffset ); |
1897 TInt cursorPos = iFont->TextCount(iMfneIcfData->Des(), aPt.iX - iViewRect.iTl.iX - iOffset ); |
1987 iCursorSel = TCursorSelection(cursorPos+iPromptTextLen, |
1898 iCursorSel = TCursorSelection(cursorPos+iPromptTextLen, |
1988 iCursorSel.iAnchorPos); |
1899 iCursorSel.iAnchorPos); |
1989 AdjustFepCursorPosForPromptText( ETrue ); |
1900 AdjustFepCursorPosForPromptText( ETrue ); |
1990 |
|
1991 TAmPmName amName(EAm); |
|
1992 TAmPmName pmName(EPm); |
|
1993 TInt offset = iMfneIcfData->Find(amName)!= KErrNotFound? |
|
1994 iMfneIcfData->Find(amName):iMfneIcfData->Find(pmName); |
|
1995 //if current is 12-hour format and touch on correct position |
|
1996 if(offset != KErrNotFound && |
|
1997 iCursorSel.LowerPos()-iPromptTextLen>= offset && |
|
1998 iCursorSel.LowerPos()-iPromptTextLen<= offset+amName.Length()) |
|
1999 { |
|
2000 UiLayout()->SignalOwner(ESignalChangeAmPm); |
|
2001 } |
|
2002 |
|
2003 return this; |
1901 return this; |
2004 } |
1902 } |
2005 |
1903 |
2006 if (!iPntDownOnInline) |
1904 if (!iPntDownOnInline) |
2007 { |
1905 { |
2162 #ifdef RD_TACTILE_FEEDBACK |
2064 #ifdef RD_TACTILE_FEEDBACK |
2163 if (UiLayout()->SupportTactileFeedback()) |
2065 if (UiLayout()->SupportTactileFeedback()) |
2164 { |
2066 { |
2165 if ( iLastCursorPos != iCursorSel.iCursorPos ) |
2067 if ( iLastCursorPos != iCursorSel.iCursorPos ) |
2166 { |
2068 { |
2167 UiLayout()->DoTactileFeedback(ETouchFeedbackEdit); |
2069 UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveKeypad); |
2168 iLastCursorPos = iCursorSel.iCursorPos; |
2070 iLastCursorPos = iCursorSel.iCursorPos; |
2169 } |
2071 } |
2170 } |
2072 } |
2171 #endif //RD_TACTILE_FEEDBACK |
2073 #endif //RD_TACTILE_FEEDBACK |
2172 |
2074 |
2550 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
2452 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
2551 iCharFormatMask.SetAttrib( EAttColor ); |
2453 iCharFormatMask.SetAttrib( EAttColor ); |
2552 iCharFormat.iFontPresentation.iTextColor = iTextColor; |
2454 iCharFormat.iFontPresentation.iTextColor = iTextColor; |
2553 |
2455 |
2554 // set prompt text as bold |
2456 // set prompt text as bold |
2555 if( aPromptTextLen <= iRichText->DocumentLength() + 1) |
2457 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1 |
2556 { |
|
2557 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1 |
|
2558 } |
|
2559 iTextView->HandleRangeFormatChangeL(TCursorSelection(0, aPromptTextLen ), ETrue);//- 1 |
2458 iTextView->HandleRangeFormatChangeL(TCursorSelection(0, aPromptTextLen ), ETrue);//- 1 |
2560 |
2459 |
2561 // set remain text as non-bold |
2460 // set remain text as non-bold |
2562 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
2461 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
2563 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, aPromptTextLen - 1); |
2462 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, aPromptTextLen - 1); |
2591 return; |
2490 return; |
2592 } |
2491 } |
2593 |
2492 |
2594 iCharFormatMask.SetAttrib(aAttribute); |
2493 iCharFormatMask.SetAttrib(aAttribute); |
2595 |
2494 |
2596 // comment for updating format anyway. |
2495 if (IsTextPosValid(aPreStartPos) && IsTextPosValid(aPreEndPos)) |
2597 //if (IsTextPosValid(aPreStartPos) && IsTextPosValid(aPreEndPos)) |
2496 { |
2598 //{ |
2497 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, |
2599 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, |
|
2600 iRichText->DocumentLength()); |
2498 iRichText->DocumentLength()); |
2601 //iTextView->HandleRangeFormatChangeL(TCursorSelection(aPreStartPos, aPreEndPos), ETrue); |
2499 //iTextView->HandleRangeFormatChangeL(TCursorSelection(aPreStartPos, aPreEndPos), ETrue); |
2602 //} |
2500 } |
2603 |
2501 |
2604 aPreStartPos = 0; |
2502 aPreStartPos = 0; |
2605 aPreEndPos = 0; |
2503 aPreEndPos = 0; |
2606 |
2504 |
2607 if (aStateOn) |
2505 if (aStateOn) |
2617 { |
2515 { |
2618 iCharFormat.iFontPresentation.iTextColor = iTextAutoColor; |
2516 iCharFormat.iFontPresentation.iTextColor = iTextAutoColor; |
2619 } |
2517 } |
2620 iCharFormatMask.SetAttrib(aAttribute); |
2518 iCharFormatMask.SetAttrib(aAttribute); |
2621 |
2519 |
2622 TInt aPos = Min( aStartPos, aEndPos ); |
|
2623 TInt aLength = Abs( aEndPos - aStartPos ); |
|
2624 if (aNoMatchState) |
2520 if (aNoMatchState) |
2625 { |
2521 { |
2626 if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength()) |
2522 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, |
2627 { |
2523 Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) + 1); |
2628 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aPos, aLength + 1); |
2524 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue); |
2629 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue); |
|
2630 } |
|
2631 } |
2525 } |
2632 else |
2526 else |
2633 { |
2527 { |
2634 if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength() + 1 ) |
2528 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, |
2635 { |
2529 Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) ); |
2636 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aStartPos, aLength ); |
2530 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue); |
2637 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue); |
|
2638 } |
|
2639 } |
2531 } |
2640 |
2532 |
2641 aPreStartPos = aStartPos; |
2533 aPreStartPos = aStartPos; |
2642 aPreEndPos = aEndPos; |
2534 aPreEndPos = aEndPos; |
2643 } |
2535 } |
2742 |
2634 |
2743 void CFepLayoutMultiLineIcfEditor::ShowBubble(const TDesC& aText, const TRect& /*aRect*/) |
2635 void CFepLayoutMultiLineIcfEditor::ShowBubble(const TDesC& aText, const TRect& /*aRect*/) |
2744 { |
2636 { |
2745 TRAP_IGNORE(iMsgBubble->SetTextL(aText)); |
2637 TRAP_IGNORE(iMsgBubble->SetTextL(aText)); |
2746 iHideBubbleTemp = ETrue; |
2638 iHideBubbleTemp = ETrue; |
2747 //SetMsgBubbleRect(); |
2639 SetMsgBubbleRect(); |
2748 SetMsgBubbleRectAccordingToLanguage(); |
|
2749 } |
2640 } |
2750 |
2641 |
2751 void CFepLayoutMultiLineIcfEditor::ShowByteWarningBubble(const TDesC& aInfo) |
2642 void CFepLayoutMultiLineIcfEditor::ShowByteWarningBubble(const TDesC& aInfo) |
2752 { |
2643 { |
2753 TSize size = iInfoBubble->Rect().Size(); |
2644 TSize size = iInfoBubble->Rect().Size(); |
2754 CFont::TMeasureTextInput input;// = new (ELeave) CFont::TMeasureTextInput; |
2645 CFont::TMeasureTextInput* input = new (ELeave) CFont::TMeasureTextInput; |
2755 input.iMaxBounds = iRect.Width(); |
2646 CleanupStack::PushL(input); |
2756 TInt width = iFont->MeasureText(aInfo, &input, NULL); |
2647 input->iMaxBounds = iRect.Width(); |
|
2648 TInt width = iFont->MeasureText(aInfo, input, NULL); |
|
2649 CleanupStack::PopAndDestroy(); |
2757 size.SetSize(width, size.iHeight); |
2650 size.SetSize(width, size.iHeight); |
2758 SetInfoBubbleCtrlSize(size); |
2651 SetInfoBubbleCtrlSize(size); |
2759 TRAP_IGNORE(iInfoBubble->SetTextL(aInfo)); |
2652 TRAP_IGNORE(iInfoBubble->SetTextL(aInfo)); |
2760 iHideInfoBubbleTemp = ETrue; |
2653 iHideInfoBubbleTemp = ETrue; |
2761 SetInfoBubbleRect(); |
2654 SetInfoBubbleRect(); |
2821 } |
2714 } |
2822 } |
2715 } |
2823 |
2716 |
2824 void CFepLayoutMultiLineIcfEditor::ResetApplyFont() |
2717 void CFepLayoutMultiLineIcfEditor::ResetApplyFont() |
2825 { |
2718 { |
2826 //TInt fontHeight = iFontHeight; |
2719 TInt fontHeight = iFontHeight; |
2827 //TInt maxFontHeight = iMaxFontHeight; |
2720 TInt maxFontHeight = iMaxFontHeight; |
2828 const CFont *font = iFont; |
2721 const CFont *font = iFont; |
2829 |
2722 |
2830 iFontHeight = 0; |
2723 iFontHeight = 0; |
2831 TRAP_IGNORE(SetFontL(font)); |
2724 TRAP_IGNORE(SetFontL(fontHeight, maxFontHeight, font)); |
2832 } |
2725 } |
2833 |
2726 |
2834 void CFepLayoutMultiLineIcfEditor::TryDisplayMaxTextL( TInt aCursorPos ) |
2727 void CFepLayoutMultiLineIcfEditor::TryDisplayMaxTextL( TInt aCursorPos ) |
2835 { |
2728 { |
2836 iTextView->FinishBackgroundFormattingL(); |
2729 iTextView->FinishBackgroundFormattingL(); |
2843 CalculateCursorPos(cursorPt); |
2736 CalculateCursorPos(cursorPt); |
2844 if ( !iViewRect.Contains( cursorPt ) && ( lineIndex + 1 ) > ( iLineMaxCount - 1 ) ) |
2737 if ( !iViewRect.Contains( cursorPt ) && ( lineIndex + 1 ) > ( iLineMaxCount - 1 ) ) |
2845 { |
2738 { |
2846 iTextView->SetViewLineAtTopL(( lineIndex + 1 ) - ( iLineMaxCount - 1 )); |
2739 iTextView->SetViewLineAtTopL(( lineIndex + 1 ) - ( iLineMaxCount - 1 )); |
2847 RecalcualteTextPositionL(); |
2740 RecalcualteTextPositionL(); |
2848 //SetMsgBubbleRect(); |
2741 SetMsgBubbleRect(); |
2849 SetMsgBubbleRectAccordingToLanguage(); |
|
2850 } |
2742 } |
2851 } |
2743 } |
2852 |
2744 |
2853 const TInt lineCount = iLayout->NumFormattedLines(); |
2745 const TInt lineCount = iLayout->NumFormattedLines(); |
2854 |
2746 |
2863 |
2755 |
2864 iTextView->SetViewLineAtTopL( |
2756 iTextView->SetViewLineAtTopL( |
2865 lineCount - pageCount + 1 < 1 ? 1 : lineCount - pageCount + 1 ); |
2757 lineCount - pageCount + 1 < 1 ? 1 : lineCount - pageCount + 1 ); |
2866 |
2758 |
2867 RecalcualteTextPositionL(); |
2759 RecalcualteTextPositionL(); |
2868 //SetMsgBubbleRect(); |
2760 SetMsgBubbleRect(); |
2869 SetMsgBubbleRectAccordingToLanguage(); |
|
2870 } |
2761 } |
2871 } |
2762 } |
2872 } |
2763 } |
2873 |
2764 |
2874 void CFepLayoutMultiLineIcfEditor::DrawIcfBackground( CFbsBitGc& /*aGc*/, const TRect& aDrawnRect, |
2765 void CFepLayoutMultiLineIcfEditor::DrawIcfBackground( CFbsBitGc& /*aGc*/, const TRect& aDrawnRect, |
2902 |
2793 |
2903 iCursorSel = aCurSel; |
2794 iCursorSel = aCurSel; |
2904 |
2795 |
2905 if ( BelongToPromptText(aCurSel.iCursorPos) ) |
2796 if ( BelongToPromptText(aCurSel.iCursorPos) ) |
2906 { |
2797 { |
2907 //why to use iPromptText->Length() instead of iPromptTextLen |
2798 //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen |
2908 //iCursorSel.iCursorPos = iPromptTextLen; |
2799 //iCursorSel.iCursorPos = iPromptTextLen; |
2909 iCursorSel.iCursorPos = iPromptText->Length(); |
2800 iCursorSel.iCursorPos = iPromptText->Length(); |
2910 } |
2801 } |
2911 if ( BelongToPromptText(aCurSel.iAnchorPos) ) |
2802 if ( BelongToPromptText(aCurSel.iAnchorPos) ) |
2912 { |
2803 { |
2913 //why to use iPromptText->Length() instead of iPromptTextLen |
2804 //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen |
2914 //iCursorSel.iAnchorPos = iPromptTextLen; |
2805 //iCursorSel.iAnchorPos = iPromptTextLen; |
2915 iCursorSel.iAnchorPos = iPromptText->Length(); |
2806 iCursorSel.iAnchorPos = iPromptText->Length(); |
2916 } |
2807 } |
2917 |
2808 |
2918 iTextView->SetSelectionL( iCursorSel ); |
2809 iTextView->SetSelectionL( iCursorSel ); |
3068 TInt code = text[i]; |
2959 TInt code = text[i]; |
3069 |
2960 |
3070 CPeninputSmileyImage* smiley = iSmileyManager->SmileyImage( code ); |
2961 CPeninputSmileyImage* smiley = iSmileyManager->SmileyImage( code ); |
3071 if ( smiley ) |
2962 if ( smiley ) |
3072 { |
2963 { |
|
2964 gc.SetBrushColor( TRgb(255,0,0) ); |
3073 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
2965 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
3074 |
2966 |
3075 smiley->SetImageSize( rect.Size() ); |
2967 smiley->SetImageSize( rect.Size() ); |
3076 |
2968 |
3077 if ( smiley->MaskBitmap() ) |
2969 if ( smiley->MaskBitmap() ) |