1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * |
|
14 * Description: Control that displays current station information |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknsconstants.h> |
|
20 #include <aknutils.h> |
|
21 #include <biditext.h> |
|
22 |
|
23 #include <alf/alfcontrolgroup.h> |
|
24 #include <alf/alfdecklayout.h> |
|
25 #include <alf/alfenv.h> |
|
26 #include <alf/alfevent.h> |
|
27 #include <alf/alflayout.h> |
|
28 #include <alf/alfgridlayout.h> |
|
29 #include <alf/alftextvisual.h> |
|
30 #include <alf/alfviewportlayout.h> |
|
31 |
|
32 |
|
33 //#include "vrdebug.h" |
|
34 #include "irstationinformationdata.h" |
|
35 #include "irstationinformationdisplay.h" |
|
36 #include "irdebug.h" |
|
37 |
|
38 // Tag to identify a text visual with. |
|
39 _LIT8( KVRTagTextVisual, "KVRTagTextVisual" ); |
|
40 // Tag to identify a layout visual with. |
|
41 _LIT8( KVRTagLayout, "KVRTagLayout" ); |
|
42 |
|
43 // Time in milliseconds to spend animating the displays moving in and out of the screen. |
|
44 const TInt KVRDisplayFadeTime = 400; |
|
45 |
|
46 // This is context-sensitive per scrollable visual, so the actual start time depends on the additional application logic. |
|
47 const TInt KVRScrollDelayTime = 1000; |
|
48 // Time in milliseconds to snooze after scrolling has completed. |
|
49 // This is used to halt the scrolling at the very end for a period of time, making it visually more pleasing. |
|
50 const TInt KVRScrollSnoozeTime = 1000; |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Two-phased constructor. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CIRStationInformationDisplay* CIRStationInformationDisplay::NewL( CAlfEnv& aEnv, |
|
57 TInt aControlGroupId,CAlfLayout* aParentLayout ) |
|
58 { |
|
59 |
|
60 CIRStationInformationDisplay* self = new ( ELeave ) |
|
61 CIRStationInformationDisplay( *aParentLayout ); |
|
62 CleanupStack::PushL( self ); |
|
63 self->ConstructL( aEnv, aControlGroupId, aParentLayout ); |
|
64 CleanupStack::Pop( self ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // Constructor. |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CIRStationInformationDisplay::CIRStationInformationDisplay( CAlfLayout& aParentLayout ) |
|
73 : iParentAnchorLayout( aParentLayout ) |
|
74 { |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // Second-phase constructor. |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CIRStationInformationDisplay::ConstructL( CAlfEnv& aEnv, TInt aControlGroupId, |
|
82 CAlfLayout* aParentLayout ) |
|
83 { |
|
84 CAlfControl::ConstructL( aEnv ); |
|
85 |
|
86 |
|
87 // Base layout is created here so the control can be as independent from the parent layout as possible. |
|
88 iBaseLayout = CAlfDeckLayout::AddNewL( *this, aParentLayout ); |
|
89 |
|
90 aEnv.ControlGroup( aControlGroupId ).AppendL( this ); // Takes ownership. No leaving code allowed after this call. |
|
91 iLandScapSetFalg=EFalse; |
|
92 |
|
93 } |
|
94 |
|
95 // <TUNING TEMP> |
|
96 CIRStationInformationDisplay::~CIRStationInformationDisplay() |
|
97 { |
|
98 Env().CancelCustomCommands( this ); |
|
99 iRdsDataText.Close(); |
|
100 } |
|
101 |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // Sets the displayed data. |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 void CIRStationInformationDisplay::SetDisplayedDataL( const CIRStationInformationData& aData ) |
|
108 { |
|
109 FadeOutDisplay( aData ); |
|
110 CreateDisplayL( aData ); |
|
111 FadeInDisplay( aData ); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Sets the RDS data display which is used only in landscape. |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void CIRStationInformationDisplay::SetDisplayOrientation( TBool aLandscape ) |
|
119 { |
|
120 if ( iLandscape && !aLandscape ) |
|
121 { |
|
122 // Going from landscape to portrait: Remove separate display for RDS data. |
|
123 iParentAnchorLayout.Remove( iRdsDataLayout, 0 ); |
|
124 } |
|
125 iLandscape = aLandscape; |
|
126 } |
|
127 |
|
128 TIRFadeStyle CIRStationInformationDisplay::FadeStyle() |
|
129 { |
|
130 return iFadeStyle; |
|
131 } |
|
132 // --------------------------------------------------------------------------- |
|
133 // Sets the RDS data. |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void CIRStationInformationDisplay::RdsDataReceivedL( const TDesC& aRdsData ) |
|
137 { |
|
138 |
|
139 if ( iRdsData ) |
|
140 { |
|
141 TBool rdsDataExisted = iRdsData->Text().Length() ? ETrue : EFalse; |
|
142 TAlfTimedValue opacity( iRdsData->Opacity().ValueNow() ); |
|
143 |
|
144 if ( aRdsData.Length() ) |
|
145 { |
|
146 if ( rdsDataExisted ) |
|
147 { |
|
148 if( iRdsDataText != aRdsData ) |
|
149 { |
|
150 iRdsDataText.Close(); |
|
151 iRdsDataText.CreateL( aRdsData ); |
|
152 // Fade out previous text. |
|
153 opacity.SetTarget( 0.0f, KVRDisplayFadeTime ); |
|
154 FadeVisual( *iRdsData, opacity ); |
|
155 // Displaying RDS text will be started after fade out is done. |
|
156 Env().Send( |
|
157 TAlfCustomEventCommand( EIRCustomEventVisualFadeOutCompleted, this ), |
|
158 KVRDisplayFadeTime ); |
|
159 } |
|
160 |
|
161 } |
|
162 else |
|
163 { |
|
164 iRdsDataText.Close(); |
|
165 iRdsDataText.CreateL( aRdsData ); |
|
166 iRdsData->SetTextL( iRdsDataText ); |
|
167 // Start to display RDS text. |
|
168 DisplayRdsDataL(); |
|
169 // Fade in. |
|
170 if ( !iLandscape ) |
|
171 { |
|
172 // Orientation is portrait. |
|
173 iLayout->SetRowsL( iLayout->RowCount() + 1 ); |
|
174 iLayout->Reorder( *iRdsDataLayout, iLayout->RowCount() - 1, |
|
175 KVRDisplayFadeTime ); |
|
176 iRdsData->SetFlag( EAlfVisualFlagManualPosition ); |
|
177 iName->SetFlag( EAlfVisualFlagManualPosition ); |
|
178 iLayout->UpdateChildrenLayout( KVRDisplayFadeTime ); |
|
179 iRdsData->ClearFlag( EAlfVisualFlagManualPosition ); |
|
180 iName->ClearFlag( EAlfVisualFlagManualPosition ); |
|
181 } |
|
182 opacity.SetTarget( 1.0f, KVRDisplayFadeTime ); |
|
183 FadeVisual( *iRdsData, opacity ); |
|
184 } |
|
185 } |
|
186 else // RDS data has been lost. |
|
187 { |
|
188 } |
|
189 } |
|
190 } |
|
191 |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // From class CAlfControl. |
|
195 // Called when a visual's layout has been updated. |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 void CIRStationInformationDisplay::VisualLayoutUpdated( CAlfVisual& aVisual ) |
|
199 { |
|
200 CAlfControl::VisualLayoutUpdated( aVisual ); |
|
201 |
|
202 // TO be done Special handling for scrolling required while changing orientation... |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // From class CAlfControl. |
|
207 // Event handler. |
|
208 // --------------------------------------------------------------------------- |
|
209 // |
|
210 TBool CIRStationInformationDisplay::OfferEventL( const TAlfEvent& aEvent ) |
|
211 { |
|
212 TBool eventHandled = EFalse; |
|
213 |
|
214 if ( aEvent.IsCustomEvent() ) |
|
215 { |
|
216 |
|
217 |
|
218 switch ( aEvent.CustomParameter() ) |
|
219 { |
|
220 case EIRCustomEventDisplayFadeInCompleted: |
|
221 { |
|
222 // When a display has faded in, its position will be handled by the framework and text scrolling should start. |
|
223 reinterpret_cast<CAlfGridLayout*>( aEvent.CustomEventData() )->ClearFlag( |
|
224 EAlfVisualFlagManualPosition ); |
|
225 // Start to display name.to be changed |
|
226 iNameMarqueeClet.StartL( KVRScrollDelayTime, KVRScrollSnoozeTime ); |
|
227 // Start to display RDS data. |
|
228 DisplayRdsDataL(); |
|
229 eventHandled = ETrue; |
|
230 break; |
|
231 } |
|
232 case EIRCustomEventDisplayFadeOutCompleted: |
|
233 { |
|
234 // When display has faded out old layout needs to be destroyed |
|
235 reinterpret_cast<CAlfGridLayout*> |
|
236 ( aEvent.CustomEventData() )->RemoveAndDestroyAllD(); |
|
237 eventHandled = ETrue; |
|
238 break; |
|
239 } |
|
240 case EIRCustomEventVisualFadeOutCompleted: |
|
241 { |
|
242 iRdsData->SetTextL( iRdsDataText ); |
|
243 if ( iRdsDataText.Length() ) |
|
244 { |
|
245 // Start to display RDS data. |
|
246 DisplayRdsDataL(); |
|
247 // Fade in. |
|
248 TAlfTimedValue opacity( iRdsData->Opacity().ValueNow() ); |
|
249 opacity.SetTarget( 1.0f, KVRDisplayFadeTime ); |
|
250 FadeVisual( *iRdsData, opacity ); |
|
251 } |
|
252 eventHandled = ETrue; |
|
253 break; |
|
254 } |
|
255 default: |
|
256 break; |
|
257 } |
|
258 } |
|
259 |
|
260 return eventHandled; |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // Creates a new display that is used to show the supplied data. |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 void CIRStationInformationDisplay::CreateDisplayL( const CIRStationInformationData& aData ) |
|
268 { |
|
269 |
|
270 iFadeStyle = aData.FadeDirectionality(); |
|
271 iLayout = CAlfGridLayout::AddNewL( *this, 1, 1, iBaseLayout ); |
|
272 |
|
273 // A separate layout has to be created for the station's index and its name as |
|
274 // the index has to be a separate entity from the name due to scrolling issues. |
|
275 // This layout will contain both of these texts, but only the name can scroll. |
|
276 // Index is never scrolled, and both fields are center-aligned to the display. |
|
277 iNameIndexLayout = CAlfGridLayout::AddNewL( *this, 2, 1, iLayout ); |
|
278 iNameIndexLayout->SetTagL( KVRTagLayout ); |
|
279 |
|
280 iIndex = CAlfTextVisual::AddNewL( *this, iNameIndexLayout ); |
|
281 iIndex->SetTextL( aData.Index() ); |
|
282 iIndex->SetTagL( KVRTagTextVisual ); |
|
283 iIndex->SetOpacity( 0.0f ); |
|
284 iIndex->SetColor( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
285 iIndex->SetStyle( EAlfTextStyleSmall ); |
|
286 iIndex->SetAlign( EAlfAlignHLocaleMirrored, EAlfAlignVCenter ); // Right-aligned normally, left-aligned in mirrored. |
|
287 |
|
288 CAlfViewportLayout* nameViewport = CAlfViewportLayout::AddNewL( *this, iNameIndexLayout ); |
|
289 nameViewport->SetFlag( EAlfVisualFlagLayoutUpdateNotification ); |
|
290 nameViewport->SetTagL( KVRTagLayout ); |
|
291 |
|
292 iName = CAlfTextVisual::AddNewL( *this, nameViewport ); |
|
293 iName->SetTextL( aData.Name() ); |
|
294 iName->SetTagL( KVRTagTextVisual ); |
|
295 iName->SetOpacity( 0.0f ); |
|
296 iName->SetColor( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
297 iName->SetStyle( EAlfTextStyleSmall ); |
|
298 iName->SetAlign( EAlfAlignHLocale, EAlfAlignVCenter ); |
|
299 iName->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
300 |
|
301 // Forces the viewport marquee to use a linear interpolation style. |
|
302 TAlfTimedPoint point( 0.0f, 0.0f ); |
|
303 point.SetStyle( EAlfTimedValueStyleLinear ); |
|
304 iName->SetPos( point ); |
|
305 |
|
306 |
|
307 if ( AknLayoutUtils::LayoutMirrored() ) |
|
308 { |
|
309 // In mirrored layouts the name is on the left side. |
|
310 |
|
311 iNameIndexLayout->Reorder( *nameViewport, 0, 0 ); |
|
312 } |
|
313 |
|
314 // Decides the correct directionality for the scroll. |
|
315 iNameMarqueeClet.Set( *nameViewport, *iName ); |
|
316 |
|
317 // This is added due to possible scrolling issues. |
|
318 // Grid layout (iRdsDataLayout) for RDS data is added due to possible scrolling issues. |
|
319 // For some reason scrolling won’t work without this extra grid layout. |
|
320 if ( iLandscape ) |
|
321 { |
|
322 // Landscape: Create own separate display for RDS data. |
|
323 iLandScapSetFalg=ETrue; |
|
324 iRdsDataLayout = CAlfGridLayout::AddNewL( *this, 1, 1, &iParentAnchorLayout ); |
|
325 } |
|
326 else |
|
327 { |
|
328 // Portrait: RDS data will be displayed below the station information. |
|
329 iRdsDataLayout = CAlfGridLayout::AddNewL( *this, 1, 1, iLayout ); |
|
330 } |
|
331 iRdsDataLayout->SetTagL( KVRTagLayout ); |
|
332 |
|
333 // RDS data view port. |
|
334 CAlfViewportLayout* rdsDataViewport = CAlfViewportLayout::AddNewL( *this, iRdsDataLayout ); |
|
335 rdsDataViewport->SetFlag( EAlfVisualFlagLayoutUpdateNotification ); |
|
336 rdsDataViewport->SetTagL( KVRTagLayout ); |
|
337 |
|
338 // RDS data text visual. |
|
339 iRdsDataText.Close(); |
|
340 iRdsDataText.CreateL( aData.RdsPsName() ); |
|
341 iRdsData = CAlfTextVisual::AddNewL( *this, rdsDataViewport ); |
|
342 iRdsData->SetTextL( iRdsDataText ); |
|
343 iRdsData->SetTagL( KVRTagTextVisual ); |
|
344 iRdsData->SetOpacity( 0.0f ); |
|
345 iRdsData->SetColor( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
|
346 iRdsData->SetStyle( EAlfTextStyleSmall ); |
|
347 iRdsData->SetWrapping( CAlfTextVisual::ELineWrapManual ); |
|
348 iRdsData->SetPos( point ); |
|
349 |
|
350 // Set RDS data. |
|
351 iRdsDataMarqueeClet.Set( *rdsDataViewport, *iRdsData ); |
|
352 // RDS data scrolling style is continuous scrolling. |
|
353 iRdsDataMarqueeClet.SetScrollStyle( TIRMarqueeClet::EIRScrollStyleLoop ); |
|
354 |
|
355 // Determining the initial row count for the grid and reordering its elements. |
|
356 TInt rowCount = 1;//1 |
|
357 if ( iIndex->Text().Length() || iName->Text().Length() ) |
|
358 { |
|
359 //rowCount++; |
|
360 } |
|
361 if ( iRdsData->Text().Length() && !iLandscape ) |
|
362 { |
|
363 rowCount++; |
|
364 // RDS data will always be the last element in the grid. |
|
365 iLayout->Reorder( *iRdsDataLayout, rowCount - 1, 0 );//3rd 0 |
|
366 } |
|
367 |
|
368 |
|
369 iLayout->SetRowsL( rowCount ); |
|
370 // Calculates the layout for station index and name by using grid weights. |
|
371 // Two cases are considered: |
|
372 // 1) Index and name fit on the screen without scrolling. |
|
373 // In this case they are center-aligned on the screen. |
|
374 // 2) Index and name do not fit on the screen, scrolling must be used. |
|
375 // In this case the index is aligned to either to the left or right, |
|
376 // depending on the used locale, and the name will scroll as a separate |
|
377 // entity. |
|
378 |
|
379 |
|
380 TInt layoutWidth = static_cast<TInt>( iNameIndexLayout->Size().ValueNow().iX ); |
|
381 |
|
382 TInt indexWidth = iIndex->TextExtents().iWidth; |
|
383 TInt nameWidth = iName->TextExtents().iWidth; |
|
384 |
|
385 if ( layoutWidth < indexWidth + nameWidth ) |
|
386 { |
|
387 nameWidth = layoutWidth - indexWidth; |
|
388 } |
|
389 else |
|
390 { |
|
391 TInt overflow = layoutWidth - indexWidth - nameWidth; |
|
392 |
|
393 // Overlowing part of the layout is split evenly between the index and the name. |
|
394 indexWidth += overflow / 2; |
|
395 nameWidth += overflow / 2; |
|
396 } |
|
397 |
|
398 RArray<TInt> weights; |
|
399 CleanupClosePushL( weights ); |
|
400 if ( AknLayoutUtils::LayoutMirrored() ) |
|
401 { |
|
402 weights.AppendL( nameWidth ); |
|
403 weights.AppendL( indexWidth ); |
|
404 } |
|
405 else |
|
406 { |
|
407 weights.AppendL( indexWidth ); |
|
408 weights.AppendL( nameWidth ); |
|
409 } |
|
410 iNameIndexLayout->SetColumnsL( weights ); |
|
411 CleanupStack::PopAndDestroy( &weights ); |
|
412 iLayout->UpdateChildrenLayout(); |
|
413 |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // Fades in the current display. |
|
418 // --------------------------------------------------------------------------- |
|
419 // |
|
420 void CIRStationInformationDisplay::FadeInDisplay( const CIRStationInformationData& aData ) |
|
421 { |
|
422 if ( iLayout ) |
|
423 { |
|
424 TAlfRealPoint size = iLayout->Size().ValueNow(); |
|
425 TAlfRealPoint pos = iLayout->Pos().ValueNow(); |
|
426 |
|
427 TAlfTimedValue opacity( 0.0f ); |
|
428 opacity.SetStyle( EAlfTimedValueStyleDecelerate ); |
|
429 |
|
430 TInt fadeTime = KVRDisplayFadeTime; |
|
431 |
|
432 TAlfTimedPoint point( pos.iX, pos.iY, KVRDisplayFadeTime ); |
|
433 point.SetStyle( EAlfTimedValueStyleDecelerate ); |
|
434 |
|
435 switch ( aData.FadeDirectionality() ) |
|
436 { |
|
437 case EIRFadeUnknown: |
|
438 point.iX.SetValueNow( pos.iX ); |
|
439 point.iY.SetValueNow( pos.iY ); |
|
440 break; |
|
441 case EIRFadeLeftToRight: |
|
442 point.iX.SetValueNow( pos.iX - size.iX ); |
|
443 point.iY.SetValueNow( pos.iY ); |
|
444 break; |
|
445 case EIRFadeRightToLeft: |
|
446 point.iX.SetValueNow( pos.iX + size.iX ); |
|
447 point.iY.SetValueNow( pos.iY ); |
|
448 break; |
|
449 case EIRFadeTopToBottom: |
|
450 point.iX.SetValueNow( pos.iX ); |
|
451 point.iY.SetValueNow( pos.iY - size.iY ); |
|
452 break; |
|
453 case EIRFadeBottomToTop: |
|
454 point.iX.SetValueNow( pos.iX ); |
|
455 point.iY.SetValueNow( pos.iY + size.iY ); |
|
456 break; |
|
457 case EIRFadeNoFade: |
|
458 fadeTime = 0; |
|
459 point.iX.SetValueNow( pos.iX ); |
|
460 point.iY.SetValueNow( pos.iY ); |
|
461 point.SetTarget( pos, fadeTime ); |
|
462 break; |
|
463 default: |
|
464 break; |
|
465 } |
|
466 |
|
467 opacity.SetTarget( 1.0f, fadeTime ); |
|
468 |
|
469 iLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
470 iLayout->SetPos( point ); |
|
471 FadeLayout( *iLayout, opacity ); |
|
472 |
|
473 if ( iLandscape ) |
|
474 { |
|
475 // If the orientation is landscape the RDS text layout needs to be visible regardless |
|
476 // how we got in this point, be it startup, orientation change, skin change or something |
|
477 // else. This needs to be done here because RDS text may have already been available |
|
478 // and if there is not a change in RDS text then there is no notification to update |
|
479 // RDS text which leads to not showing the available RDS text |
|
480 Env().Send( TAlfCustomEventCommand( EIRCustomEventVisualFadeOutCompleted, this ), 0 ); |
|
481 } |
|
482 Env().Send( TAlfCustomEventCommand( EIRCustomEventDisplayFadeInCompleted, this, |
|
483 reinterpret_cast<TInt>( iLayout ) ), 0 ); |
|
484 } |
|
485 } |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // Fades out the current display. |
|
489 // --------------------------------------------------------------------------- |
|
490 // |
|
491 void CIRStationInformationDisplay::FadeOutDisplay( const CIRStationInformationData& aData ) |
|
492 { |
|
493 if ( iLayout ) |
|
494 { |
|
495 TAlfRealPoint size = iLayout->Size().ValueNow(); |
|
496 TAlfRealPoint pos = iLayout->Pos().ValueNow(); |
|
497 |
|
498 TAlfTimedValue opacity( iLayout->Opacity().ValueNow() ); |
|
499 opacity.SetStyle( EAlfTimedValueStyleAccelerate ); |
|
500 opacity.SetTarget( 0.0f, KVRDisplayFadeTime ); |
|
501 |
|
502 TAlfTimedPoint point( pos.iX, pos.iY ); |
|
503 point.SetStyle( EAlfTimedValueStyleAccelerate ); |
|
504 |
|
505 TAlfRealPoint target = iLayout->Pos().Target(); |
|
506 |
|
507 TInt fadeTime = KVRDisplayFadeTime; |
|
508 |
|
509 switch ( aData.FadeDirectionality() ) |
|
510 { |
|
511 case EIRFadeUnknown: |
|
512 point.SetTarget( TAlfRealPoint( target.iX, target.iY ), KVRDisplayFadeTime ); |
|
513 break; |
|
514 case EIRFadeLeftToRight: |
|
515 point.SetTarget( TAlfRealPoint( target.iX + size.iX, target.iY ), |
|
516 KVRDisplayFadeTime ); |
|
517 break; |
|
518 case EIRFadeRightToLeft: |
|
519 point.SetTarget( TAlfRealPoint( -size.iX, target.iY ), KVRDisplayFadeTime ); |
|
520 break; |
|
521 case EIRFadeTopToBottom: |
|
522 point.SetTarget( TAlfRealPoint( target.iX, target.iY + size.iY ), |
|
523 KVRDisplayFadeTime ); |
|
524 break; |
|
525 case EIRFadeBottomToTop: |
|
526 point.SetTarget( TAlfRealPoint( target.iX, target.iY - size.iY ), |
|
527 KVRDisplayFadeTime ); |
|
528 break; |
|
529 case EIRFadeNoFade: |
|
530 fadeTime = 0; |
|
531 point.SetTarget( TAlfRealPoint( target.iX, target.iY ), fadeTime ); |
|
532 opacity.SetTarget( 0.0f, fadeTime ); |
|
533 break; |
|
534 default: |
|
535 break; |
|
536 } |
|
537 |
|
538 iLayout->SetFlag( EAlfVisualFlagManualPosition ); |
|
539 iLayout->SetPos( point ); |
|
540 FadeLayout( *iLayout, opacity ); |
|
541 |
|
542 Env().CancelCustomCommands( this, EIRCustomEventDisplayFadeInCompleted ); |
|
543 if ( iRdsDataLayout && iLayout != iRdsDataLayout->Layout() ) |
|
544 { |
|
545 |
|
546 // In landscape orientation RDS data is not part of the station information data and no fading out is needed. |
|
547 // RDS data can be removed and destroyed at once. |
|
548 Env().Send( TAlfCustomEventCommand( EIRCustomEventDisplayFadeOutCompleted, this, |
|
549 reinterpret_cast<TInt>( iRdsDataLayout ) ), 0 ); |
|
550 |
|
551 } |
|
552 Env().Send( TAlfCustomEventCommand( EIRCustomEventDisplayFadeOutCompleted, this, |
|
553 reinterpret_cast<TInt>( iLayout ) ), fadeTime ); |
|
554 } |
|
555 |
|
556 // Saved pointers to the visuals will later on be invalid, as they will get deleted in the custom event handler. |
|
557 |
|
558 iLayout = NULL; |
|
559 iNameIndexLayout = NULL; |
|
560 iRdsDataLayout = NULL; |
|
561 iName = NULL; |
|
562 iIndex = NULL; |
|
563 |
|
564 iRdsData = NULL; |
|
565 } |
|
566 |
|
567 // --------------------------------------------------------------------------- |
|
568 // Fades a single visual. |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 void CIRStationInformationDisplay::FadeVisual( CAlfVisual& aVisual,const TAlfTimedValue& aOpacity) |
|
572 { |
|
573 TAlfTimedValue opacity( aVisual.Opacity().ValueNow() ); |
|
574 opacity.SetTarget( aOpacity.Target(), aOpacity.TimeToTargetinMilliSeconds() ); |
|
575 |
|
576 if ( aVisual.Tag() == KVRTagTextVisual ) |
|
577 { |
|
578 CAlfTextVisual& visual = static_cast<CAlfTextVisual&>( aVisual ); |
|
579 if ( visual.Text().Length() ) |
|
580 { |
|
581 visual.SetOpacity( opacity ); |
|
582 visual.SetShadowOpacity( opacity ); |
|
583 } |
|
584 } |
|
585 else |
|
586 { |
|
587 aVisual.SetOpacity( opacity ); |
|
588 } |
|
589 } |
|
590 |
|
591 // --------------------------------------------------------------------------- |
|
592 // Fades all visuals contained within the supplied layout. |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 void CIRStationInformationDisplay::FadeLayout( CAlfLayout& aLayout, const TAlfTimedValue& aOpacity) |
|
596 { |
|
597 for ( TInt i = 0; i < aLayout.Count(); i++ ) |
|
598 { |
|
599 CAlfVisual& visual = aLayout.Visual( i ); |
|
600 if ( visual.Tag() == KVRTagLayout ) |
|
601 { |
|
602 FadeLayout( static_cast<CAlfLayout&>( visual ), aOpacity ); |
|
603 } |
|
604 else |
|
605 { |
|
606 FadeVisual( visual, aOpacity ); |
|
607 } |
|
608 } |
|
609 |
|
610 } |
|
611 |
|
612 |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // Starts to display RDS data. |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 void CIRStationInformationDisplay::DisplayRdsDataL() |
|
619 { |
|
620 // Set default alignment. |
|
621 if ( iLandscape ) |
|
622 { |
|
623 //iRdsData->SetAlign( EAlfAlignHLocale, EAlfAlignVCenter ) |
|
624 iRdsData->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
625 |
|
626 } |
|
627 else |
|
628 { |
|
629 iRdsData->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
630 } |
|
631 // Start displaying. |
|
632 iRdsDataMarqueeClet.StartL( KVRScrollDelayTime + KVRDisplayFadeTime); |
|
633 } |
|