1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // System includes |
|
21 #include <aknbiditextutils.h> |
|
22 #include <aknutils.h> |
|
23 #include <AknsSkinInstance.h> |
|
24 #include <AknsUtils.h> |
|
25 #include <gulfont.h> |
|
26 #include <VideoEditorUiComponents.rsg> |
|
27 #include <avkon.rsg> |
|
28 #include <stringloader.h> |
|
29 #include <akniconutils.h> |
|
30 #include <VideoEditorUiComponents.mbg> |
|
31 #include <data_caging_path_literals.hrh> |
|
32 #include <aknlayoutscalable_avkon.cdl.h> |
|
33 #include <aknlayoutscalable_apps.cdl.h> |
|
34 |
|
35 // User includes |
|
36 #include "VeiTextDisplay.h" |
|
37 #include "VideoEditorCommon.h" |
|
38 #include "VideoEditorUtils.h" |
|
39 #include "VideoEditorDebugUtils.h" |
|
40 |
|
41 // CONSTANTS |
|
42 _LIT(KResourceFile, "VideoEditorUiComponents.rsc"); |
|
43 |
|
44 EXPORT_C CVeiTextDisplay* CVeiTextDisplay::NewL( const TRect& aRect, const CCoeControl* aParent ) |
|
45 { |
|
46 CVeiTextDisplay* self = CVeiTextDisplay::NewLC( aRect, aParent ); |
|
47 CleanupStack::Pop(self); |
|
48 return self; |
|
49 } |
|
50 |
|
51 EXPORT_C CVeiTextDisplay* CVeiTextDisplay::NewLC( const TRect& aRect, const CCoeControl* aParent ) |
|
52 { |
|
53 CVeiTextDisplay* self = new (ELeave) CVeiTextDisplay; |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL( aRect, aParent ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 void CVeiTextDisplay::ConstructL( const TRect& aRect, const CCoeControl* aParent ) |
|
60 { |
|
61 iClipName = HBufC::NewL( 0 ); |
|
62 iClipLocation = HBufC::NewL( 0 ); |
|
63 |
|
64 iLayout = EOnlyName; |
|
65 |
|
66 TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) ); |
|
67 |
|
68 AknIconUtils::CreateIconL( iUpperArrow, iUpperArrowMask, |
|
69 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, |
|
70 EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask ); |
|
71 |
|
72 AknIconUtils::CreateIconL( iLowerArrow, iLowerArrowMask, |
|
73 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, |
|
74 EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask ); |
|
75 |
|
76 AknIconUtils::CreateIconL( iRightArrow, iRightArrowMask, |
|
77 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, |
|
78 EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask ); |
|
79 |
|
80 AknIconUtils::CreateIconL( iLeftArrow, iLeftArrowMask, |
|
81 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, |
|
82 EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask ); |
|
83 |
|
84 AknIconUtils::CreateIconL( iStartMarkIcon, iStartMarkIconMask, |
|
85 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_start, |
|
86 EMbmVideoeditoruicomponentsQgn_indi_vded_start_mask ); |
|
87 |
|
88 AknIconUtils::CreateIconL( iEndMarkIcon, iEndMarkIconMask, |
|
89 mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_end, |
|
90 EMbmVideoeditoruicomponentsQgn_indi_vded_end_mask ); |
|
91 |
|
92 iUpperArrowVisible = EFalse; |
|
93 iLowerArrowVisible = EFalse; |
|
94 iRightArrowVisible = EFalse; |
|
95 iLeftArrowVisible = EFalse; |
|
96 |
|
97 iSlowMotionOn = EFalse; |
|
98 |
|
99 iBlinkTimer = CPeriodic::NewL( CActive::EPriorityLow ); |
|
100 |
|
101 // Open resource file |
|
102 TFileName resourceFile; |
|
103 Dll::FileName(resourceFile); |
|
104 TParse p; |
|
105 p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &resourceFile); |
|
106 resourceFile = p.FullName(); |
|
107 iResLoader.OpenL( resourceFile ); |
|
108 |
|
109 SetContainerWindowL( *aParent ); |
|
110 SetRect( aRect ); |
|
111 ActivateL(); |
|
112 } |
|
113 |
|
114 CVeiTextDisplay::CVeiTextDisplay() : iResLoader(*CEikonEnv::Static()) |
|
115 { |
|
116 } |
|
117 |
|
118 EXPORT_C CVeiTextDisplay::~CVeiTextDisplay() |
|
119 { |
|
120 if ( iClipName ) |
|
121 { |
|
122 delete iClipName; |
|
123 } |
|
124 |
|
125 delete iClipLocation; |
|
126 delete iUpperArrow; |
|
127 delete iUpperArrowMask; |
|
128 |
|
129 delete iLowerArrow; |
|
130 delete iLowerArrowMask; |
|
131 |
|
132 delete iRightArrow; |
|
133 delete iRightArrowMask; |
|
134 |
|
135 delete iLeftArrow; |
|
136 delete iLeftArrowMask; |
|
137 |
|
138 delete iStartMarkIcon; |
|
139 delete iStartMarkIconMask; |
|
140 |
|
141 delete iEndMarkIcon; |
|
142 delete iEndMarkIconMask; |
|
143 |
|
144 if ( iBlinkTimer ) |
|
145 { |
|
146 iBlinkTimer->Cancel(); |
|
147 delete iBlinkTimer; |
|
148 } |
|
149 iResLoader.Close(); |
|
150 } |
|
151 |
|
152 void CVeiTextDisplay::SizeChanged() |
|
153 { |
|
154 TRect rect( Rect() ); |
|
155 const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
156 TInt fontHeight = font->HeightInPixels(); |
|
157 |
|
158 TSize arrowSize; |
|
159 |
|
160 if ( iLayout == EArrowsVertical ) |
|
161 { |
|
162 arrowSize = TSize( (rect.Height()-fontHeight) / 2, (rect.Height()-fontHeight) / 2 ); |
|
163 } |
|
164 else |
|
165 { |
|
166 arrowSize = iDynamicArrowSize; |
|
167 } |
|
168 |
|
169 AknIconUtils::SetSize( iUpperArrow, arrowSize, |
|
170 EAspectRatioNotPreserved ); |
|
171 |
|
172 AknIconUtils::SetSizeAndRotation( iLowerArrow, |
|
173 arrowSize, EAspectRatioNotPreserved, 180 ); |
|
174 |
|
175 AknIconUtils::SetSizeAndRotation( iRightArrow, |
|
176 arrowSize, EAspectRatioNotPreserved, 90 ); |
|
177 |
|
178 AknIconUtils::SetSizeAndRotation( iLeftArrow, |
|
179 arrowSize, EAspectRatioNotPreserved, 270 ); |
|
180 |
|
181 AknIconUtils::SetSize( iStartMarkIcon, |
|
182 iStartTimeIconRect.Size(), EAspectRatioNotPreserved); |
|
183 |
|
184 AknIconUtils::SetSize( iEndMarkIcon, |
|
185 iEndTimeIconRect.Size(), EAspectRatioNotPreserved); |
|
186 |
|
187 TInt upperArrowY = ( (rect.iBr.iY - rect.Height() / 2) - fontHeight / 2) - iUpperArrow->SizeInPixels().iHeight; |
|
188 TInt upperArrowX = (rect.iBr.iX - rect.Width() / 2) - iUpperArrow->SizeInPixels().iWidth / 2; |
|
189 |
|
190 TInt lowerArrowY = (rect.iBr.iY - rect.Height() / 2) + fontHeight / 2; |
|
191 |
|
192 iUpperArrowPoint.SetXY( upperArrowX, upperArrowY - 2 ); |
|
193 iLowerArrowPoint.SetXY( upperArrowX, lowerArrowY ); |
|
194 } |
|
195 |
|
196 EXPORT_C void CVeiTextDisplay::SetName( const TDesC& aName ) |
|
197 { |
|
198 if ( iClipName ) |
|
199 { |
|
200 delete iClipName; |
|
201 iClipName = NULL; |
|
202 } |
|
203 |
|
204 TRAP_IGNORE( |
|
205 iClipName = HBufC::NewL( aName.Length() ); |
|
206 *iClipName = aName ); |
|
207 |
|
208 DrawDeferred(); |
|
209 } |
|
210 |
|
211 |
|
212 EXPORT_C void CVeiTextDisplay::SetDuration( const TTimeIntervalMicroSeconds& aDuration ) |
|
213 { |
|
214 iDuration = aDuration; |
|
215 DrawDeferred(); |
|
216 } |
|
217 |
|
218 |
|
219 EXPORT_C void CVeiTextDisplay::SetTime( const TTime& aClipTime ) |
|
220 { |
|
221 iClipTime = aClipTime; |
|
222 } |
|
223 |
|
224 EXPORT_C void CVeiTextDisplay::SetLocation( const TDesC& aClipLocation ) |
|
225 { |
|
226 if ( iClipLocation ) |
|
227 { |
|
228 delete iClipLocation; |
|
229 iClipLocation = NULL; |
|
230 } |
|
231 |
|
232 TRAP_IGNORE( |
|
233 iClipLocation = HBufC::NewL( aClipLocation.Length() ); |
|
234 *iClipLocation = aClipLocation ); |
|
235 |
|
236 DrawDeferred(); |
|
237 } |
|
238 |
|
239 EXPORT_C void CVeiTextDisplay::SetLandscapeScreenOrientation( TBool aLandscapeScreenOrientation ) |
|
240 { |
|
241 iLandscapeScreenOrientation = aLandscapeScreenOrientation; |
|
242 |
|
243 DrawDeferred(); |
|
244 } |
|
245 |
|
246 EXPORT_C void CVeiTextDisplay::SetCutIn( const TTimeIntervalMicroSeconds& aCutInTime ) |
|
247 |
|
248 { |
|
249 iCutInTime = aCutInTime; |
|
250 DrawDeferred(); |
|
251 } |
|
252 EXPORT_C void CVeiTextDisplay::SetCutOut( const TTimeIntervalMicroSeconds& aCutOutTime ) |
|
253 { |
|
254 iCutOutTime = aCutOutTime; |
|
255 DrawDeferred(); |
|
256 } |
|
257 |
|
258 EXPORT_C void CVeiTextDisplay::SetLayout( TVeiLayout aLayout ) |
|
259 { |
|
260 iLayout = aLayout; |
|
261 |
|
262 if ( iBlinkTimer->IsActive() ) |
|
263 { |
|
264 iBlinkTimer->Cancel(); |
|
265 } |
|
266 iBlinkFlag = ETrue; |
|
267 |
|
268 if ( iLayout == ERecordingPaused ) |
|
269 { |
|
270 const TUint delay = 350000; |
|
271 iBlinkTimer->Start( delay, delay, TCallBack( CVeiTextDisplay::UpdateBlinker, this ) ); |
|
272 } |
|
273 DrawDeferred(); |
|
274 } |
|
275 |
|
276 TInt CVeiTextDisplay::UpdateBlinker( TAny* aThis ) |
|
277 { |
|
278 STATIC_CAST( CVeiTextDisplay*, aThis )->DoUpdateBlinker(); |
|
279 return 1; |
|
280 } |
|
281 |
|
282 void CVeiTextDisplay::DoUpdateBlinker() |
|
283 { |
|
284 if ( iBlinkFlag ) |
|
285 iBlinkFlag = EFalse; |
|
286 else |
|
287 iBlinkFlag = ETrue; |
|
288 |
|
289 DrawDeferred(); |
|
290 } |
|
291 |
|
292 EXPORT_C void CVeiTextDisplay::SetUpperArrowVisibility(TBool aVisible) |
|
293 { |
|
294 iUpperArrowVisible = aVisible; |
|
295 } |
|
296 |
|
297 EXPORT_C void CVeiTextDisplay::SetLowerArrowVisibility(TBool aVisible) |
|
298 { |
|
299 iLowerArrowVisible = aVisible; |
|
300 } |
|
301 |
|
302 EXPORT_C void CVeiTextDisplay::SetRightArrowVisibility(TBool aVisible) |
|
303 { |
|
304 iRightArrowVisible = aVisible; |
|
305 } |
|
306 |
|
307 EXPORT_C void CVeiTextDisplay::SetLeftArrowVisibility(TBool aVisible) |
|
308 { |
|
309 iLeftArrowVisible = aVisible; |
|
310 } |
|
311 |
|
312 EXPORT_C void CVeiTextDisplay::SetSlowMotionOn(TBool aOn) |
|
313 { |
|
314 iSlowMotionOn = aOn; |
|
315 } |
|
316 |
|
317 EXPORT_C TBool CVeiTextDisplay::SlowMotionOn() const |
|
318 { |
|
319 return iSlowMotionOn; |
|
320 } |
|
321 |
|
322 EXPORT_C void CVeiTextDisplay::SetSlowMotionPreset(TInt aPreset) |
|
323 { |
|
324 iPresetValue = aPreset; |
|
325 DrawDeferred(); |
|
326 } |
|
327 |
|
328 EXPORT_C TInt CVeiTextDisplay::SlowMotionPreset() const |
|
329 { |
|
330 return iPresetValue; |
|
331 } |
|
332 |
|
333 EXPORT_C void CVeiTextDisplay::SetArrowSize(const TSize& aArrowSize) |
|
334 { |
|
335 iDynamicArrowSize = aArrowSize; |
|
336 } |
|
337 |
|
338 void CVeiTextDisplay::Draw( const TRect& /*aRect*/ ) const |
|
339 { |
|
340 CWindowGc& gc = SystemGc(); |
|
341 |
|
342 const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
343 TFileName visualText; |
|
344 TPoint textPoint; |
|
345 TPoint persentPoint; |
|
346 TBuf<60> layoutTime; |
|
347 |
|
348 |
|
349 |
|
350 // Get text color from skin |
|
351 TRgb textColor( KRgbBlack ); |
|
352 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
353 AknsUtils::GetCachedColor(skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
354 gc.SetPenColor( textColor ); |
|
355 |
|
356 if ( (iLayout == EOnlyName) && (iClipName && iClipName->Length() > 0) ) |
|
357 { |
|
358 gc.UseFont( font ); |
|
359 |
|
360 TInt maxWidthNonClipping = Rect().Width() - 20; |
|
361 |
|
362 AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, |
|
363 visualText, *font, maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
364 |
|
365 TInt xOffset = ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2; |
|
366 if( (xOffset < 0) || iLandscapeScreenOrientation ) |
|
367 { |
|
368 xOffset = 0; |
|
369 } |
|
370 |
|
371 textPoint.iX = Rect().iTl.iX + xOffset; |
|
372 |
|
373 gc.DrawText( visualText, textPoint ); |
|
374 |
|
375 gc.DiscardFont(); |
|
376 } |
|
377 else if (((iLayout == ENameAndDuration) || (iLayout == ERecording) || |
|
378 (iLayout == ERecordingPaused)) && !iLandscapeScreenOrientation ) |
|
379 { |
|
380 gc.UseFont( font ); |
|
381 |
|
382 TBuf<10> durationValue; |
|
383 |
|
384 TInt maxWidthNonClipping = Rect().Width() - 20; |
|
385 |
|
386 ParseTimeToMinSec( layoutTime, iDuration ); |
|
387 durationValue.Append( layoutTime); |
|
388 |
|
389 TFileName nameAndDuration; |
|
390 if (iClipName) |
|
391 { |
|
392 nameAndDuration.Append( *iClipName ); |
|
393 } |
|
394 |
|
395 TInt durationWidthValue = font->TextWidthInPixels(durationValue); |
|
396 |
|
397 AknBidiTextUtils::ConvertToVisualAndClip( nameAndDuration, visualText, *font, |
|
398 maxWidthNonClipping - durationWidthValue, |
|
399 maxWidthNonClipping ); |
|
400 |
|
401 LOGFMT(KVideoEditorLogFile, "CVeiTextDisplay::Draw: duration width: %d", durationWidthValue); |
|
402 |
|
403 |
|
404 visualText.Append( _L(" ") ); |
|
405 visualText.Append( durationValue ); |
|
406 |
|
407 textPoint.iX = Rect().iTl.iX |
|
408 + ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2; |
|
409 |
|
410 if ((iLayout == ERecording) || (iLayout == ERecordingPaused)) |
|
411 { |
|
412 if ( iBlinkFlag ) |
|
413 gc.SetPenColor( KRgbRed ); |
|
414 else |
|
415 { |
|
416 gc.DiscardFont(); |
|
417 return; |
|
418 } |
|
419 } |
|
420 gc.DrawText( visualText, textPoint ); |
|
421 |
|
422 gc.DiscardFont(); |
|
423 } |
|
424 else if (iLayout == ECutInCutOut) |
|
425 { |
|
426 gc.UseFont( font ); |
|
427 |
|
428 TBuf<40> cutInValue; |
|
429 TBuf<40> cutOutValue; |
|
430 TFileName visualText2; |
|
431 |
|
432 ParseTimeToMinSec( layoutTime, iCutInTime ); |
|
433 cutInValue.Append( layoutTime ); |
|
434 ParseTimeToMinSec( layoutTime, iCutOutTime ); |
|
435 cutOutValue.Append( layoutTime ); |
|
436 |
|
437 AknBidiTextUtils::ConvertToVisualAndClip( cutInValue, visualText, *font, iStartTimeTextRect.Width(), |
|
438 iStartTimeTextRect.Width()); |
|
439 |
|
440 AknBidiTextUtils::ConvertToVisualAndClip( cutOutValue, visualText2, *font, iEndTimeTextRect.Width(), |
|
441 iEndTimeTextRect.Width() ); |
|
442 |
|
443 TInt cutInWidth = font->TextWidthInPixels( visualText ); |
|
444 TInt cutOutWidth = font->TextWidthInPixels( visualText2 ); |
|
445 TInt marginWidth( font->MaxCharWidthInPixels() /2 ); |
|
446 |
|
447 gc.DrawText( visualText, iStartTimeTextRect, font->AscentInPixels(), CGraphicsContext::ELeft, 0 ); |
|
448 gc.DrawText( visualText2, iEndTimeTextRect, font->AscentInPixels(), CGraphicsContext::ELeft, 0 ); |
|
449 gc.DiscardFont(); |
|
450 |
|
451 gc.BitBltMasked( iStartTimeIconRect.iTl, iStartMarkIcon, iStartTimeIconRect.Size(), |
|
452 iStartMarkIconMask, EFalse); |
|
453 gc.BitBltMasked( iEndTimeIconRect.iTl, iEndMarkIcon, iEndTimeIconRect.Size(), |
|
454 iEndMarkIconMask, EFalse); |
|
455 |
|
456 } |
|
457 else if (((iLayout == ENameAndDuration ) ||(iLayout == EEverything) || (iLayout == ERecording) || |
|
458 (iLayout == ERecordingPaused)) && iLandscapeScreenOrientation ) |
|
459 { |
|
460 gc.UseFont( font ); |
|
461 textPoint.iX = Rect().iTl.iX; |
|
462 |
|
463 TBuf<24> dateFormatString; |
|
464 TBuf<24> timeFormatString; |
|
465 StringLoader::Load( dateFormatString, R_QTN_DATE_USUAL_WITH_ZERO, iEikonEnv ); |
|
466 StringLoader::Load( timeFormatString, R_QTN_TIME_LONG_WITH_ZERO, iEikonEnv ); |
|
467 |
|
468 TBuf<50> dateValue; |
|
469 TBuf<40> timeValue; |
|
470 TBuf<40> durationValue; |
|
471 |
|
472 // these should not fail... |
|
473 TRAPD(err1, iClipTime.FormatL( dateValue, dateFormatString )); |
|
474 if (KErrNone != err1) |
|
475 { |
|
476 dateValue.Zero(); |
|
477 } |
|
478 TRAP(err1, iClipTime.FormatL( timeValue, timeFormatString )); |
|
479 if (KErrNone != err1) |
|
480 { |
|
481 timeValue.Zero(); |
|
482 } |
|
483 |
|
484 ParseTimeToMinSec( layoutTime, iDuration ); |
|
485 durationValue.Append( layoutTime ); |
|
486 |
|
487 TBuf<64> durString; |
|
488 StringLoader::Load( durString, R_VEI_EDIT_VIDEO_DURATION, iEikonEnv ); |
|
489 durationValue.Insert( 0, durString ); |
|
490 |
|
491 TInt maxWidthNonClipping = Rect().Width() - 10; |
|
492 /* name */ |
|
493 if (iClipName) |
|
494 { |
|
495 AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, |
|
496 maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
497 |
|
498 if ((iLayout == ERecording) || (iLayout == ERecordingPaused)) |
|
499 { |
|
500 if ( iBlinkFlag ) |
|
501 { |
|
502 gc.SetPenColor( KRgbRed ); |
|
503 gc.DrawText( visualText, textPoint ); |
|
504 } |
|
505 } |
|
506 else |
|
507 { |
|
508 gc.DrawText( visualText, textPoint ); |
|
509 } |
|
510 gc.SetPenColor( textColor ); |
|
511 } |
|
512 |
|
513 /* date */ |
|
514 AknBidiTextUtils::ConvertToVisualAndClip( dateValue, visualText, *font, |
|
515 maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
516 |
|
517 textPoint.iY += font->HeightInPixels() + 3; |
|
518 gc.DrawText( visualText, textPoint ); |
|
519 /* time */ |
|
520 AknBidiTextUtils::ConvertToVisualAndClip( timeValue, visualText, *font, |
|
521 maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
522 |
|
523 textPoint.iY += font->HeightInPixels() + 3; |
|
524 gc.DrawText( visualText, textPoint ); |
|
525 /* location */ |
|
526 if( iClipLocation && iClipLocation->Length() > 0 ) |
|
527 { |
|
528 AknBidiTextUtils::ConvertToVisualAndClip( *iClipLocation, visualText, *font, |
|
529 maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
530 |
|
531 textPoint.iY += font->HeightInPixels() + 3; |
|
532 gc.DrawText( visualText, textPoint ); |
|
533 } |
|
534 /* duration */ |
|
535 AknBidiTextUtils::ConvertToVisualAndClip( durationValue, visualText, *font, |
|
536 maxWidthNonClipping, maxWidthNonClipping + 10 ); |
|
537 |
|
538 textPoint.iY += font->HeightInPixels() + 3; |
|
539 gc.DrawText( visualText, textPoint ); |
|
540 |
|
541 gc.DiscardFont(); |
|
542 } |
|
543 else if ( iLayout == EArrowsVertical ) |
|
544 { |
|
545 // ** Transition ** |
|
546 gc.UseFont( font ); |
|
547 |
|
548 TInt maxWidthNonClipping = Rect().Width()-20; |
|
549 |
|
550 if (iClipName) |
|
551 { |
|
552 AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, maxWidthNonClipping, |
|
553 maxWidthNonClipping+10); |
|
554 |
|
555 TInt xOffset = ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2; |
|
556 if( xOffset < 0) |
|
557 { |
|
558 xOffset = 0; |
|
559 } |
|
560 |
|
561 textPoint.iX = Rect().iTl.iX + xOffset; |
|
562 textPoint.iY = (Rect().iBr.iY - iLowerArrow->SizeInPixels().iHeight) - 2; |
|
563 |
|
564 gc.DrawText( visualText, textPoint ); |
|
565 gc.DiscardFont(); |
|
566 } |
|
567 |
|
568 TPoint upperArrowPos( Rect().iTl ); |
|
569 if(iUpperArrowVisible) |
|
570 { |
|
571 TRect upArrowIconSourceRect(0, 0, iUpperArrow->SizeInPixels().iWidth, |
|
572 iUpperArrow->SizeInPixels().iHeight); |
|
573 |
|
574 gc.BitBltMasked( iUpperArrowPoint, iUpperArrow, upArrowIconSourceRect, |
|
575 iUpperArrowMask, EFalse); |
|
576 |
|
577 } |
|
578 |
|
579 if(iLowerArrowVisible) |
|
580 { |
|
581 TRect downArrowIconSourceRect(0, 0, iLowerArrow->SizeInPixels().iWidth, |
|
582 iLowerArrow->SizeInPixels().iHeight); |
|
583 |
|
584 gc.BitBltMasked( iLowerArrowPoint, iLowerArrow, downArrowIconSourceRect, |
|
585 iLowerArrowMask, EFalse); |
|
586 } |
|
587 } |
|
588 |
|
589 else if ( iLayout == EArrowsHorizontal ) |
|
590 { |
|
591 // ** SlowMotion ** |
|
592 if(iSlowMotionOn) |
|
593 { |
|
594 gc.UseFont( font ); |
|
595 visualText.Format( _L("%d"),iPresetValue ); |
|
596 |
|
597 // *** % char added in asciicode format |
|
598 visualText.Append(37); |
|
599 |
|
600 textPoint.iY = Rect().iTl.iY; |
|
601 textPoint.iY = textPoint.iY + font->HeightInPixels(); |
|
602 TInt NumberWidthInPixels = font->TextWidthInPixels( visualText ); |
|
603 |
|
604 // TRect's middle point |
|
605 textPoint.iX = Rect().iTl.iX + (Rect().iBr.iX - Rect().iTl.iX) / 2; |
|
606 textPoint.iX = textPoint.iX - NumberWidthInPixels / 2; |
|
607 gc.DrawText( visualText, textPoint ); |
|
608 gc.DiscardFont(); |
|
609 |
|
610 if(iLeftArrowVisible) |
|
611 { |
|
612 TPoint leftArrowPos( Rect().iTl.iX, ( Rect().iBr.iY - Rect().Height() / 2 ) - |
|
613 iLeftArrow->SizeInPixels().iHeight / 2 ); |
|
614 |
|
615 TRect leftArrowIconSourceRect(0, 0, iLeftArrow->SizeInPixels().iWidth, |
|
616 iLeftArrow->SizeInPixels().iHeight); |
|
617 |
|
618 gc.BitBltMasked( leftArrowPos, iLeftArrow, leftArrowIconSourceRect, |
|
619 iLeftArrowMask, EFalse); |
|
620 } |
|
621 |
|
622 if(iRightArrowVisible) |
|
623 { |
|
624 TPoint rightArrowPos( Rect().iBr.iX - iRightArrow->SizeInPixels().iWidth, |
|
625 ( Rect().iBr.iY - Rect().Height() / 2 ) - iLeftArrow->SizeInPixels().iHeight / 2 ); |
|
626 |
|
627 TRect rightArrowIconSourceRect(0, 0, iRightArrow->SizeInPixels().iWidth, |
|
628 iRightArrow->SizeInPixels().iHeight); |
|
629 |
|
630 gc.BitBltMasked( rightArrowPos, iRightArrow, rightArrowIconSourceRect, |
|
631 iRightArrowMask, EFalse); |
|
632 } |
|
633 } |
|
634 else |
|
635 { |
|
636 // ** Trim for MMS ** |
|
637 TPoint rightArrowPos( Rect().iTl ); |
|
638 if(iRightArrowVisible) |
|
639 { |
|
640 rightArrowPos.SetXY( Rect().iBr.iX, Rect().iBr.iY - iRightArrow->SizeInPixels().iHeight ); |
|
641 |
|
642 TRect rightArrowIconSourceRect(0, 0, iRightArrow->SizeInPixels().iWidth, |
|
643 iRightArrow->SizeInPixels().iHeight); |
|
644 |
|
645 gc.BitBltMasked( rightArrowPos, iRightArrow, rightArrowIconSourceRect, |
|
646 iRightArrowMask, EFalse); |
|
647 } |
|
648 TPoint leftArrowPos( Rect().iTl); |
|
649 if(iLeftArrowVisible) |
|
650 { |
|
651 leftArrowPos.SetXY( Rect().iTl.iX - iLeftArrow->SizeInPixels().iWidth, rightArrowPos.iY ); |
|
652 |
|
653 TRect leftArrowIconSourceRect(0, 0, iLeftArrow->SizeInPixels().iWidth, |
|
654 iLeftArrow->SizeInPixels().iHeight); |
|
655 |
|
656 gc.BitBltMasked( leftArrowPos, iLeftArrow, leftArrowIconSourceRect, |
|
657 iLeftArrowMask, EFalse); |
|
658 } |
|
659 |
|
660 if (iClipName) |
|
661 { |
|
662 gc.UseFont( font ); |
|
663 |
|
664 persentPoint.iX = Rect().iTl.iX + Rect().Width() / 2; |
|
665 persentPoint.iX = persentPoint.iX - (font->TextWidthInPixels( *iClipName ) ) / 2; |
|
666 |
|
667 persentPoint.iY = rightArrowPos.iY + iLeftArrow->SizeInPixels().iHeight; |
|
668 persentPoint.iY = persentPoint.iY; |
|
669 |
|
670 TInt maxWidthNonClipping = Rect().Width() - 20; |
|
671 AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, maxWidthNonClipping, maxWidthNonClipping + 20 ); |
|
672 |
|
673 gc.DrawText( visualText, persentPoint ); |
|
674 gc.DiscardFont(); |
|
675 } |
|
676 } |
|
677 } |
|
678 } |
|
679 |
|
680 void CVeiTextDisplay::ParseTimeToMinSec( TDes& aLayoutTime, const TTimeIntervalMicroSeconds& aDuration ) const |
|
681 { |
|
682 //minutes and seconds "120:13" |
|
683 aLayoutTime.Zero(); |
|
684 TBuf<30> minsec; |
|
685 TInt64 duration = 0; |
|
686 TTimeIntervalMinutes minutes; |
|
687 TTimeIntervalMicroSeconds32 seconds; |
|
688 duration = ( aDuration.Int64() / 1000 ); |
|
689 |
|
690 TChar timeSeparator = TLocale().TimeSeparator(2); |
|
691 //over 1 minute |
|
692 if( duration >= 60000 ) |
|
693 { |
|
694 minutes = TTimeIntervalMinutes (static_cast<TInt32>(duration) / 60000 ); |
|
695 minsec.AppendNum( minutes.Int() ); |
|
696 minsec.Append( timeSeparator ); |
|
697 |
|
698 duration = duration - TInt64(minutes.Int()) * TInt64(60000); |
|
699 } |
|
700 else |
|
701 { |
|
702 minsec.Append( _L( "0" ) ); |
|
703 minsec.Append( timeSeparator ); |
|
704 } |
|
705 if( duration >= 1000 ) |
|
706 { |
|
707 seconds = TTimeIntervalMicroSeconds32 (static_cast<TInt32>(duration) / 1000 ); |
|
708 |
|
709 if( seconds.Int() >= 60 ) |
|
710 { |
|
711 minsec.AppendNum( seconds.Int() - 60 ); |
|
712 } |
|
713 else |
|
714 { |
|
715 if ( seconds.Int() < 10 ) |
|
716 { |
|
717 minsec.Append( _L("0") ); |
|
718 } |
|
719 |
|
720 minsec.AppendNum( seconds.Int() ); |
|
721 } |
|
722 } |
|
723 else |
|
724 { |
|
725 minsec.Append( _L("00") ); |
|
726 } |
|
727 aLayoutTime.Append( minsec ); |
|
728 |
|
729 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aLayoutTime ); |
|
730 } |
|
731 |
|
732 // ---------------------------------------------------------------------------- |
|
733 // CVeiTextDisplay::SetComponentRect |
|
734 // |
|
735 // ---------------------------------------------------------------------------- |
|
736 // |
|
737 EXPORT_C void CVeiTextDisplay::SetComponentRect(TTextDisplayComponent aComponentIndex, TRect aRect) |
|
738 { |
|
739 switch ( aComponentIndex ) |
|
740 { |
|
741 case EStartTimeText: |
|
742 { |
|
743 iStartTimeTextRect = aRect; |
|
744 break; |
|
745 } |
|
746 case EEndTimeText: |
|
747 { |
|
748 iEndTimeTextRect= aRect; |
|
749 break; |
|
750 } |
|
751 case EStartTimeIcon: |
|
752 { |
|
753 iStartTimeIconRect = aRect; |
|
754 break; |
|
755 } |
|
756 case EEndTimeIcon: |
|
757 { |
|
758 iEndTimeIconRect= aRect; |
|
759 break; |
|
760 } |
|
761 } |
|
762 } |
|
763 |
|
764 // End of File |
|