1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * Implements the control for responsible for all drawings |
|
16 * in the satellite dialog |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <skinlayout.cdl.h> |
|
23 #include <AknsSkinInstance.h> |
|
24 #include <AknsUtils.h> |
|
25 #include <AknsDrawUtils.h> |
|
26 #include <StringLoader.h> |
|
27 #include <AknsFrameBackgroundControlContext.h> |
|
28 #include <aknlayoutscalable_avkon.cdl.h> |
|
29 #include <aknViewAppUi.h> |
|
30 #include <aknlayoutscalable_apps.cdl.h> |
|
31 #include <SatInfo.rsg> |
|
32 #include <AknBidiTextUtils.h> |
|
33 #include <lbssatellite.h> |
|
34 #include <satellite.mbg> |
|
35 #include <eikapp.h> |
|
36 #include <AknLayout2Def.h> |
|
37 #include <layoutmetadata.cdl.h> |
|
38 //===HEADER FILE INCLUDED FOR HACK======= |
|
39 #include <AknLayoutFont.h> |
|
40 #include <aknlocationed.h> |
|
41 // header file added for multiple drive support. |
|
42 #include <pathinfo.h> |
|
43 |
|
44 #ifdef RD_TACTILE_FEEDBACK |
|
45 #include <touchfeedback.h> |
|
46 #endif //RD_TACTILE_FEEDBACK |
|
47 |
|
48 #include "satellitecontrol.h" |
|
49 |
|
50 #include <centralrepository.h> |
|
51 #include <locationvariationdomaincrkeys.h> |
|
52 // ================= MEMBER FUNCTIONS ======================= |
|
53 |
|
54 // --------------------------------------------------------- |
|
55 // CSatelliteControl::CSatelliteControl |
|
56 // --------------------------------------------------------- |
|
57 // |
|
58 CSatelliteControl::CSatelliteControl(MSatelliteEng& aEngine): iEngine(aEngine) |
|
59 { |
|
60 //By defaul start with signal strength view |
|
61 iCurrentSatelliteView = ESignalStrengthView; |
|
62 iSatelliteSignalHeading = NULL; |
|
63 iSatelliteGrapgicHeading = NULL; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------- |
|
67 // CSatelliteControl::~CSatelliteControl |
|
68 // --------------------------------------------------------- |
|
69 // |
|
70 CSatelliteControl::~CSatelliteControl() |
|
71 { |
|
72 AknsUtils::DeregisterControlPosition(this); |
|
73 delete iEditorContext; |
|
74 delete iSatelliteSignalHeading; |
|
75 delete iSatelliteGrapgicHeading; |
|
76 delete iCompassViewHeading; |
|
77 delete iNoSatelliteData; |
|
78 delete iSatActiveBmp; |
|
79 delete iSatActiveBmpMask; |
|
80 delete iSatInActiveBmp; |
|
81 delete iSatInActiveBmpMask; |
|
82 delete iSatFrame; |
|
83 delete iSatFrameMask; |
|
84 delete iFirmamentBmp; |
|
85 delete iFirmamentBmpMask; |
|
86 delete iFirmaActiveBmp; |
|
87 delete iFirmaActiveBmpMask; |
|
88 delete iFirmaInActiveBmp; |
|
89 delete iFirmaInActiveBmpMask; |
|
90 delete iSunBmp; |
|
91 delete iSunBmpMask; |
|
92 delete iMoonBmp; |
|
93 delete iMoonBmpMask; |
|
94 delete iFirmamentCompassBmp; |
|
95 delete iFirmamentCompassBmpMask; |
|
96 delete iFixBmp; |
|
97 delete iFixBmpMask; |
|
98 delete iAltitudeWindowHeading; |
|
99 delete iSpeedWindowHeading; |
|
100 delete iDirectionWindowHeading; |
|
101 delete iSpeedFormatKmph; |
|
102 delete iSpeedFormatMph; |
|
103 delete iAltitudeFormatM; |
|
104 delete iAltitudeFormatFt; |
|
105 delete iDirectionFormat; |
|
106 delete iCompassNorth; |
|
107 delete iCompassSouth; |
|
108 delete iCompassWest; |
|
109 delete iCompassEast; |
|
110 delete iNorth; |
|
111 delete iSouth; |
|
112 delete iWest; |
|
113 delete iEast; |
|
114 delete i2DString; |
|
115 delete i3DString; |
|
116 iSignalBarRects.Reset(); |
|
117 iSatelliteNumberLayouts.Reset(); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CSatelliteControl::NewL |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 CSatelliteControl* CSatelliteControl::NewL(MSatelliteEng& aEngine) |
|
125 { |
|
126 CSatelliteControl* self = |
|
127 new(ELeave) CSatelliteControl(aEngine); |
|
128 CleanupStack::PushL( self ); |
|
129 self->ConstructL(); |
|
130 CleanupStack::Pop(); // self |
|
131 return self; |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CSatelliteControl::CountComponentControls |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 TInt CSatelliteControl::CountComponentControls() const |
|
139 { |
|
140 //No additional controls. All the drawing is done |
|
141 //by one control. Helps reduce flickering |
|
142 return 0; |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------- |
|
146 // CSatelliteControl::ComponentControl |
|
147 // --------------------------------------------------------- |
|
148 // |
|
149 CCoeControl* CSatelliteControl::ComponentControl( TInt /*aIndex*/ ) const |
|
150 { |
|
151 return NULL; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // CSatelliteControl::FocusChanged |
|
156 // --------------------------------------------------------- |
|
157 // |
|
158 void CSatelliteControl::FocusChanged( TDrawNow /*aDrawNow*/ ) |
|
159 { |
|
160 //No implemenation here for focus change |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------- |
|
164 // CSatelliteControl::MinimumSize |
|
165 // --------------------------------------------------------- |
|
166 // |
|
167 TSize CSatelliteControl::MinimumSize() |
|
168 { |
|
169 TRect rect = CalculateDialogRect(); |
|
170 TSize size = rect.Size(); |
|
171 return size; |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------- |
|
175 // CSatelliteControl::DialogRect |
|
176 // --------------------------------------------------------- |
|
177 // |
|
178 TRect CSatelliteControl::DialogRect() const |
|
179 { |
|
180 return CalculateDialogRect(); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------- |
|
184 // CSatelliteControl::DialogSize |
|
185 // --------------------------------------------------------- |
|
186 // |
|
187 TSize CSatelliteControl::DialogSize() const |
|
188 { |
|
189 TRect rect = CalculateDialogRect(); |
|
190 return (TSize(rect.Size())); |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------- |
|
194 // CSatelliteControl::WindowLayout |
|
195 // --------------------------------------------------------- |
|
196 // |
|
197 TAknWindowLineLayout CSatelliteControl::WindowLayout() const |
|
198 { |
|
199 //Get the dialogs layout and return it. |
|
200 AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); |
|
201 TInt variety(0); |
|
202 |
|
203 //Varient for LAF changes based on the location of the softkeys |
|
204 if(Layout_Meta_Data::IsLandscapeOrientation()) |
|
205 { |
|
206 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) |
|
207 { |
|
208 variety = 1; |
|
209 } |
|
210 else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) |
|
211 { |
|
212 variety = 2; |
|
213 } |
|
214 } |
|
215 else |
|
216 { |
|
217 variety = 0; |
|
218 } |
|
219 |
|
220 //Return the layout line of the dialog from LAF |
|
221 return AknLayoutScalable_Apps::popup_blid_sat_info2_window(variety).LayoutLine(); |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------------------------------- |
|
225 // CSatelliteControl::CalculateDialogRect |
|
226 // Calculates rectangle according to current LAF information. |
|
227 // ---------------------------------------------------------------------------- |
|
228 // |
|
229 TRect CSatelliteControl::CalculateDialogRect() const |
|
230 { |
|
231 TRect mainPaneRect; |
|
232 TRect screenRect; |
|
233 TInt variety(0); |
|
234 TAknLayoutRect mainPane; |
|
235 |
|
236 AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); |
|
237 if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
238 { |
|
239 if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) |
|
240 { |
|
241 screenRect = iAvkonAppUi->ApplicationRect(); |
|
242 variety = 1; |
|
243 mainPane.LayoutRect( screenRect, AknLayoutScalable_Apps::main_pane( 13 ) ); |
|
244 mainPaneRect = mainPane.Rect(); |
|
245 } |
|
246 else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) |
|
247 { |
|
248 variety = 2; |
|
249 mainPaneRect = iAvkonAppUi->ClientRect(); |
|
250 } |
|
251 else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationBottom ) |
|
252 { |
|
253 variety = 0; |
|
254 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
255 } |
|
256 } |
|
257 else |
|
258 { |
|
259 variety = 0; |
|
260 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
261 } |
|
262 |
|
263 TAknLayoutRect mainSatPane; |
|
264 mainSatPane.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::popup_blid_sat_info2_window( variety ) ); |
|
265 |
|
266 return mainSatPane.Rect(); |
|
267 |
|
268 } |
|
269 // --------------------------------------------------------- |
|
270 // CBlidManualWayPointCtrl::Layout |
|
271 // --------------------------------------------------------- |
|
272 // |
|
273 void CSatelliteControl::Layout() |
|
274 { |
|
275 SizeChanged(); |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------- |
|
279 // CBlidManualWayPointCtrl::ChangeView |
|
280 // --------------------------------------------------------- |
|
281 // |
|
282 void CSatelliteControl::ChangeViewL() |
|
283 { |
|
284 // Change the view variable and update the rects |
|
285 switch ( iCurrentSatelliteView ) |
|
286 { |
|
287 case ESignalStrengthView: |
|
288 { |
|
289 iCurrentSatelliteView = EGraphicalView; |
|
290 break; |
|
291 } |
|
292 case EGraphicalView: |
|
293 { |
|
294 TInt settingsValue = 0; |
|
295 CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) ); |
|
296 CleanupStack::PushL( repository ); |
|
297 User::LeaveIfError( repository->Get( KLocHideCoordinates, |
|
298 settingsValue )); |
|
299 CleanupStack::PopAndDestroy( repository ); |
|
300 |
|
301 if ( ELocCoordinatesHidden == settingsValue) |
|
302 { |
|
303 iCurrentSatelliteView = ESignalStrengthView; |
|
304 } |
|
305 else |
|
306 { |
|
307 iCurrentSatelliteView = ECompassView; |
|
308 } |
|
309 break; |
|
310 } |
|
311 case ECompassView: |
|
312 { |
|
313 iCurrentSatelliteView = ESignalStrengthView; |
|
314 break; |
|
315 } |
|
316 default: |
|
317 { |
|
318 break; |
|
319 } |
|
320 } |
|
321 } |
|
322 |
|
323 // --------------------------------------------------------- |
|
324 // CSatelliteControl::SetLaunchView |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void CSatelliteControl::SetLaunchView(TSatDialogView aView) |
|
328 { |
|
329 iCurrentSatelliteView = aView; |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------- |
|
333 // CSatelliteControl::PrepareGraphicalViewIcons |
|
334 // --------------------------------------------------------- |
|
335 // |
|
336 void CSatelliteControl::PrepareGraphicalViewIcons() |
|
337 { |
|
338 AknIconUtils::SetSize(iFirmamentBmp, iFirmamentRect.Size()); |
|
339 AknIconUtils::SetSize(iFirmamentBmpMask, iFirmamentRect.Size()); |
|
340 |
|
341 AknIconUtils::SetSize(iFirmaActiveBmp, iSatelliteRect.Size()); |
|
342 AknIconUtils::SetSize(iFirmaActiveBmpMask, iSatelliteRect.Size()); |
|
343 AknIconUtils::SetSize(iFirmaInActiveBmp, iSatelliteRect.Size()); |
|
344 AknIconUtils::SetSize(iFirmaInActiveBmpMask, iSatelliteRect.Size()); |
|
345 |
|
346 AknIconUtils::SetSize(iMoonBmp, iSunMoonRect.Size()); |
|
347 AknIconUtils::SetSize(iMoonBmpMask, iSunMoonRect.Size()); |
|
348 AknIconUtils::SetSize(iSunBmp, iSunMoonRect.Size()); |
|
349 AknIconUtils::SetSize(iSunBmpMask, iSunMoonRect.Size()); |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------- |
|
353 // CSatelliteControl::PrepareSignalStrengthViewIcons |
|
354 // --------------------------------------------------------- |
|
355 // |
|
356 void CSatelliteControl::PrepareSignalStrengthViewIcons() |
|
357 { |
|
358 if(!iSignalBarRects.Count()) |
|
359 { |
|
360 return; |
|
361 } |
|
362 |
|
363 TRect rect = iSignalBarRects[1]; |
|
364 AknIconUtils::SetSize(iSatFrame, rect.Size()); |
|
365 AknIconUtils::SetSize(iSatFrameMask, rect.Size()); |
|
366 } |
|
367 |
|
368 // --------------------------------------------------------- |
|
369 // CSatelliteDialog::PrepareCompassViewIcons |
|
370 // --------------------------------------------------------- |
|
371 // |
|
372 void CSatelliteControl::PrepareCompassViewIcons() |
|
373 { |
|
374 AknIconUtils::SetSize(iFirmamentCompassBmp, iFirmamentCompassRect.Size()); |
|
375 AknIconUtils::SetSize(iFirmamentCompassBmpMask, iFirmamentCompassRect.Size()); |
|
376 |
|
377 AknIconUtils::SetSize(iFixBmp, iTypeRect.Size()); |
|
378 AknIconUtils::SetSize(iFixBmpMask, iTypeRect.Size()); |
|
379 } |
|
380 |
|
381 // --------------------------------------------------------- |
|
382 // CSatelliteControl::PrepareSignalStrengthViewRectsAndIcons |
|
383 // --------------------------------------------------------- |
|
384 // |
|
385 void CSatelliteControl::PrepareSignalStrengthViewRectsAndIcons() |
|
386 { |
|
387 iSignalBarRects.Reset(); |
|
388 iSatelliteNumberLayouts.Reset(); |
|
389 TAknLayoutScalableParameterLimits paramLimits; |
|
390 paramLimits = AknLayoutScalable_Apps::cell_popup_blid_pane_ParamLimits(); |
|
391 |
|
392 TInt numberOfRows = paramLimits.LastRow() - paramLimits.FirstRow(); |
|
393 TInt numberOfColumns = paramLimits.LastColumn() - paramLimits.FirstColumn(); |
|
394 |
|
395 TAknLayoutRect layoutWindow; |
|
396 layoutWindow.LayoutRect(Rect(), AknLayoutScalable_Apps::grid_popup_blid_pane().LayoutLine()); |
|
397 TRect gridRect = layoutWindow.Rect(); |
|
398 |
|
399 iNumberOfRows = paramLimits.LastRow() - paramLimits.FirstRow() + 1; |
|
400 iNumberOfColumns = paramLimits.LastColumn() - paramLimits.FirstColumn() + 1; |
|
401 |
|
402 for(TInt row = paramLimits.FirstRow() ; row <= paramLimits.LastRow(); ++row) |
|
403 { |
|
404 for(TInt column = paramLimits.FirstColumn() ; column <= paramLimits.LastColumn(); ++column) |
|
405 { |
|
406 // First get and save the rects of the signal bars |
|
407 layoutWindow.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_popup_blid_pane(column, row).LayoutLine()); |
|
408 TRect cellRect = layoutWindow.Rect(); |
|
409 |
|
410 layoutWindow.LayoutRect(cellRect, AknLayoutScalable_Apps::cell_popup_blid_pane_g1().LayoutLine()); |
|
411 TRect barRect = layoutWindow.Rect(); |
|
412 iSignalBarRects.Append(barRect); |
|
413 |
|
414 // Save the layouts of the satellite numbers |
|
415 TAknLayoutText satNumberLayout; |
|
416 satNumberLayout.LayoutText(cellRect, AknLayoutScalable_Apps::cell_popup_blid_pane_t1().LayoutLine()); |
|
417 iSatelliteNumberLayouts.Append(satNumberLayout); |
|
418 } |
|
419 } |
|
420 PrepareSignalStrengthViewIcons(); |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------- |
|
424 // CSatelliteControl::PrepareGraphicalViewRectsAndIcons |
|
425 // --------------------------------------------------------- |
|
426 // |
|
427 void CSatelliteControl::PrepareGraphicalViewRectsAndIcons() |
|
428 { |
|
429 TAknLayoutRect layoutWindow; |
|
430 layoutWindow.LayoutRect(Rect(), |
|
431 AknLayoutScalable_Apps::blid_firmament_pane().LayoutLine()); |
|
432 |
|
433 // Rect to draw the firmament |
|
434 iFirmamentRect = layoutWindow.Rect(); |
|
435 |
|
436 layoutWindow.LayoutRect(iFirmamentRect, |
|
437 AknLayoutScalable_Apps::aid_firma_cardinal().LayoutLine()); |
|
438 |
|
439 //Layout to draw the cardinal point W |
|
440 iCardinalWLayout.LayoutText(iFirmamentRect, |
|
441 AknLayoutScalable_Apps::blid_firmament_pane_t1().LayoutLine()); |
|
442 |
|
443 //Layout to draw the cardinal point E |
|
444 iCardinalELayout.LayoutText(iFirmamentRect, |
|
445 AknLayoutScalable_Apps::blid_firmament_pane_t2().LayoutLine()); |
|
446 |
|
447 //Layout to draw the cardinal point N |
|
448 iCardinalNLayout.LayoutText(iFirmamentRect, |
|
449 AknLayoutScalable_Apps::blid_firmament_pane_t3().LayoutLine()); |
|
450 |
|
451 //Layout to draw the cardinal point S |
|
452 iCardinalSLayout.LayoutText(iFirmamentRect, |
|
453 AknLayoutScalable_Apps::blid_firmament_pane_t4().LayoutLine()); |
|
454 |
|
455 layoutWindow.LayoutRect(iFirmamentRect, |
|
456 AknLayoutScalable_Apps::blid_sat_info_pane().LayoutLine()); |
|
457 |
|
458 // Parent rect to get the rects of satellites, sun and moon |
|
459 TRect parentRect = layoutWindow.Rect(); |
|
460 |
|
461 layoutWindow.LayoutRect(parentRect, |
|
462 AknLayoutScalable_Apps::blid_sat_info_pane_g1().LayoutLine()); |
|
463 |
|
464 iSatelliteRect = layoutWindow.Rect(); |
|
465 |
|
466 layoutWindow.LayoutRect(parentRect, |
|
467 AknLayoutScalable_Apps::blid_sat_info_pane_g2().LayoutLine()); |
|
468 |
|
469 iSunMoonRect = layoutWindow.Rect(); |
|
470 PrepareGraphicalViewIcons(); |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------- |
|
474 // CSatelliteDialog::PrepareCompassViewRectsAndIcons |
|
475 // --------------------------------------------------------- |
|
476 // |
|
477 void CSatelliteControl::PrepareCompassViewRectsAndIcons() |
|
478 { |
|
479 |
|
480 TAknLayoutRect layoutWindow; |
|
481 TRect parenRect = Rect(); |
|
482 |
|
483 layoutWindow.LayoutRect(parenRect, |
|
484 AknLayoutScalable_Apps::blid_firmament_pane(1).LayoutLine()); |
|
485 |
|
486 // Rect to draw the firmament |
|
487 iFirmamentCompassRect = layoutWindow.Rect(); |
|
488 |
|
489 layoutWindow.LayoutRect(iFirmamentCompassRect, |
|
490 AknLayoutScalable_Apps::aid_firma_cardinal(1).LayoutLine()); |
|
491 |
|
492 //Layout to draw the cardinal point W |
|
493 iCardinalCompassWLayout.LayoutText(iFirmamentCompassRect, |
|
494 AknLayoutScalable_Apps::blid_firmament_pane_t1(1).LayoutLine()); |
|
495 |
|
496 //Layout to draw the cardinal point E |
|
497 iCardinalCompassELayout.LayoutText(iFirmamentCompassRect, |
|
498 AknLayoutScalable_Apps::blid_firmament_pane_t2(1).LayoutLine()); |
|
499 |
|
500 //Layout to draw the cardinal point N |
|
501 iCardinalCompassNLayout.LayoutText(iFirmamentCompassRect, |
|
502 AknLayoutScalable_Apps::blid_firmament_pane_t3(1).LayoutLine()); |
|
503 |
|
504 //Layout to draw the cardinal point S |
|
505 iCardinalCompassSLayout.LayoutText(iFirmamentCompassRect, |
|
506 AknLayoutScalable_Apps::blid_firmament_pane_t4(1).LayoutLine()); |
|
507 |
|
508 // Rect to draw the Type |
|
509 layoutWindow.LayoutRect(parenRect, |
|
510 AknLayoutScalable_Apps::popup_blid_sat_info2_window_g1(0).LayoutLine()); |
|
511 |
|
512 // Rect to draw the Fix Type graphic |
|
513 iTypeRect = layoutWindow.Rect(); |
|
514 |
|
515 // Rect to draw the Fix Type Text - 2D/3D |
|
516 iFixTypeLayout.LayoutText(parenRect, |
|
517 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t11(0).LayoutLine()); |
|
518 |
|
519 // Rect to draw the Latitude |
|
520 iLatitudeWindowLayout.LayoutText(parenRect, |
|
521 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t3(0).LayoutLine()); |
|
522 |
|
523 // Rect to draw the Longitude |
|
524 iLongitudeWindowLayout.LayoutText(parenRect, |
|
525 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t4(0).LayoutLine()); |
|
526 |
|
527 // Rect to draw the Heading. Altitude. |
|
528 iAltitudeWindowHeadingLayout.LayoutText(parenRect, |
|
529 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t5(0).LayoutLine()); |
|
530 |
|
531 // Rect to draw the Value. Altitude. |
|
532 iAltitudeWindowValueLayout.LayoutText(parenRect, |
|
533 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t6(0).LayoutLine()); |
|
534 |
|
535 // Rect to draw the Heading. Speed. |
|
536 iSpeedWindowHeadingLayout.LayoutText(parenRect, |
|
537 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t7(0).LayoutLine()); |
|
538 |
|
539 // Rect to draw the Value. Speed. |
|
540 iSpeedWindowValueLayout.LayoutText(parenRect, |
|
541 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t8(0).LayoutLine()); |
|
542 |
|
543 // Rect to draw the Heading. Direction. |
|
544 iDirectionWindowHeadingLayout.LayoutText(parenRect, |
|
545 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t9(0).LayoutLine()); |
|
546 |
|
547 // Rect to draw the Value. Direction. |
|
548 iDirectionWindowValueLayout.LayoutText(parenRect, |
|
549 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t10(0).LayoutLine()); |
|
550 |
|
551 PrepareCompassViewIcons(); |
|
552 } |
|
553 |
|
554 // --------------------------------------------------------- |
|
555 // CSatelliteControl::ConstructL |
|
556 // --------------------------------------------------------- |
|
557 // |
|
558 void CSatelliteControl::ConstructL( ) |
|
559 { |
|
560 iSatelliteSignalHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_HEADING_SIGNALS ); |
|
561 iSatelliteGrapgicHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_HEADING_GRAPHIC ); |
|
562 iCompassViewHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_HEADING_COMPASS ); |
|
563 |
|
564 iNoSatelliteData = iEikonEnv->AllocReadResourceL( R_BLID_NOTE_NO_SATELLITE_DATA ); |
|
565 |
|
566 // Altitude,Speed and Direction Strings for Compass View |
|
567 iAltitudeWindowHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_COMPASS_ALTITUDE ); |
|
568 iSpeedWindowHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_COMPASS_SPEED ); |
|
569 iDirectionWindowHeading = iEikonEnv->AllocReadResourceL( R_BLID_SAT_COMPASS_DIRECTION ); |
|
570 |
|
571 iSpeedFormatKmph = iEikonEnv->AllocReadResourceL( R_BLID_SAT_METRIC_SPEED ); |
|
572 iSpeedFormatMph = iEikonEnv->AllocReadResourceL( R_BLID_SAT_IMPERIAL_SPEED ); |
|
573 iAltitudeFormatM = iEikonEnv->AllocReadResourceL( R_BLID_SAT_METRIC_METER ); |
|
574 iAltitudeFormatFt = iEikonEnv->AllocReadResourceL( R_BLID_SAT_IMPERIAL_FOOT ); |
|
575 iDirectionFormat = iEikonEnv->AllocReadResourceL( R_BLID_SAT_DEGREE ); |
|
576 |
|
577 |
|
578 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
579 |
|
580 /* Icons for signal strength view */ |
|
581 // Code added foe multiple drive support. |
|
582 TBuf<KMaxFileName> iconFileName; |
|
583 iconFileName.Zero(); |
|
584 iconFileName.Append( PathInfo::RomRootPath()[0]); |
|
585 iconFileName.Append(KBlidSatSystemIconPath); |
|
586 |
|
587 // Satellite Active signal bar |
|
588 AknsUtils::CreateIconL( skin, |
|
589 KAknsIIDQgnPropBlidActive, |
|
590 iSatActiveBmp, |
|
591 iSatActiveBmpMask, |
|
592 iconFileName, |
|
593 EMbmSatelliteQgn_prop_blid_active, |
|
594 EMbmSatelliteQgn_prop_blid_active_mask ); |
|
595 |
|
596 // Satellite In-Active signal bar |
|
597 AknsUtils::CreateIconL( skin, |
|
598 KAknsIIDQgnPropBlidInactive, |
|
599 iSatInActiveBmp, |
|
600 iSatInActiveBmpMask, |
|
601 iconFileName, |
|
602 EMbmSatelliteQgn_prop_blid_inactive, |
|
603 EMbmSatelliteQgn_prop_blid_inactive_mask ); |
|
604 |
|
605 // Satellite Frame bar |
|
606 AknsUtils::CreateIconL( skin, |
|
607 KAknsIIDQgnPropBlidBg, |
|
608 iSatFrame, |
|
609 iSatFrameMask, |
|
610 iconFileName, |
|
611 EMbmSatelliteQgn_prop_blid_bg, |
|
612 EMbmSatelliteQgn_prop_blid_bg_mask ); |
|
613 |
|
614 /* Icons for firmament view */ |
|
615 |
|
616 // Icon for the firmament |
|
617 AknsUtils::CreateIconL( skin, |
|
618 KAknsIIDQgnIndiBlidSatFirmaCenter, |
|
619 iFirmamentBmp, |
|
620 iFirmamentBmpMask, |
|
621 iconFileName, |
|
622 EMbmSatelliteQgn_prop_blid_sat_firma, |
|
623 EMbmSatelliteQgn_prop_blid_sat_firma_mask ); |
|
624 |
|
625 // Icon for active satellite |
|
626 AknsUtils::CreateIconL( skin, |
|
627 KAknsIIDQgnIndiBlidSatFirmaActive, |
|
628 iFirmaActiveBmp, |
|
629 iFirmaActiveBmpMask, |
|
630 iconFileName, |
|
631 EMbmSatelliteQgn_prop_blid_sat_firma_active, |
|
632 EMbmSatelliteQgn_prop_blid_sat_firma_active_mask ); |
|
633 |
|
634 // Icon for In-Active satellite |
|
635 AknsUtils::CreateIconL( skin, |
|
636 KAknsIIDQgnIndiBlidSatFirmaInact, |
|
637 iFirmaInActiveBmp, |
|
638 iFirmaInActiveBmpMask, |
|
639 iconFileName, |
|
640 EMbmSatelliteQgn_prop_blid_sat_firma_inact, |
|
641 EMbmSatelliteQgn_prop_blid_sat_firma_inact_mask ); |
|
642 |
|
643 // Icon for the sun |
|
644 AknsUtils::CreateIconL( skin, |
|
645 KAknsIIDQgnIndiBlidSatFirmaSun, |
|
646 iSunBmp, |
|
647 iSunBmpMask, |
|
648 iconFileName, |
|
649 EMbmSatelliteQgn_prop_blid_sat_firma_sun, |
|
650 EMbmSatelliteQgn_prop_blid_sat_firma_sun_mask ); |
|
651 |
|
652 // Icon for the moon |
|
653 AknsUtils::CreateIconL( skin, |
|
654 KAknsIIDQgnIndiBlidSatFirmaMoon, |
|
655 iMoonBmp, |
|
656 iMoonBmpMask, |
|
657 iconFileName, |
|
658 EMbmSatelliteQgn_prop_blid_sat_firma_moon, |
|
659 EMbmSatelliteQgn_prop_blid_sat_firma_moon_mask ); |
|
660 |
|
661 /* Icons for Compass view */ |
|
662 |
|
663 // Icon for the firmament |
|
664 AknsUtils::CreateIconL( skin, |
|
665 KAknsIIDQgnGrafBlid, |
|
666 iFirmamentCompassBmp, |
|
667 iFirmamentCompassBmpMask, |
|
668 iconFileName, |
|
669 EMbmSatelliteQgn_graf_blid, |
|
670 EMbmSatelliteQgn_graf_blid_mask ); |
|
671 |
|
672 // Icon for the Type of Fix |
|
673 AknsUtils::CreateIconL( skin, |
|
674 KAknsIIDQgnGrafBlidRingfix, |
|
675 iFixBmp, |
|
676 iFixBmpMask, |
|
677 iconFileName, |
|
678 EMbmSatelliteQgn_graf_blid_ringfix, |
|
679 EMbmSatelliteQgn_graf_blid_ringfix_mask ); |
|
680 |
|
681 //Type of Fix to be display on the Fix Ring |
|
682 i2DString = StringLoader::LoadL( R_BLID_SAT_COMPASS_2D, iEikonEnv ); |
|
683 i3DString = StringLoader::LoadL( R_BLID_SAT_COMPASS_3D, iEikonEnv ); |
|
684 |
|
685 //Cardinal points text to be display on the Compass firmament |
|
686 iCompassNorth = StringLoader::LoadL( R_BLID_SAT_COMPASS_NORTH, iEikonEnv ); |
|
687 iCompassSouth = StringLoader::LoadL( R_BLID_SAT_COMPASS_SOUTH, iEikonEnv ); |
|
688 iCompassWest = StringLoader::LoadL( R_BLID_SAT_COMPASS_WEST, iEikonEnv ); |
|
689 iCompassEast = StringLoader::LoadL( R_BLID_SAT_COMPASS_EAST, iEikonEnv ); |
|
690 |
|
691 //Cardinal points text to be display on the Graphic firmament |
|
692 iNorth = StringLoader::LoadL( R_BLID_SAT_SYMBOL_NORTH, iEikonEnv ); |
|
693 iSouth = StringLoader::LoadL( R_BLID_SAT_SYMBOL_SOUTH, iEikonEnv ); |
|
694 iWest = StringLoader::LoadL( R_BLID_SAT_SYMBOL_WEST, iEikonEnv ); |
|
695 iEast = StringLoader::LoadL( R_BLID_SAT_SYMBOL_EAST, iEikonEnv ); |
|
696 } |
|
697 |
|
698 // --------------------------------------------------------- |
|
699 // CSatelliteControl::ConstructFromResourceL |
|
700 // --------------------------------------------------------- |
|
701 // |
|
702 void CSatelliteControl::ConstructFromResourceL(TResourceReader& /*aReader*/) |
|
703 { |
|
704 iEditorContext = CAknsFrameBackgroundControlContext::NewL( |
|
705 KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse ); |
|
706 ActivateL(); |
|
707 } |
|
708 |
|
709 // --------------------------------------------------------- |
|
710 // CSatelliteControl::SizeChanged |
|
711 // --------------------------------------------------------- |
|
712 // |
|
713 void CSatelliteControl::SizeChanged() |
|
714 { |
|
715 AknsUtils::RegisterControlPosition(this); |
|
716 TAknLayoutRect topLeft; |
|
717 TAknLayoutRect bottomRight; |
|
718 |
|
719 topLeft.LayoutRect(Rect(), SkinLayout::Input_field_skin_placing__general__Line_2()); |
|
720 bottomRight.LayoutRect(TRect(Rect().iBr, Rect().iBr), SkinLayout::Input_field_skin_placing__general__Line_5()); |
|
721 |
|
722 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
|
723 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
|
724 |
|
725 iEditorContext->SetFrameRects( outerRect, innerRect ); |
|
726 // Chain with the background (since the frame doesn't occupy the entire |
|
727 // layout and it may even be transparent) |
|
728 iEditorContext->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) ); |
|
729 PrepareSignalStrengthViewRectsAndIcons(); |
|
730 PrepareGraphicalViewRectsAndIcons(); |
|
731 PrepareCompassViewRectsAndIcons(); |
|
732 DrawNow(); |
|
733 } |
|
734 |
|
735 // --------------------------------------------------------- |
|
736 // CSatelliteControl::MopSupplyObject |
|
737 // --------------------------------------------------------- |
|
738 // |
|
739 TTypeUid::Ptr CSatelliteControl::MopSupplyObject( TTypeUid aId ) |
|
740 { |
|
741 CCoeControl::MopSupplyObject( aId ); |
|
742 return MAknsControlContext::SupplyMopObject( aId, iEditorContext ); |
|
743 } |
|
744 |
|
745 // --------------------------------------------------------- |
|
746 // CSatelliteControl::Draw |
|
747 // --------------------------------------------------------- |
|
748 // |
|
749 void CSatelliteControl::Draw(const TRect& /*aRect*/) const |
|
750 { |
|
751 CWindowGc& gc=SystemGc(); |
|
752 TRect rect(Rect()); |
|
753 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
754 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
755 AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage); |
|
756 |
|
757 //First draw the heading |
|
758 TRAP_IGNORE(DrawHeadingL()); |
|
759 |
|
760 if(!iEngine.IsSatelliteDataAvailable()) |
|
761 { |
|
762 //Draw the empty string "No satellite data" string in the dialog |
|
763 TRAP_IGNORE(DrawEmptyDialogL()); |
|
764 return; |
|
765 } |
|
766 |
|
767 switch ( iCurrentSatelliteView ) |
|
768 { |
|
769 case ESignalStrengthView: |
|
770 { |
|
771 //Draw the signal strength view |
|
772 TRAP_IGNORE(DrawSignalStrengthViewL()); |
|
773 break; |
|
774 } |
|
775 case EGraphicalView: |
|
776 { |
|
777 //Draw the graphical view |
|
778 TRAP_IGNORE(DrawGraphicalViewL()); |
|
779 break; |
|
780 } |
|
781 case ECompassView: |
|
782 { |
|
783 //Draw the compass view |
|
784 TRAP_IGNORE(DrawCompassViewL()); |
|
785 break; |
|
786 } |
|
787 default: |
|
788 { |
|
789 break; |
|
790 } |
|
791 } |
|
792 } |
|
793 |
|
794 // --------------------------------------------------------- |
|
795 // CSatelliteControl::DrawHeadingL |
|
796 // --------------------------------------------------------- |
|
797 // |
|
798 void CSatelliteControl::DrawHeadingL() const |
|
799 { |
|
800 //Get the rect for the heading frame from LAF |
|
801 TAknLayoutRect layoutWindow; |
|
802 layoutWindow.LayoutRect(Rect(), AknLayoutScalable_Apps::heading_pane_cp05(2).LayoutLine()); |
|
803 TRect headingFrameRect = layoutWindow.Rect(); |
|
804 |
|
805 //Get the rect for the heading text. Parent of the heading text rect |
|
806 //is the rect of the heading frame |
|
807 TAknLayoutText headingTextLayout; |
|
808 headingTextLayout.LayoutText(headingFrameRect, AknLayoutScalable_Avkon::heading_pane_t1(0).LayoutLine()); |
|
809 |
|
810 CWindowGc& gc=SystemGc(); |
|
811 |
|
812 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
813 |
|
814 TRgb rgb; |
|
815 AknsUtils::GetCachedColor( skin, |
|
816 rgb, |
|
817 KAknsIIDQsnTextColors, |
|
818 EAknsCIQsnTextColorsCG1 ); |
|
819 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
820 gc.SetPenColor( rgb ); |
|
821 |
|
822 //Skin the heading frame |
|
823 AknsDrawUtils::DrawFrame(skin, |
|
824 gc, |
|
825 headingFrameRect, |
|
826 headingTextLayout.TextRect(), |
|
827 KAknsIIDQsnFrPopupHeading, |
|
828 KAknsIIDQsnFrPopupHeadingCenter); |
|
829 |
|
830 switch ( iCurrentSatelliteView ) |
|
831 { |
|
832 case ESignalStrengthView: |
|
833 { |
|
834 headingTextLayout.DrawText( gc, |
|
835 iSatelliteSignalHeading->Des(), |
|
836 ETrue, |
|
837 rgb ); |
|
838 break; |
|
839 } |
|
840 case EGraphicalView: |
|
841 { |
|
842 headingTextLayout.DrawText( gc, |
|
843 iSatelliteGrapgicHeading->Des(), |
|
844 ETrue, |
|
845 rgb ); |
|
846 break; |
|
847 } |
|
848 case ECompassView: |
|
849 { |
|
850 headingTextLayout.DrawText( gc, |
|
851 iCompassViewHeading->Des(), |
|
852 ETrue, |
|
853 rgb ); |
|
854 break; |
|
855 } |
|
856 default: |
|
857 { |
|
858 break; |
|
859 } |
|
860 } |
|
861 } |
|
862 |
|
863 // --------------------------------------------------------- |
|
864 // CSatelliteControl::DrawEmptyDialogL |
|
865 // --------------------------------------------------------- |
|
866 // |
|
867 void CSatelliteControl::DrawEmptyDialogL() const |
|
868 { |
|
869 TAknLayoutText textRect1; |
|
870 |
|
871 textRect1.LayoutText(Rect(), |
|
872 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t1()); |
|
873 |
|
874 |
|
875 TAknLayoutText textRect2; |
|
876 |
|
877 textRect2.LayoutText(Rect(), |
|
878 AknLayoutScalable_Apps::popup_blid_sat_info2_window_t2()); |
|
879 |
|
880 |
|
881 CArrayFix<TInt>* wrapWidthArray = |
|
882 new( ELeave ) CArrayFixFlat<TInt>(10); |
|
883 |
|
884 CleanupStack::PushL( wrapWidthArray ); |
|
885 |
|
886 TInt lineLength1 = textRect1.TextRect().Width(); |
|
887 TInt lineLength2 = textRect2.TextRect().Width(); |
|
888 |
|
889 wrapWidthArray->AppendL(lineLength1); |
|
890 wrapWidthArray->AppendL(lineLength2); |
|
891 |
|
892 TPtrC text = *iNoSatelliteData; |
|
893 TBuf<200> buffer; |
|
894 |
|
895 const CFont *font = textRect1.Font(); |
|
896 AknBidiTextUtils::ConvertToVisualAndWrapToStringL(text, |
|
897 *wrapWidthArray, |
|
898 *font, |
|
899 buffer, |
|
900 ETrue ); |
|
901 |
|
902 CleanupStack::PopAndDestroy(); // wrapWidthArray |
|
903 |
|
904 TPtrC line1= buffer; |
|
905 TPtrC line2= buffer; |
|
906 TInt off = line1.Locate('\n'); |
|
907 if (off>=0) |
|
908 { |
|
909 line1.Set(line2.Left(off)); |
|
910 line2.Set(line2.Mid(off+1)); |
|
911 } |
|
912 else |
|
913 { |
|
914 line2.Set(_L("")); |
|
915 } |
|
916 |
|
917 TInt off2 = line2.Locate('\n'); |
|
918 if (off2>=0) |
|
919 { |
|
920 line2.Set(line2.Left(off2)); |
|
921 } |
|
922 |
|
923 CWindowGc& gc=SystemGc(); |
|
924 gc.UseFont(font); |
|
925 |
|
926 const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( font ); |
|
927 TInt textPaneHeight; |
|
928 TInt textPaneAscent; |
|
929 if ( layoutFont ) |
|
930 { |
|
931 textPaneHeight = layoutFont->TextPaneHeight(); |
|
932 textPaneAscent = layoutFont->TextPaneTopToBaseline(); |
|
933 } |
|
934 else |
|
935 { |
|
936 textPaneHeight = font->HeightInPixels(); |
|
937 textPaneAscent = font->AscentInPixels(); |
|
938 } |
|
939 //draw text |
|
940 TInt extraVerticalSpace=(textRect1.TextRect().Height()-textPaneHeight); |
|
941 TInt baseLineOffset=extraVerticalSpace/2+textPaneAscent; |
|
942 gc.DrawText( line1, |
|
943 textRect1.TextRect(), |
|
944 baseLineOffset, |
|
945 CGraphicsContext::ECenter ); |
|
946 |
|
947 if(line2.Length()) |
|
948 { |
|
949 gc.DrawText( line2, |
|
950 textRect2.TextRect(), |
|
951 baseLineOffset, |
|
952 CGraphicsContext::ECenter ); |
|
953 } |
|
954 } |
|
955 |
|
956 // --------------------------------------------------------- |
|
957 // CSatelliteControl::DrawGraphicalViewL |
|
958 // --------------------------------------------------------- |
|
959 // |
|
960 void CSatelliteControl::DrawGraphicalViewL() const |
|
961 { |
|
962 CWindowGc& gc=SystemGc(); |
|
963 TSatelliteData satelliteData; |
|
964 for(TInt i = 0 ; i < iEngine.NumberOfSatellites(); ++i) |
|
965 { |
|
966 iEngine.GetSatelliteData(i, satelliteData); |
|
967 TInt signalstrength = satelliteData.SignalStrength(); |
|
968 } |
|
969 |
|
970 // Drawing the firmament |
|
971 gc.BitBltMasked(iFirmamentRect.iTl, |
|
972 iFirmamentBmp, |
|
973 iFirmamentBmp->SizeInPixels(), |
|
974 iFirmamentBmpMask, |
|
975 ETrue); |
|
976 |
|
977 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
978 TRgb rgb; |
|
979 AknsUtils::GetCachedColor( skin, |
|
980 rgb, |
|
981 KAknsIIDQsnTextColors, |
|
982 EAknsCIQsnTextColorsCG1 ); |
|
983 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
984 gc.SetPenColor( rgb ); |
|
985 // Draw the cardinal points |
|
986 iCardinalNLayout.DrawText(gc, iNorth->Des(), ETrue, rgb ); |
|
987 iCardinalSLayout.DrawText(gc, iSouth->Des(), ETrue, rgb ); |
|
988 iCardinalWLayout.DrawText(gc, iWest->Des(), ETrue, rgb ); |
|
989 iCardinalELayout.DrawText(gc, iEast->Des(), ETrue, rgb ); |
|
990 |
|
991 //Draw the moon |
|
992 TReal moonAzmiuth, moonElevation; |
|
993 iEngine.GetMoonAzimuthElevation(moonAzmiuth, moonElevation); |
|
994 TRect moonRect = CalculateCelestialBodyRectL(moonAzmiuth, moonElevation, iSunMoonRect.Size()); |
|
995 gc.BitBltMasked(moonRect.iTl, |
|
996 iMoonBmp, |
|
997 iMoonBmp->SizeInPixels(), |
|
998 iMoonBmpMask, |
|
999 ETrue); |
|
1000 |
|
1001 // Draw the sun |
|
1002 TReal sunAzmiuth, sunElevation; |
|
1003 iEngine.GetSunAzimuthElevation(sunAzmiuth, sunElevation); |
|
1004 TRect sunRect = CalculateCelestialBodyRectL(sunAzmiuth, sunElevation, iSunMoonRect.Size()); |
|
1005 |
|
1006 gc.BitBltMasked(sunRect.iTl, |
|
1007 iSunBmp, |
|
1008 iSunBmp->SizeInPixels(), |
|
1009 iSunBmpMask, |
|
1010 ETrue); |
|
1011 |
|
1012 //Draw all the available satellites |
|
1013 for(TInt i = 0;i<iEngine.NumberOfSatellites();++i) |
|
1014 { |
|
1015 TSatelliteData satData; |
|
1016 |
|
1017 if(iEngine.GetSatelliteData(i, satData) != KErrNotFound) |
|
1018 { |
|
1019 TRect rect; |
|
1020 TInt satId = satData.SatelliteId(); |
|
1021 rect = CalculateCelestialBodyRectL(satData.Azimuth(), satData.Elevation(), iSatelliteRect.Size()); |
|
1022 if(satData.IsUsed()) |
|
1023 { |
|
1024 gc.BitBltMasked(rect.iTl, |
|
1025 iFirmaActiveBmp, |
|
1026 iFirmaActiveBmp->SizeInPixels(), |
|
1027 iFirmaActiveBmpMask, |
|
1028 ETrue); |
|
1029 } |
|
1030 else |
|
1031 { |
|
1032 gc.BitBltMasked(rect.iTl, |
|
1033 iFirmaInActiveBmp, |
|
1034 iFirmaInActiveBmp->SizeInPixels(), |
|
1035 iFirmaInActiveBmpMask, |
|
1036 ETrue); |
|
1037 } |
|
1038 TAknLayoutText textLayout; |
|
1039 textLayout.LayoutText(rect, |
|
1040 AknLayoutScalable_Apps::blid_sat_info_pane_t1().LayoutLine()); |
|
1041 |
|
1042 HBufC* satNumber = StringLoader::LoadL( R_BLID_SATELLITE_ID, satData.SatelliteId() ); |
|
1043 HBufC* visualBuffer = HBufC::NewL( satNumber->Size() + KAknBidiExtraSpacePerLine ); |
|
1044 TPtr visualPtr( visualBuffer->Des() ); |
|
1045 visualPtr.Zero(); |
|
1046 TPtr ptr(satNumber->Des()); |
|
1047 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1048 //This portion of code is commented now.We have to check it for language |
|
1049 //Like Farsi,Urdu and then it will be removed or uncomented. |
|
1050 /*AknBidiTextUtils::ConvertToVisualAndClip( satNumber->Des(), |
|
1051 visualPtr, |
|
1052 *textLayout.Font(), |
|
1053 textLayout.TextRect().Size().iWidth, |
|
1054 textLayout.TextRect().Size().iWidth ); |
|
1055 textLayout.DrawText(gc, visualPtr);*/ |
|
1056 |
|
1057 const CFont* fontUsed = iCardinalNLayout.Font(); |
|
1058 const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( fontUsed ); |
|
1059 TInt textPaneHeight; |
|
1060 TInt textPaneAscent; |
|
1061 if ( layoutFont ) |
|
1062 { |
|
1063 textPaneHeight = layoutFont->TextPaneHeight(); |
|
1064 textPaneAscent = layoutFont->TextPaneTopToBaseline(); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 textPaneHeight = fontUsed->HeightInPixels(); |
|
1069 textPaneAscent = fontUsed->AscentInPixels(); |
|
1070 } |
|
1071 //draw text |
|
1072 TInt extraVerticalSpace=(rect.Height()-textPaneHeight); |
|
1073 TInt baseLineOffset=extraVerticalSpace/2+textPaneAscent; |
|
1074 CGraphicsContext::TTextAlign context; |
|
1075 context = textLayout.Align(); |
|
1076 gc.UseFont(fontUsed); |
|
1077 //gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1078 |
|
1079 // Set the rgb color to black |
|
1080 rgb.SetBlue(0); |
|
1081 rgb.SetGreen(0); |
|
1082 rgb.SetRed(0); |
|
1083 gc.SetPenColor(rgb); |
|
1084 |
|
1085 gc.DrawText( satNumber->Des(), |
|
1086 rect, |
|
1087 baseLineOffset, |
|
1088 context ); |
|
1089 |
|
1090 delete satNumber; |
|
1091 delete visualBuffer; |
|
1092 } |
|
1093 } |
|
1094 } |
|
1095 |
|
1096 // --------------------------------------------------------- |
|
1097 // CSatelliteControl::CalculateCelestialBodyRectL |
|
1098 // --------------------------------------------------------- |
|
1099 // |
|
1100 TRect CSatelliteControl::CalculateCelestialBodyRectL(const TReal aAzimuth, |
|
1101 const TReal aElevation, |
|
1102 const TSize aIconSize) const |
|
1103 { |
|
1104 TPoint point; |
|
1105 TReal cosElevation; |
|
1106 TReal sinAzimuth; |
|
1107 TReal cosAzimuth; |
|
1108 TInt pointX(0); |
|
1109 TInt pointY(0); |
|
1110 TPoint center = iFirmamentRect.Center(); |
|
1111 |
|
1112 User::LeaveIfError( |
|
1113 Math::Cos( cosElevation, KDegToRad * (aElevation) )); |
|
1114 |
|
1115 User::LeaveIfError( |
|
1116 Math::Sin( sinAzimuth, KDegToRad * (aAzimuth))); |
|
1117 |
|
1118 User::LeaveIfError( |
|
1119 Math::Cos( cosAzimuth, KDegToRad * (aAzimuth))); |
|
1120 |
|
1121 User::LeaveIfError( |
|
1122 TRealToTInt((iFirmamentRect.Height()/2) * cosElevation * sinAzimuth, pointX)); |
|
1123 |
|
1124 User::LeaveIfError( |
|
1125 TRealToTInt((iFirmamentRect.Height()/2) * cosElevation * cosAzimuth, pointY) ); |
|
1126 |
|
1127 point = TPoint( (center.iX + pointX ) , (center.iY - pointY )); |
|
1128 |
|
1129 TPoint boxCenterPoint; |
|
1130 TInt half; |
|
1131 |
|
1132 TRealToTInt(aIconSize.iWidth/2, half); |
|
1133 boxCenterPoint.iX = point.iX - half; |
|
1134 TRealToTInt(aIconSize.iHeight/2, half); |
|
1135 boxCenterPoint.iY = point.iY - half; |
|
1136 TRect returnRect(boxCenterPoint, aIconSize); |
|
1137 |
|
1138 return returnRect; |
|
1139 } |
|
1140 |
|
1141 // --------------------------------------------------------- |
|
1142 // CSatelliteControl::TRealToTInt |
|
1143 // Rounds the supplied real number into the nearest integer |
|
1144 // --------------------------------------------------------- |
|
1145 // |
|
1146 TInt CSatelliteControl::TRealToTInt( const TReal aSrc, TInt& aResult ) const |
|
1147 { |
|
1148 TReal resultTReal(0); |
|
1149 TInt error(0); |
|
1150 |
|
1151 error = Math::Round( resultTReal, aSrc, 0 ); |
|
1152 if ( error != KErrNone ) |
|
1153 { |
|
1154 aResult = 0; |
|
1155 return error; |
|
1156 } |
|
1157 |
|
1158 TInt32 resultTInt(0); |
|
1159 error = Math::Int( resultTInt, resultTReal ); |
|
1160 if ( error != KErrNone ) |
|
1161 { |
|
1162 aResult = 0; |
|
1163 return error; |
|
1164 } |
|
1165 aResult = resultTInt; |
|
1166 return error; |
|
1167 } |
|
1168 |
|
1169 // --------------------------------------------------------- |
|
1170 // CSatelliteControl::DrawSignalStrengthViewL |
|
1171 // --------------------------------------------------------- |
|
1172 // |
|
1173 void CSatelliteControl::DrawSignalStrengthViewL() const |
|
1174 { |
|
1175 CWindowGc& gc=SystemGc(); |
|
1176 TInt numberofsatellites = iEngine.NumberOfSatellites(); |
|
1177 |
|
1178 for(TInt i = 0 ; i < numberofsatellites; ++i) |
|
1179 { |
|
1180 TSatelliteData satData; |
|
1181 |
|
1182 if(iEngine.GetSatelliteData(i, satData) != KErrNotFound) |
|
1183 { |
|
1184 TInt satelliteId = satData.SatelliteId(); |
|
1185 TInt signalStrength = satData.SignalStrength(); |
|
1186 if( (satelliteId > KMaxSatellites) || (signalStrength == 0) ) |
|
1187 { |
|
1188 continue; |
|
1189 } |
|
1190 TRect rect = iSignalBarRects[satelliteId-1]; |
|
1191 CFbsBitmap* bitmap; |
|
1192 CFbsBitmap* bitmapMask; |
|
1193 TInt barHeight = rect.Height() * signalStrength / KBlidMaxSatelliteSignalStrength; |
|
1194 if(barHeight < rect.Height()) |
|
1195 { |
|
1196 TInt tmp = rect.Height() - barHeight; |
|
1197 rect.iTl.iY += tmp; |
|
1198 } |
|
1199 |
|
1200 if(satData.IsUsed()) |
|
1201 { |
|
1202 bitmap = iSatActiveBmp; |
|
1203 bitmapMask = iSatActiveBmpMask; |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 bitmap = iSatInActiveBmp; |
|
1208 bitmapMask = iSatInActiveBmpMask; |
|
1209 } |
|
1210 |
|
1211 AknIconUtils::SetSize(bitmap, |
|
1212 rect.Size()); |
|
1213 |
|
1214 AknIconUtils::SetSize(bitmap, |
|
1215 rect.Size()); |
|
1216 |
|
1217 |
|
1218 gc.BitBltMasked(rect.iTl, |
|
1219 bitmap, |
|
1220 bitmap->SizeInPixels(), |
|
1221 bitmapMask, |
|
1222 ETrue); |
|
1223 |
|
1224 rect = iSignalBarRects[satelliteId-1]; |
|
1225 gc.BitBltMasked(rect.iTl, |
|
1226 iSatFrame, |
|
1227 iSatFrame->SizeInPixels(), |
|
1228 iSatFrameMask, |
|
1229 ETrue); |
|
1230 } |
|
1231 } |
|
1232 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1233 TRgb rgb; |
|
1234 AknsUtils::GetCachedColor( skin, |
|
1235 rgb, |
|
1236 KAknsIIDQsnTextColors, |
|
1237 EAknsCIQsnTextColorsCG1 ); |
|
1238 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
1239 gc.SetPenColor( rgb ); |
|
1240 |
|
1241 for(TInt i = 1; i <= KMaxSatellites; ++i) |
|
1242 { |
|
1243 TSatelliteData satelliteData; |
|
1244 iEngine.GetSatelliteData(i, satelliteData); |
|
1245 |
|
1246 HBufC* satNumber = StringLoader::LoadL( R_BLID_SATELLITE_ID, |
|
1247 i ); |
|
1248 |
|
1249 |
|
1250 HBufC* visualBuffer = HBufC::NewL( satNumber->Size() + |
|
1251 KAknBidiExtraSpacePerLine ); |
|
1252 TPtr visualPtr( visualBuffer->Des() ); |
|
1253 visualPtr.Zero(); |
|
1254 AknBidiTextUtils::ConvertToVisualAndClip( satNumber->Des(), |
|
1255 visualPtr, |
|
1256 *iSatelliteNumberLayouts[i-1].Font(), |
|
1257 iSatelliteNumberLayouts[i-1].TextRect().Size().iWidth, |
|
1258 iSatelliteNumberLayouts[i-1].TextRect().Size().iWidth ); |
|
1259 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
1260 iSatelliteNumberLayouts[i-1].DrawText(gc, visualPtr, ETrue, rgb ); |
|
1261 delete visualBuffer; |
|
1262 delete satNumber; |
|
1263 } |
|
1264 } |
|
1265 |
|
1266 // --------------------------------------------------------- |
|
1267 // CSatelliteDialog::DrawCompassViewL |
|
1268 // --------------------------------------------------------- |
|
1269 // |
|
1270 void CSatelliteControl::DrawCompassViewL() const |
|
1271 { |
|
1272 CWindowGc& gc=SystemGc(); |
|
1273 |
|
1274 // Drawing the firmament |
|
1275 gc.BitBltMasked( iFirmamentCompassRect.iTl, |
|
1276 iFirmamentCompassBmp, |
|
1277 iFirmamentCompassBmp->SizeInPixels(), |
|
1278 iFirmamentCompassBmpMask, |
|
1279 ETrue ); |
|
1280 |
|
1281 // Drawing the Fix Ring |
|
1282 gc.BitBltMasked( iTypeRect.iTl, |
|
1283 iFixBmp, |
|
1284 iFixBmp->SizeInPixels(), |
|
1285 iFixBmpMask, |
|
1286 ETrue ); |
|
1287 |
|
1288 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1289 TRgb rgb; |
|
1290 AknsUtils::GetCachedColor( skin, |
|
1291 rgb, |
|
1292 KAknsIIDQsnTextColors, |
|
1293 EAknsCIQsnTextColorsCG1 ); |
|
1294 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
1295 gc.SetPenColor( rgb ); |
|
1296 // Draw the cardinal points |
|
1297 iCardinalCompassNLayout.DrawText( gc, iCompassNorth->Des(), ETrue, rgb ); |
|
1298 iCardinalCompassSLayout.DrawText( gc, iCompassSouth->Des(), ETrue, rgb ); |
|
1299 iCardinalCompassWLayout.DrawText( gc, iCompassWest->Des(), ETrue, rgb ); |
|
1300 iCardinalCompassELayout.DrawText( gc, iCompassEast->Des(), ETrue, rgb ); |
|
1301 |
|
1302 // Drawing the Fix Type |
|
1303 if( iEngine.NumberOfSatellitesUsed() <= K2dFix ) |
|
1304 { |
|
1305 iFixTypeLayout.DrawText( gc, i2DString->Des(), ETrue, rgb ); |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 iFixTypeLayout.DrawText( gc, i3DString->Des(), ETrue, rgb ); |
|
1310 } |
|
1311 |
|
1312 TPosition pos; |
|
1313 TCourse course; |
|
1314 iEngine.GetPosition( pos ); |
|
1315 iEngine.GetCourse( course ); |
|
1316 TBuf<KSatInfoBufferSize> tempString; |
|
1317 TBuf<KSatInfoBufferSize> speedString; |
|
1318 HBufC* formatter = NULL; |
|
1319 |
|
1320 // Display Latitude |
|
1321 if ( !Math::IsNaN( pos.Latitude() ) ) |
|
1322 { |
|
1323 TRAP_IGNORE( formatter = |
|
1324 CAknLocationEditor::DisplayableLocationL( pos,CAknLocationEditor::ELatitudeOnly ) ); |
|
1325 if( formatter ) |
|
1326 { |
|
1327 tempString.Copy( formatter->Des() ); |
|
1328 delete formatter; |
|
1329 } |
|
1330 iLatitudeWindowLayout.DrawText( gc, tempString, ETrue, rgb ); |
|
1331 } |
|
1332 |
|
1333 // Display Longitude |
|
1334 if ( !Math::IsNaN( pos.Longitude() ) ) |
|
1335 { |
|
1336 TRAP_IGNORE( formatter = |
|
1337 CAknLocationEditor::DisplayableLocationL( pos,CAknLocationEditor::ELongitudeOnly ) ); |
|
1338 if( formatter ) |
|
1339 { |
|
1340 tempString.Copy( formatter->Des() ); |
|
1341 delete formatter; |
|
1342 } |
|
1343 iLongitudeWindowLayout.DrawText( gc, tempString, ETrue, rgb ); |
|
1344 } |
|
1345 |
|
1346 // Display Altitude |
|
1347 TReal altitude = pos.Altitude(); |
|
1348 iAltitudeWindowHeadingLayout.DrawText( gc, iAltitudeWindowHeading->Des(), ETrue, rgb ); |
|
1349 TInt result(0); |
|
1350 if ( !Math::IsNaN( altitude ) && TRealToTInt( altitude , result ) == KErrNone ) |
|
1351 { |
|
1352 if ( iEngine.SysOfMeasurementL() == ELocMetric ) |
|
1353 { |
|
1354 StringLoader::Format( tempString, *iAltitudeFormatM, |
|
1355 0, result ); |
|
1356 } |
|
1357 else |
|
1358 { |
|
1359 TInt imperialAlt( 0 ); |
|
1360 if ( TRealToTInt( ( altitude*KMetreToFoot ) , imperialAlt ) == KErrNone ) |
|
1361 { |
|
1362 StringLoader::Format( tempString, *iAltitudeFormatFt, |
|
1363 0, imperialAlt ); |
|
1364 } |
|
1365 } |
|
1366 iAltitudeWindowValueLayout.DrawText( gc, tempString, ETrue, rgb ); |
|
1367 } |
|
1368 |
|
1369 // Display Speed |
|
1370 TReal speed = course.Speed(); |
|
1371 iSpeedWindowHeadingLayout.DrawText( gc, iSpeedWindowHeading->Des(), ETrue, rgb ); |
|
1372 if ( !Math::IsNaN( speed ) ) |
|
1373 { |
|
1374 Math::Round( speed, speed, KDecimals3 ); |
|
1375 TReal speedInKmph = speed * KSpeedConvertion; |
|
1376 |
|
1377 if ( iEngine.SysOfMeasurementL() == ELocMetric ) |
|
1378 { |
|
1379 speedString.Format( KSpeedFormat, speedInKmph ); |
|
1380 formatter = iSpeedFormatKmph; |
|
1381 } |
|
1382 else |
|
1383 { |
|
1384 speedInKmph *= KKilometreToMiles; |
|
1385 speedString.Format( KSpeedFormat, speedInKmph ); |
|
1386 formatter = iSpeedFormatMph; |
|
1387 } |
|
1388 StringLoader::Format( tempString, *formatter, 0, speedString ); |
|
1389 iSpeedWindowValueLayout.DrawText( gc, tempString, ETrue, rgb ); |
|
1390 } |
|
1391 |
|
1392 // Display Direction |
|
1393 TReal heading = course.Heading(); |
|
1394 iDirectionWindowHeadingLayout.DrawText( gc, iDirectionWindowHeading->Des(), ETrue, rgb ); |
|
1395 if ( !Math::IsNaN( heading ) ) |
|
1396 { |
|
1397 StringLoader::Format( tempString, *iDirectionFormat, 0, heading ); |
|
1398 iDirectionWindowValueLayout.DrawText( gc, tempString, ETrue, rgb ); |
|
1399 } |
|
1400 |
|
1401 } |
|
1402 |
|
1403 // --------------------------------------------------------- |
|
1404 // CSatelliteControl::InputCapabilities |
|
1405 // --------------------------------------------------------- |
|
1406 // |
|
1407 TCoeInputCapabilities CSatelliteControl::InputCapabilities() const |
|
1408 { |
|
1409 TCoeInputCapabilities inputCapabilities(TCoeInputCapabilities::ENone); |
|
1410 return inputCapabilities; |
|
1411 } |
|
1412 |
|
1413 #ifdef RD_SCALABLE_UI_V2 |
|
1414 // --------------------------------------------------------- |
|
1415 // CSatelliteDialog::HandlePointerEventL |
|
1416 // --------------------------------------------------------- |
|
1417 // |
|
1418 void CSatelliteControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
1419 { |
|
1420 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
1421 if ( AknLayoutUtils::PenEnabled() ) |
|
1422 { |
|
1423 // Display the context specific menu on double tapping on the fields. |
|
1424 if(aPointerEvent.iType == TPointerEvent::EButton1Down && |
|
1425 iEngine.IsSatelliteDataAvailable() ) |
|
1426 { |
|
1427 #ifdef RD_TACTILE_FEEDBACK |
|
1428 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
1429 if (feedback) |
|
1430 { |
|
1431 feedback->InstantFeedback(ETouchFeedbackBasic); |
|
1432 } |
|
1433 #endif //RD_TACTILE_FEEDBACK |
|
1434 // Change view soft key pressed.Notify the control to change |
|
1435 // the view and draw. |
|
1436 ChangeViewL(); |
|
1437 DrawNow(); |
|
1438 } |
|
1439 } |
|
1440 } |
|
1441 #endif // RD_SCALABLE_UI_V2 |
|
1442 // End of file |
|
1443 |
|
1444 |
|