diff -r fcdfafb36fe7 -r aecbbf00d063 uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp --- a/uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp Thu Aug 19 10:11:06 2010 +0300 +++ b/uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp Tue Aug 31 15:28:30 2010 +0300 @@ -37,9 +37,8 @@ // CONSTANTS // This is the last character that will be treated as requiring higher underline - +// const TText KMaxSpecialUnderliningChar = 0x0E5B; const TInt KWsBufferSize = 16000; -const TInt KOneHundred = 100; // MEMBER FUNCTIONS @@ -93,7 +92,7 @@ new( ELeave ) CAknEdwinCustomDrawBase( aEnv, aControl ); CleanupStack::PushL( self ); self->ConstructL(); - CleanupStack::Pop( self ); + CleanupStack::Pop(); return self; } @@ -112,7 +111,7 @@ aEnv, aControl, aTextView, aSystemGc ); CleanupStack::PushL( self ); self->ConstructL(); - CleanupStack::Pop( self ); + CleanupStack::Pop(); return self; } @@ -166,7 +165,7 @@ aExtraPixels = 0; TInt underlinePos(0); - TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ; + (void)TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ; // always perform custom underlining TRect underlineRect(aParam.iDrawRect); @@ -192,26 +191,33 @@ CFont* font = NULL; aParam.iMap.GetNearestFontInTwips( font, aFormat.iFontSpec ); RRegion rgn; - TBool drawSmiley( iEdwin.IsSmileyEnabled() && font && ( &aParam.iGc == - static_cast( iTextView->BitmapContext() ) ) ); - if ( drawSmiley ) + if ( iEdwin.IsSmileyEnabled() && font ) { - TPoint startPt( aParam.iDrawRect.iTl ); - startPt.iY = aLineInfo.iBaseline; - CBitmapContext* bitmapGc( iTextView->BitmapContext() ); - CEikEdwin& edwin = const_cast( iEdwin ); rgn.AddRect( iEdwin.AdjustDrawRectForSmiley( aParam.iDrawRect ) ); - TRAP_IGNORE( edwin.DrawSmileyInTextL( rgn, aParam.iDrawRect, *bitmapGc, - *font, aText, startPt ) ); + iEdwin.GetClipRegionForSmiley( rgn, *font, aText, aTextOrigin, + aParam.iDrawRect ); aParam.iGc.SetClippingRegion( rgn ); } CLafEdwinCustomDrawBase::DrawText( aParam, aLineInfo, alteredFormat, aText, aTextOrigin, aExtraPixels ); - if ( drawSmiley ) + if ( iEdwin.IsSmileyEnabled() ) { aParam.iGc.CancelClippingRegion(); } rgn.Close(); + + if ( iEdwin.IsSmileyEnabled() && font && ( &aParam.iGc == + static_cast( iTextView->BitmapContext() ) ) ) + { + CBitmapContext* bitmapGc( iTextView->BitmapContext() ); + CEikEdwin& edwin = const_cast( iEdwin ); + TPoint startPt( aParam.iDrawRect.iTl ); + startPt.iY = aLineInfo.iBaseline; + TRAP_IGNORE( { + edwin.HandleScrollForSmileyL(); + edwin.DrawSmileyInTextL( *bitmapGc, *font, aText, startPt ); + } ); + } // Draw pictographs if the feature is supported. // Character justification is not supported. @@ -317,56 +323,54 @@ } -TRgb CAknEdwinCustomDrawBase::SystemColor( TUint aColorIndex, TRgb aDefaultColor ) const +TRgb CAknEdwinCustomDrawBase::SystemColor(TUint aColorIndex,TRgb aDefaultColor) const { TRgb ret = aDefaultColor; - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); if (aColorIndex==TLogicalRgb::ESystemForegroundIndex) { - if ( skin && iEdwin.SkinColorId() != KErrNotFound ) + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + if (skin && iEdwin.SkinColorId() != KErrNotFound) { - AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, - iEdwin.SkinColorId() ); + AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnTextColors, iEdwin.SkinColorId()); } } - else if ( aColorIndex==TLogicalRgb::ESystemBackgroundIndex ) + else if (aColorIndex==TLogicalRgb::ESystemBackgroundIndex) { // Only override aDefaultColor if SetBackgroundColorL was called: - iEdwin.EditorBackgroundColor( ret ); + (void)iEdwin.EditorBackgroundColor(ret); // Insist on opaque background - ret.SetAlpha( 0xFF ); + ret.SetAlpha(0xFF); } + else if (aColorIndex==TLogicalRgb::ESystemSelectionForegroundIndex) { ret = KRgbWhite; - if ( skin ) + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + if (skin) { if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) { - AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, - EAknsCIQsnTextColorsCG3 ); + AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG3); } else // default { - AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG24 ); + AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG24); } } } - else if ( aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex ) + else if (aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex) { ret = KRgbBlue; - if ( skin ) + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + if (skin) { if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) { - AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, - EAknsCIQsnTextColorsCG1 ); + AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG1); } else // default { - AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, - EAknsCIQsnHighlightColorsCG2 ); + AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnHighlightColorsCG2); } } } @@ -404,20 +408,21 @@ if ( bitmapGc && iEdwin.SkinEnabled() ) { MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - if ( skin ) + // Edwin manages the skin background + MAknsControlContext* edCc = iEdwin.SkinBackgroundControlContext(); + + TInt drawFlags = KAknsDrawParamDefault; + if( CAknEnv::Static()->TransparencyEnabled() ) + { + drawFlags |= KAknsDrawParamNoClearUnderImage; + } + + if( AknsDrawUtils::DrawBackground( skin, edCc, + &iControl, *bitmapGc, aRect.iTl, aRect, + drawFlags )) { - if ( AknsDrawUtils::DrawBackground( - skin, - iEdwin.SkinBackgroundControlContext(), - &iControl, - *bitmapGc, - aRect.iTl, - aRect, - KAknsDrawParamNoClearUnderImage ) ) - { - aDrawnRect = aRect; - drawn = ETrue; - } + aDrawnRect = aRect; + drawn = ETrue; } } else @@ -721,8 +726,7 @@ } } - maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, - ( lengthDrawnOnThisLine * KOneHundred )/aUnderlineRect.Width() ); + maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, (lengthDrawnOnThisLine * 100 )/aUnderlineRect.Width() ); } // end of for loop over rows util.End();