164 { |
163 { |
165 // Inhibit all excess pixels |
164 // Inhibit all excess pixels |
166 aExtraPixels = 0; |
165 aExtraPixels = 0; |
167 |
166 |
168 TInt underlinePos(0); |
167 TInt underlinePos(0); |
169 TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ; |
168 (void)TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ; |
170 // always perform custom underlining |
169 // always perform custom underlining |
171 |
170 |
172 TRect underlineRect(aParam.iDrawRect); |
171 TRect underlineRect(aParam.iDrawRect); |
173 TAknTextDecorationMetrics decoration( 0 ); // Give dummy font id for default decoration |
172 TAknTextDecorationMetrics decoration( 0 ); // Give dummy font id for default decoration |
174 // Note that underlinePos in scalable is a delta relative to normal baseline |
173 // Note that underlinePos in scalable is a delta relative to normal baseline |
190 aParam.iGc.SetUnderlineStyle( EUnderlineOff); // and force it off in the GC |
189 aParam.iGc.SetUnderlineStyle( EUnderlineOff); // and force it off in the GC |
191 } |
190 } |
192 CFont* font = NULL; |
191 CFont* font = NULL; |
193 aParam.iMap.GetNearestFontInTwips( font, aFormat.iFontSpec ); |
192 aParam.iMap.GetNearestFontInTwips( font, aFormat.iFontSpec ); |
194 RRegion rgn; |
193 RRegion rgn; |
195 TBool drawSmiley( iEdwin.IsSmileyEnabled() && font && ( &aParam.iGc == |
194 if ( iEdwin.IsSmileyEnabled() && font ) |
196 static_cast<CGraphicsContext*>( iTextView->BitmapContext() ) ) ); |
195 { |
197 if ( drawSmiley ) |
196 rgn.AddRect( iEdwin.AdjustDrawRectForSmiley( aParam.iDrawRect ) ); |
198 { |
197 iEdwin.GetClipRegionForSmiley( rgn, *font, aText, aTextOrigin, |
|
198 aParam.iDrawRect ); |
|
199 aParam.iGc.SetClippingRegion( rgn ); |
|
200 } |
|
201 CLafEdwinCustomDrawBase::DrawText( aParam, aLineInfo, alteredFormat, |
|
202 aText, aTextOrigin, aExtraPixels ); |
|
203 if ( iEdwin.IsSmileyEnabled() ) |
|
204 { |
|
205 aParam.iGc.CancelClippingRegion(); |
|
206 } |
|
207 rgn.Close(); |
|
208 |
|
209 if ( iEdwin.IsSmileyEnabled() && font && ( &aParam.iGc == |
|
210 static_cast<CGraphicsContext*>( iTextView->BitmapContext() ) ) ) |
|
211 { |
|
212 CBitmapContext* bitmapGc( iTextView->BitmapContext() ); |
|
213 CEikEdwin& edwin = const_cast<CEikEdwin&>( iEdwin ); |
199 TPoint startPt( aParam.iDrawRect.iTl ); |
214 TPoint startPt( aParam.iDrawRect.iTl ); |
200 startPt.iY = aLineInfo.iBaseline; |
215 startPt.iY = aLineInfo.iBaseline; |
201 CBitmapContext* bitmapGc( iTextView->BitmapContext() ); |
216 TRAP_IGNORE( { |
202 CEikEdwin& edwin = const_cast<CEikEdwin&>( iEdwin ); |
217 edwin.HandleScrollForSmileyL(); |
203 rgn.AddRect( iEdwin.AdjustDrawRectForSmiley( aParam.iDrawRect ) ); |
218 edwin.DrawSmileyInTextL( *bitmapGc, *font, aText, startPt ); |
204 TRAP_IGNORE( edwin.DrawSmileyInTextL( rgn, aParam.iDrawRect, *bitmapGc, |
219 } ); |
205 *font, aText, startPt ) ); |
220 } |
206 aParam.iGc.SetClippingRegion( rgn ); |
|
207 } |
|
208 CLafEdwinCustomDrawBase::DrawText( aParam, aLineInfo, alteredFormat, |
|
209 aText, aTextOrigin, aExtraPixels ); |
|
210 if ( drawSmiley ) |
|
211 { |
|
212 aParam.iGc.CancelClippingRegion(); |
|
213 } |
|
214 rgn.Close(); |
|
215 |
221 |
216 // Draw pictographs if the feature is supported. |
222 // Draw pictographs if the feature is supported. |
217 // Character justification is not supported. |
223 // Character justification is not supported. |
218 if ( ( iPictographDrawer && !aExtraPixels ) ) |
224 if ( ( iPictographDrawer && !aExtraPixels ) ) |
219 { |
225 { |
315 { |
321 { |
316 CLafEdwinCustomDrawBase::DrawLineGraphics( aParam, aLineInfo ); // Base Call |
322 CLafEdwinCustomDrawBase::DrawLineGraphics( aParam, aLineInfo ); // Base Call |
317 } |
323 } |
318 |
324 |
319 |
325 |
320 TRgb CAknEdwinCustomDrawBase::SystemColor( TUint aColorIndex, TRgb aDefaultColor ) const |
326 TRgb CAknEdwinCustomDrawBase::SystemColor(TUint aColorIndex,TRgb aDefaultColor) const |
321 { |
327 { |
322 TRgb ret = aDefaultColor; |
328 TRgb ret = aDefaultColor; |
323 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
324 if (aColorIndex==TLogicalRgb::ESystemForegroundIndex) |
329 if (aColorIndex==TLogicalRgb::ESystemForegroundIndex) |
325 { |
330 { |
326 if ( skin && iEdwin.SkinColorId() != KErrNotFound ) |
331 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
327 { |
332 if (skin && iEdwin.SkinColorId() != KErrNotFound) |
328 AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, |
333 { |
329 iEdwin.SkinColorId() ); |
334 AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnTextColors, iEdwin.SkinColorId()); |
330 } |
335 } |
331 } |
336 } |
332 else if ( aColorIndex==TLogicalRgb::ESystemBackgroundIndex ) |
337 else if (aColorIndex==TLogicalRgb::ESystemBackgroundIndex) |
333 { |
338 { |
334 // Only override aDefaultColor if SetBackgroundColorL was called: |
339 // Only override aDefaultColor if SetBackgroundColorL was called: |
335 iEdwin.EditorBackgroundColor( ret ); |
340 (void)iEdwin.EditorBackgroundColor(ret); |
336 // Insist on opaque background |
341 // Insist on opaque background |
337 ret.SetAlpha( 0xFF ); |
342 ret.SetAlpha(0xFF); |
338 } |
343 } |
|
344 |
339 else if (aColorIndex==TLogicalRgb::ESystemSelectionForegroundIndex) |
345 else if (aColorIndex==TLogicalRgb::ESystemSelectionForegroundIndex) |
340 { |
346 { |
341 ret = KRgbWhite; |
347 ret = KRgbWhite; |
342 if ( skin ) |
348 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
349 if (skin) |
343 { |
350 { |
344 if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) |
351 if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) |
345 { |
352 { |
346 AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, |
353 AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG3); |
347 EAknsCIQsnTextColorsCG3 ); |
|
348 } |
354 } |
349 else // default |
355 else // default |
350 { |
356 { |
351 AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, |
357 AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG24); |
352 EAknsCIQsnTextColorsCG24 ); |
358 } |
353 } |
359 } |
354 } |
360 } |
355 } |
361 else if (aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex) |
356 else if ( aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex ) |
|
357 { |
362 { |
358 ret = KRgbBlue; |
363 ret = KRgbBlue; |
359 if ( skin ) |
364 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
365 if (skin) |
360 { |
366 { |
361 if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) |
367 if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink ) |
362 { |
368 { |
363 AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, |
369 AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG1); |
364 EAknsCIQsnTextColorsCG1 ); |
|
365 } |
370 } |
366 else // default |
371 else // default |
367 { |
372 { |
368 AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, |
373 AknsUtils::GetCachedColor(skin, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnHighlightColorsCG2); |
369 EAknsCIQsnHighlightColorsCG2 ); |
|
370 } |
374 } |
371 } |
375 } |
372 } |
376 } |
373 |
377 |
374 return ret; |
378 return ret; |
402 bitmapGc = &(iControl.SystemGc()); |
406 bitmapGc = &(iControl.SystemGc()); |
403 #endif //RD_UI_TRANSITION_EFFECTS_POPUPS |
407 #endif //RD_UI_TRANSITION_EFFECTS_POPUPS |
404 if ( bitmapGc && iEdwin.SkinEnabled() ) |
408 if ( bitmapGc && iEdwin.SkinEnabled() ) |
405 { |
409 { |
406 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
410 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
407 if ( skin ) |
411 // Edwin manages the skin background |
408 { |
412 MAknsControlContext* edCc = iEdwin.SkinBackgroundControlContext(); |
409 if ( AknsDrawUtils::DrawBackground( |
413 |
410 skin, |
414 TInt drawFlags = KAknsDrawParamDefault; |
411 iEdwin.SkinBackgroundControlContext(), |
415 if( CAknEnv::Static()->TransparencyEnabled() ) |
412 &iControl, |
416 { |
413 *bitmapGc, |
417 drawFlags |= KAknsDrawParamNoClearUnderImage; |
414 aRect.iTl, |
418 } |
415 aRect, |
419 |
416 KAknsDrawParamNoClearUnderImage ) ) |
420 if( AknsDrawUtils::DrawBackground( skin, edCc, |
417 { |
421 &iControl, *bitmapGc, aRect.iTl, aRect, |
418 aDrawnRect = aRect; |
422 drawFlags )) |
419 drawn = ETrue; |
423 { |
420 } |
424 aDrawnRect = aRect; |
|
425 drawn = ETrue; |
421 } |
426 } |
422 } |
427 } |
423 else |
428 else |
424 { |
429 { |
425 // perform unoptimized draw of skin using bitmap brushstyle? |
430 // perform unoptimized draw of skin using bitmap brushstyle? |
719 DrawLineAndRecord( aParam.iGc, aUnderlineRect, startPoint, lastPos+1, row, lengthDrawnOnThisLine, numberSegmentsDrawn); |
724 DrawLineAndRecord( aParam.iGc, aUnderlineRect, startPoint, lastPos+1, row, lengthDrawnOnThisLine, numberSegmentsDrawn); |
720 } |
725 } |
721 } |
726 } |
722 } |
727 } |
723 |
728 |
724 maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, |
729 maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, (lengthDrawnOnThisLine * 100 )/aUnderlineRect.Width() ); |
725 ( lengthDrawnOnThisLine * KOneHundred )/aUnderlineRect.Width() ); |
|
726 } // end of for loop over rows |
730 } // end of for loop over rows |
727 |
731 |
728 util.End(); |
732 util.End(); |
729 |
733 |
730 // Check criteria for whether to say this was successful or not. |
734 // Check criteria for whether to say this was successful or not. |