95 #include <eikrted.h> |
95 #include <eikrted.h> |
96 #include <NumberGroupingCRKeys.h> |
96 #include <NumberGroupingCRKeys.h> |
97 #include <aknpointereventsuppressor.h> |
97 #include <aknpointereventsuppressor.h> |
98 #include <aknnotedialog.h> |
98 #include <aknnotedialog.h> |
99 #include <AknFepGlobalEnums.h> |
99 #include <AknFepGlobalEnums.h> |
100 |
100 #include <AknSmileyUtils.h> |
101 #include "smileymanager.h" |
101 #include "smileymanager.h" |
102 #include "smileycustomwrap.h" |
102 #include "smileycustomwrap.h" |
103 #include <touchfeedback.h> |
103 #include <touchfeedback.h> |
104 |
104 |
105 // declare function |
105 // declare function |
106 void ReadSpecialCharFromSCTL( TPtr& ptr, TInt sctResourceId ); |
106 void ReadSpecialCharFromSCTL( TPtr& ptr, TInt sctResourceId ); |
107 void ReadSCTHeadPane( TResourceReader& aReader ); |
107 void ReadSCTHeadPane( TResourceReader& aReader ); |
|
108 // for supporting TapToWrite |
|
109 #include <AvkonInternalCRKeys.h> |
|
110 #include <e32property.h> |
|
111 #include <AknFepInternalPSKeys.h> |
|
112 #include <AknFontAccess.h> |
108 |
113 |
109 GLDEF_C void Panic(TEikEdwinPanic aPanic) |
114 GLDEF_C void Panic(TEikEdwinPanic aPanic) |
110 { |
115 { |
111 _LIT(KPanicCat,"EIKON-EDWIN"); |
116 _LIT(KPanicCat,"EIKON-EDWIN"); |
112 User::Panic(KPanicCat,aPanic); |
117 User::Panic(KPanicCat,aPanic); |
796 // Replace all 'i' following smiley code to invisbile placeholder for |
808 // Replace all 'i' following smiley code to invisbile placeholder for |
797 // Touch Input can not recognize it as part of smiley code string. |
809 // Touch Input can not recognize it as part of smiley code string. |
798 TInt smileyEndPos( 0 ); |
810 TInt smileyEndPos( 0 ); |
799 for ( TInt i( 0 ); i < length; i++ ) |
811 for ( TInt i( 0 ); i < length; i++ ) |
800 { |
812 { |
801 if ( aEditorContent[i] == CSmileyManager::KCompensateChar ) |
813 if ( aEditorContent[i] == CAknSmileyManager::KCompensateChar ) |
802 { |
814 { |
803 // when 'i' is the first character, it is unkonwn whether it is |
815 // when 'i' is the first character, it is unkonwn whether it is |
804 // part of a smiley code string or not, so we have to use another |
816 // part of a smiley code string or not, so we have to use another |
805 // function to decide. |
817 // function to decide. |
806 if ( ( i > 0 && i < smileyEndPos ) || |
818 if ( ( i > 0 && i < smileyEndPos ) || |
807 ( i == 0 && smiley->SmileyCodeByPos( aDocumentPosition ) > 0 ) ) |
819 ( i == 0 && smiley->SmileyCodeByPos( aDocumentPosition ) > 0 ) ) |
808 { |
820 { |
809 aEditorContent[i] = CSmileyManager::KPlaceHolder; |
821 aEditorContent[i] = CAknSmileyManager::KPlaceHolder; |
810 } |
822 } |
811 } |
823 } |
812 else if ( smiley->IsSmileyCode( aEditorContent[i] ) ) |
824 else if ( smiley->IsSmileyCode( aEditorContent[i] ) ) |
813 { |
825 { |
814 smileyEndPos = i + smiley->SmileyLength( aDocumentPosition + i ); |
826 smileyEndPos = i + smiley->SmileyLength( aDocumentPosition + i ); |
3986 // Text view may not occupy the whole control area. So we need to draw in the gaps |
4024 // Text view may not occupy the whole control area. So we need to draw in the gaps |
3987 DrawBackgroundAroundTextView( gc, rect, viewRect, backgroundColor ); |
4025 DrawBackgroundAroundTextView( gc, rect, viewRect, backgroundColor ); |
3988 } |
4026 } |
3989 |
4027 |
3990 TrappedDraw(viewRect); |
4028 TrappedDraw(viewRect); |
|
4029 |
|
4030 // try to draw "tap to write" |
|
4031 if ( TextLength() == 0 && IsT2WEnabled() ) |
|
4032 { |
|
4033 TRAP_IGNORE( DrawT2WTextL() ); |
|
4034 } |
3991 |
4035 |
3992 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
4036 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
3993 // Workaround for clipping rect problem in multiline queries with text |
4037 // Workaround for clipping rect problem in multiline queries with text |
3994 // entries. Because of differences between CRemoteGc and CWindowGc, |
4038 // entries. Because of differences between CRemoteGc and CWindowGc, |
3995 // parts of the query wouldn't be drawn by CRemoteGc. The Reset() call |
4039 // parts of the query wouldn't be drawn by CRemoteGc. The Reset() call |
4006 { |
4050 { |
4007 CFont** fontPtr = (CFont**)aFont; |
4051 CFont** fontPtr = (CFont**)aFont; |
4008 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(*fontPtr); |
4052 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(*fontPtr); |
4009 } |
4053 } |
4010 |
4054 |
4011 void CEikEdwin::DrawFirstLineTextL() const |
4055 void CEikEdwin::DrawT2WTextL() const |
4012 { |
4056 { |
4013 |
4057 if ( iEdwinExtension && iEdwinExtension->iT2WBuf ) |
4014 HBufC* clipbuf = GetTextInHBufL(); |
4058 { |
4015 CleanupStack::PushL(clipbuf); |
4059 // rect |
4016 |
4060 TRect edwinRect = RectForFirstLineText(); |
4017 TPtrC clipbufPtr = clipbuf->Des(); |
4061 |
|
4062 // font |
|
4063 TAknTextLineLayout textLayout = |
|
4064 AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
|
4065 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( |
|
4066 textLayout.FontId()); |
|
4067 TFontSpec fontSpec = CursorFontSpec(); |
|
4068 fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightNormal ); |
|
4069 |
|
4070 CGraphicsDevice* screenDevice = iEikonEnv->ScreenDevice(); |
|
4071 CFbsFont* customFont( NULL ); |
|
4072 TInt err = screenDevice->GetNearestFontInTwips((CFont*&) customFont, |
|
4073 fontSpec); |
|
4074 |
|
4075 //color |
|
4076 TRgb textColor = iEikonEnv->ControlColor(EColorControlText, *this); |
|
4077 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
4078 if ( skin && SkinColorId() != KErrNotFound ) |
|
4079 { |
|
4080 AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, |
|
4081 SkinColorId() ); |
|
4082 } |
|
4083 |
|
4084 // reorder the buffer |
|
4085 TPtrC clipbufPtr = iEdwinExtension->iT2WBuf->Des(); |
|
4086 AknBidiTextUtils::PrepareRunInfoArray( clipbufPtr ); |
|
4087 HBufC* reorderedText = HBufC::NewLC( clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable); |
|
4088 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4089 TInt width = edwinRect.Size().iWidth; |
|
4090 AknBidiTextUtils::ConvertToVisualAndClip( clipbufPtr, reorderedTextPtr, *font, width, width ); |
|
4091 |
|
4092 CWindowGc& gc = SystemGc(); |
|
4093 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
|
4094 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
4095 gc.SetPenColor( FadeRgb( textColor, KBlackMap , KWhiteMap ) ); |
|
4096 gc.UseFont( customFont ); |
|
4097 gc.DrawText( reorderedTextPtr, edwinRect, font->TextPaneTopToBaseline(), |
|
4098 AlignForFirstLineText( reorderedTextPtr ) ); |
|
4099 gc.DiscardFont(); |
|
4100 screenDevice->ReleaseFont( customFont ); |
|
4101 CleanupStack::PopAndDestroy( reorderedText ); |
|
4102 } |
|
4103 } |
|
4104 |
|
4105 TRect CEikEdwin::RectForFirstLineText() const |
|
4106 { |
4018 TMargins8 margins = Margins(); |
4107 TMargins8 margins = Margins(); |
4019 const TRect rect(Rect()); |
4108 const TRect rect(Rect()); |
4020 TInt cursorWidth = CursorWidth(); // need to add cursor width to right hand margin |
4109 TInt cursorWidth = CursorWidth(); // need to add cursor width to right hand margin |
4021 TRect edwinRect = AknLayoutUtils::RectFromCoords(rect, margins.iLeft, margins.iTop, margins.iRight+cursorWidth, margins.iBottom, ELayoutEmpty, ELayoutEmpty); |
4110 TRect edwinRect = AknLayoutUtils::RectFromCoords(rect, margins.iLeft, margins.iTop, margins.iRight+cursorWidth, |
4022 |
4111 margins.iBottom, ELayoutEmpty, ELayoutEmpty); |
4023 TAknTextLineLayout textLayout = AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
4112 return edwinRect; |
4024 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( textLayout.FontId()); |
4113 } |
4025 |
4114 |
4026 // reorder the text |
4115 CGraphicsContext::TTextAlign CEikEdwin::AlignForFirstLineText( const TPtr & aReorderedTextPtr ) const |
4027 AknBidiTextUtils::PrepareRunInfoArray(clipbufPtr); |
4116 { |
4028 |
|
4029 HBufC* reorderedText = HBufC::NewLC(clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable); |
|
4030 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4031 TInt width = edwinRect.Size().iWidth; |
|
4032 AknBidiTextUtils::ConvertToVisualAndClip(clipbufPtr, reorderedTextPtr, *font, width, width); |
|
4033 AknTextUtils::ReplaceCharacters( reorderedTextPtr, _L("\x2029"), TChar(' ') ); |
|
4034 CleanupStack::Pop(reorderedText); |
|
4035 CleanupStack::PopAndDestroy(clipbuf); |
|
4036 CleanupStack::PushL(reorderedText); |
|
4037 |
|
4038 CGraphicsContext::TTextAlign alignment = CGraphicsContext::ELeft; |
4117 CGraphicsContext::TTextAlign alignment = CGraphicsContext::ELeft; |
4039 switch(CurrentAlignment()) |
4118 switch(CurrentAlignment()) |
4040 { |
4119 { |
4041 case EAknEditorAlignLeft: |
4120 case EAknEditorAlignLeft: |
4042 alignment = CGraphicsContext::ELeft; |
4121 alignment = CGraphicsContext::ELeft; |
4049 break; |
4128 break; |
4050 case EAknEditorAlignNone: // drop through to default |
4129 case EAknEditorAlignNone: // drop through to default |
4051 case EAknEditorAlignBidi: // drop through to default |
4130 case EAknEditorAlignBidi: // drop through to default |
4052 default: |
4131 default: |
4053 { |
4132 { |
4054 if (TBidiText::TextDirectionality(reorderedTextPtr) == TBidiText::ELeftToRight) |
4133 if ( TBidiText::TextDirectionality( aReorderedTextPtr ) == TBidiText::ELeftToRight ) |
4055 alignment = CGraphicsContext::ELeft; |
4134 alignment = CGraphicsContext::ELeft; |
4056 else |
4135 else |
4057 alignment = CGraphicsContext::ERight; |
4136 alignment = CGraphicsContext::ERight; |
4058 } |
4137 } |
4059 break; |
4138 break; |
4060 } |
4139 } |
|
4140 return alignment; |
|
4141 } |
|
4142 void CEikEdwin::DrawFirstLineTextL() const |
|
4143 { |
|
4144 // rect |
|
4145 TRect edwinRect = RectForFirstLineText(); |
|
4146 // font |
|
4147 TAknTextLineLayout textLayout = AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
|
4148 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( textLayout.FontId()); |
|
4149 // reorder the text |
|
4150 HBufC* clipbuf = GetTextInHBufL(); |
|
4151 CleanupStack::PushL(clipbuf); |
|
4152 TPtrC clipbufPtr = clipbuf->Des(); |
|
4153 AknBidiTextUtils::PrepareRunInfoArray( clipbufPtr ); |
|
4154 HBufC* reorderedText = HBufC::NewLC( clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable ); |
|
4155 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4156 TInt width = edwinRect.Size().iWidth; |
|
4157 AknBidiTextUtils::ConvertToVisualAndClip( clipbufPtr, reorderedTextPtr, *font, width, width ); |
|
4158 AknTextUtils::ReplaceCharacters( reorderedTextPtr, KParagraphSeparator, TChar(' ') ); |
|
4159 CleanupStack::Pop( reorderedText ); |
|
4160 CleanupStack::PopAndDestroy( clipbuf ); |
|
4161 CleanupStack::PushL( reorderedText ); |
4061 |
4162 |
4062 CWindowGc& gc=SystemGc(); |
4163 CWindowGc& gc=SystemGc(); |
4063 gc.UseFont(font); |
4164 gc.UseFont( font ); |
4064 |
4165 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
4065 // Following patching up of the GC are now necessary after calling LafCustomDrawerfor background |
4166 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
4066 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
4167 gc.SetPenColor( iEikonEnv->ControlColor( EColorControlText, *this ) ); // Text color |
4067 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
4168 gc.DrawText( reorderedTextPtr, edwinRect, font->TextPaneTopToBaseline(), |
4068 TRgb textColor=iEikonEnv->ControlColor(EColorControlText,*this); |
4169 AlignForFirstLineText( reorderedTextPtr ) ); |
4069 |
4170 CleanupStack::PopAndDestroy(reorderedText); |
4070 gc.SetPenColor(textColor); // Text color |
4171 gc.DiscardFont(); |
4071 |
|
4072 // Edwin is assumed to be laid out already with LayoutEdwin. In that case |
|
4073 // the textpane top is the top of the edwin |
|
4074 TInt ascent = font->TextPaneTopToBaseline(); |
|
4075 |
|
4076 gc.DrawText(reorderedTextPtr, edwinRect, ascent, alignment); |
|
4077 |
|
4078 CleanupStack::PopAndDestroy(reorderedText); |
|
4079 |
|
4080 gc.DiscardFont(); // So the GC will not try to use the font. |
|
4081 } |
4172 } |
4082 |
4173 |
4083 EXPORT_C void CEikEdwin::TrappedDraw(const TRect& aViewRect) const |
4174 EXPORT_C void CEikEdwin::TrappedDraw(const TRect& aViewRect) const |
4084 { |
4175 { |
4085 if ( iEdwinExtension && iEdwinExtension->iDrawInvoked == CEikEdwinExtension::ENotDraw ) |
4176 if ( iEdwinExtension && iEdwinExtension->iDrawInvoked == CEikEdwinExtension::ENotDraw ) |
4384 { |
4475 { |
4385 __ASSERT_DEBUG(iText,Panic(EEikPanicEdwinNoText)); |
4476 __ASSERT_DEBUG(iText,Panic(EEikPanicEdwinNoText)); |
4386 return(iText->DocumentLength()); |
4477 return(iText->DocumentLength()); |
4387 } |
4478 } |
4388 |
4479 |
|
4480 TBool CEikEdwin::IsT2WEnabled() const |
|
4481 { |
|
4482 /** |
|
4483 * 1,If the editor is read only or it is display only "tap to write" is disabled |
|
4484 * 2,If iEdwinExtension->iT2WBuf is NULL, "tap to write" is disabled. |
|
4485 * 3,If Qwerty key borad is opened, "tap to write" is disabled |
|
4486 * 4,If focus off, "tap to write" is disabled |
|
4487 * 5,If split input is enabled, "tap to write" is disabled |
|
4488 */ |
|
4489 return iEdwinExtension && !( iEdwinUserFlags & EReadOnly ) && |
|
4490 !( iEdwinUserFlags & EDisplayOnly ) && iEdwinExtension->iT2WBuf && |
|
4491 ( iEdwinExtension->iT2WState & CEikEdwinExtension::EFocusOn ) && |
|
4492 !( iEdwinExtension->iT2WState & CEikEdwinExtension::ESplitInputEnabled ) && |
|
4493 !( iEdwinExtension->iExtendedInputCapabilities->Capabilities() & |
|
4494 CAknExtendedInputCapabilities::EInputEditorQwertyInputActive ); |
|
4495 } |
|
4496 |
4389 void CEikEdwin::SetCursorVisibilityL(TBool aEmphasis) |
4497 void CEikEdwin::SetCursorVisibilityL(TBool aEmphasis) |
4390 { |
4498 { |
4391 TCursor::TVisibility textCursor=(aEmphasis? TCursor::EFCursorFlashing : TCursor::EFCursorInvisible); |
4499 TCursor::TVisibility textCursor=(aEmphasis? TCursor::EFCursorFlashing : TCursor::EFCursorInvisible); |
4392 TCursor::TVisibility lineCursor=((iEdwinUserFlags&ELineCursor && aEmphasis)? |
4500 TCursor::TVisibility lineCursor=((iEdwinUserFlags&ELineCursor && aEmphasis)? |
4393 TCursor::EFCursorVisible : TCursor::EFCursorInvisible); |
4501 TCursor::EFCursorVisible : TCursor::EFCursorInvisible); |
4856 { |
4980 { |
4857 iEdwinExtension->iSmiley->HandleInsertL( lower, undoneLength ); |
4981 iEdwinExtension->iSmiley->HandleInsertL( lower, undoneLength ); |
4858 ConvertTextForSmileyL( TCursorSelection( lower, undoneLength ), ETrue ); |
4982 ConvertTextForSmileyL( TCursorSelection( lower, undoneLength ), ETrue ); |
4859 } |
4983 } |
4860 TRAPD(err2,iTextView->HandleInsertDeleteL(TCursorSelection(lower,lower+undoneLength),newText.Length(),changed)); |
4984 TRAPD(err2,iTextView->HandleInsertDeleteL(TCursorSelection(lower,lower+undoneLength),newText.Length(),changed)); |
|
4985 // try to draw "tap to write" |
|
4986 TryToDrawT2W(); |
4861 ClearUndo(); |
4987 ClearUndo(); |
4862 if (NeedToChangeFormattingModeL()) |
4988 if (NeedToChangeFormattingModeL()) |
4863 SetAmountToFormatL(); |
4989 SetAmountToFormatL(); |
4864 ForceScrollBarUpdateL(); |
4990 ForceScrollBarUpdateL(); |
4865 User::LeaveIfError(err); |
4991 User::LeaveIfError(err); |
4938 } |
5064 } |
4939 const TInt newLength=iText->DocumentLength(); |
5065 const TInt newLength=iText->DocumentLength(); |
4940 const TInt newCursorPos=cursorPos+newLength-oldLength; |
5066 const TInt newCursorPos=cursorPos+newLength-oldLength; |
4941 iTextView->SetPendingSelection(TCursorSelection(newCursorPos,newCursorPos)); |
5067 iTextView->SetPendingSelection(TCursorSelection(newCursorPos,newCursorPos)); |
4942 if (NeedToChangeFormattingModeL()) |
5068 if (NeedToChangeFormattingModeL()) |
|
5069 { |
4943 SetAmountToFormatL(); |
5070 SetAmountToFormatL(); |
|
5071 } |
4944 else |
5072 else |
|
5073 { |
4945 iTextView->HandleInsertDeleteL(TCursorSelection(newCursorPos,cursorPos),0,ETrue); |
5074 iTextView->HandleInsertDeleteL(TCursorSelection(newCursorPos,cursorPos),0,ETrue); |
|
5075 // try to draw "tap to write" |
|
5076 TryToDrawT2W(); |
|
5077 } |
4946 DrawContents(); |
5078 DrawContents(); |
4947 UpdateScrollBarsL(); |
5079 UpdateScrollBarsL(); |
4948 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
5080 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
4949 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
5081 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
4950 iEikonEnv->BusyMsgCancel(); |
5082 iEikonEnv->BusyMsgCancel(); |
5021 const TCursorSelection pending(lower,lower); |
5153 const TCursorSelection pending(lower,lower); |
5022 iTextView->SetPendingSelection(pending); |
5154 iTextView->SetPendingSelection(pending); |
5023 selection.iAnchorPos=lower; |
5155 selection.iAnchorPos=lower; |
5024 selection.iCursorPos=lower; |
5156 selection.iCursorPos=lower; |
5025 iTextView->HandleInsertDeleteL(selection,selLength,formatHasChanged); |
5157 iTextView->HandleInsertDeleteL(selection,selLength,formatHasChanged); |
|
5158 // try to draw "tap to write" |
|
5159 TryToDrawT2W(); |
5026 reportChange=ETrue; |
5160 reportChange=ETrue; |
5027 } |
5161 } |
5028 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
5162 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
5029 dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); |
5163 dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); |
5030 dlg->SetTone( CAknNoteDialog::ENoTone ); |
5164 dlg->SetTone( CAknNoteDialog::ENoTone ); |
6516 selection.iCursorPos=selection.iAnchorPos+aModel->iReplaceText.Length(); |
6654 selection.iCursorPos=selection.iAnchorPos+aModel->iReplaceText.Length(); |
6517 } |
6655 } |
6518 const TCursorSelection pending(selection.iCursorPos,selection.iCursorPos); |
6656 const TCursorSelection pending(selection.iCursorPos,selection.iCursorPos); |
6519 iTextView->SetPendingSelection(pending); |
6657 iTextView->SetPendingSelection(pending); |
6520 iTextView->HandleInsertDeleteL(selection,aModel->iText.Length(),formatHasChanged); |
6658 iTextView->HandleInsertDeleteL(selection,aModel->iText.Length(),formatHasChanged); |
|
6659 // try to draw "tap to write" |
|
6660 TryToDrawT2W(); |
6521 if ( NeedToChangeFormattingModeL()) |
6661 if ( NeedToChangeFormattingModeL()) |
6522 SetAmountToFormatL(); |
6662 SetAmountToFormatL(); |
6523 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
6663 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
6524 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
6664 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
6525 User::LeaveIfError(err); |
6665 User::LeaveIfError(err); |
7180 iEdwinExtension->iSmiley->HandleInsertL( aInsertPos, aText.Length() ); |
7345 iEdwinExtension->iSmiley->HandleInsertL( aInsertPos, aText.Length() ); |
7181 ConvertTextForSmileyL( TCursorSelection( aInsertPos, |
7346 ConvertTextForSmileyL( TCursorSelection( aInsertPos, |
7182 aInsertPos + aText.Length() ), ETrue ); |
7347 aInsertPos + aText.Length() ), ETrue ); |
7183 } |
7348 } |
7184 iTextView->HandleInsertDeleteL(TCursorSelection(aInsertPos,aInsertPos+aText.Length()),length,formatChanged); |
7349 iTextView->HandleInsertDeleteL(TCursorSelection(aInsertPos,aInsertPos+aText.Length()),length,formatChanged); |
|
7350 // try to draw "tap to write" |
|
7351 TryToDrawT2W(); |
7185 } |
7352 } |
7186 |
7353 |
7187 EXPORT_C void CEikEdwin::SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility) |
7354 EXPORT_C void CEikEdwin::SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility) |
7188 { |
7355 { |
7189 __ASSERT_DEBUG(iLayout,Panic(EEikPanicEdwinNoLayout)); |
7356 __ASSERT_DEBUG(iLayout,Panic(EEikPanicEdwinNoLayout)); |
8435 if ( scroll ) |
8602 if ( scroll ) |
8436 { |
8603 { |
8437 UpdateScrollBarsL(); |
8604 UpdateScrollBarsL(); |
8438 } |
8605 } |
8439 } |
8606 } |
|
8607 |
|
8608 // --------------------------------------------------------------------------- |
|
8609 // CEikEdwin::MoveViewToCursorLineL |
|
8610 // --------------------------------------------------------------------------- |
|
8611 // |
|
8612 void CEikEdwin::MoveViewToCursorLineL() |
|
8613 { |
|
8614 if ( !iTextView ) |
|
8615 { |
|
8616 return; |
|
8617 } |
|
8618 |
|
8619 const TInt cursorPos ( CursorPos() ); |
|
8620 const TRect viewRect( AdjustedViewRect() ); |
|
8621 |
|
8622 const TPoint startPoint ( viewRect.iTl ); |
|
8623 const TPoint endPoint ( viewRect.iBr ); |
|
8624 |
|
8625 TPoint cursorPoint; |
|
8626 iTextView->DocPosToXyPosL( cursorPos, cursorPoint ); |
|
8627 |
|
8628 if ( cursorPoint.iY > endPoint.iY ) |
|
8629 { |
|
8630 TBool exceed ( EFalse ) ; |
|
8631 TInt rest ( 0 ); |
|
8632 ScrollView ( endPoint.iY - cursorPoint.iY, exceed, rest ); |
|
8633 } |
|
8634 else if ( cursorPoint.iY < startPoint.iY ) |
|
8635 { |
|
8636 TBool exceed ( EFalse ) ; |
|
8637 TInt rest ( 0 ); |
|
8638 ScrollView ( startPoint.iY - cursorPoint.iY, exceed, rest ); |
|
8639 } |
|
8640 } |
8440 |
8641 |
8441 EXPORT_C void CEikEdwin::SetCursorVisible(TBool aVisible) |
8642 EXPORT_C void CEikEdwin::SetCursorVisible(TBool aVisible) |
8442 { |
8643 { |
8443 TRAP_IGNORE( SetCursorVisibilityL( aVisible ) ); |
8644 TRAP_IGNORE( SetCursorVisibilityL( aVisible ) ); |
8444 } |
8645 } |
9316 // bitmap Id, bitmap Mask Id of captioned control |
9517 // bitmap Id, bitmap Mask Id of captioned control |
9317 aReader.Advance( KTInt16Length + KTInt16Length ); |
9518 aReader.Advance( KTInt16Length + KTInt16Length ); |
9318 aReader.ReadTPtrC(); // Process ToolTip |
9519 aReader.ReadTPtrC(); // Process ToolTip |
9319 } |
9520 } |
9320 |
9521 |
|
9522 // returns the faded color of aColor |
|
9523 // aWhiteMap and aBlackMap parameters control the amount of fading |
|
9524 TRgb FadeRgb(TRgb aColor, TUint8 aBlackMap,TUint8 aWhiteMap) |
|
9525 { |
|
9526 TUint8 fadeMapFactor = aWhiteMap - aBlackMap + 1; |
|
9527 TUint8 fadeMapOffset = aBlackMap; |
|
9528 TInt value = aColor.Internal(); |
|
9529 TInt b = (((value & 0x000000ff) * fadeMapFactor) >> 8) + fadeMapOffset; |
|
9530 TInt g = (((value & 0x0000ff00) * fadeMapFactor) >> 16) + fadeMapOffset; |
|
9531 //the multiplication by iFadeMapFactor can overflow into the sign bit, so we shift down in two steps |
|
9532 TInt r = ((((value & 0x00ff0000) >> 16) * fadeMapFactor) >> 8) + fadeMapOffset; |
|
9533 TInt a = aColor.Alpha(); |
|
9534 return TRgb(r,g,b,a ); |
|
9535 } |
|
9536 |
|
9537 // --------------------------------------------------------------------------- |
|
9538 // CEikEdwin::EnableT2WL |
|
9539 // --------------------------------------------------------------------------- |
|
9540 // |
|
9541 EXPORT_C void CEikEdwin::EnableT2WL( TBool aEnable ) |
|
9542 { |
|
9543 if ( iEdwinExtension ) |
|
9544 { |
|
9545 if ( !aEnable && iEdwinExtension->iT2WBuf ) |
|
9546 { |
|
9547 delete iEdwinExtension->iT2WBuf; |
|
9548 iEdwinExtension->iT2WBuf = NULL; |
|
9549 if ( iTextView ) |
|
9550 { |
|
9551 TryToDrawT2W( ETrue ); |
|
9552 } |
|
9553 } |
|
9554 else if ( aEnable && !iEdwinExtension->iT2WBuf ) |
|
9555 { |
|
9556 CRepository* cenrep = NULL; |
|
9557 TInt supportT2W = 0; |
|
9558 TRAPD(error, cenrep = CRepository::NewL(KCRUidAvkon)); |
|
9559 if ( error == KErrNone ) |
|
9560 { |
|
9561 error = cenrep->Get( KAknEdwinTapToWrite, supportT2W ); |
|
9562 } |
|
9563 delete cenrep; |
|
9564 if ( supportT2W && !iEdwinExtension->iT2WBuf ) |
|
9565 { |
|
9566 iEdwinExtension->iT2WBuf = iEikonEnv->AllocReadResourceLC( R_AVKON_TAP_TO_WRITE ); |
|
9567 CleanupStack::Pop( iEdwinExtension->iT2WBuf ); |
|
9568 if ( iTextView ) |
|
9569 { |
|
9570 TryToDrawT2W(); |
|
9571 } |
|
9572 } |
|
9573 } |
|
9574 } |
|
9575 } |
|
9576 |
|
9577 // --------------------------------------------------------------------------- |
|
9578 // CEikEdwin::TryToDrawT2W |
|
9579 // --------------------------------------------------------------------------- |
|
9580 // |
|
9581 void CEikEdwin::TryToDrawT2W( TBool aClean ) |
|
9582 { |
|
9583 CAknEdwinState* edwinState = EditorState(); |
|
9584 TBool cursorVisible( EFalse ); |
|
9585 if ( edwinState ) |
|
9586 { |
|
9587 cursorVisible = ( edwinState->Flags() | EAknEditorFlagTextCursorVisible ); |
|
9588 } |
|
9589 |
|
9590 if ( iEdwinExtension ) |
|
9591 { |
|
9592 // When "tap to write" is enabled( started ) we should record the status of cursor. |
|
9593 if ( TextLength() == 0 && IsT2WEnabled() ) |
|
9594 { |
|
9595 SetCursorVisible( EFalse ); |
|
9596 iEdwinExtension->iT2WState |= CEikEdwinExtension::ERecordCursor; |
|
9597 if ( cursorVisible ) |
|
9598 { |
|
9599 iEdwinExtension->iT2WState |= CEikEdwinExtension::ECursorVisible; |
|
9600 } |
|
9601 else |
|
9602 { |
|
9603 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ECursorVisible; |
|
9604 } |
|
9605 DrawDeferred(); |
|
9606 } |
|
9607 // When "tap to write" is disabled ( ended ) we need to recover the status of cursor. |
|
9608 else if ( IsFocused() && |
|
9609 ( iEdwinExtension->iT2WState & CEikEdwinExtension::ERecordCursor ) ) |
|
9610 { |
|
9611 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ERecordCursor; |
|
9612 SetCursorVisible( iEdwinExtension->iT2WState & CEikEdwinExtension::ECursorVisible ); |
|
9613 } |
|
9614 // When focus off, we don't need to record the status anymore. So clean it. |
|
9615 else if ( !IsFocused() ) |
|
9616 { |
|
9617 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ERecordCursor; |
|
9618 } |
|
9619 } |
|
9620 |
|
9621 if ( aClean && TextLength() == 0 ) |
|
9622 { |
|
9623 DrawDeferred(); |
|
9624 } |
|
9625 } |
|
9626 |
9321 // End of File |
9627 // End of File |
9322 |
9628 |