15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <aknappui.h> |
20 //#include <aknappui.h> |
21 #include <AknIconUtils.h> |
21 //#include <AknIconUtils.h> |
22 #include <AknUtils.h> |
22 //#include <AknUtils.h> |
|
23 #include <eikenv.h> |
23 #include <coemain.h> |
24 #include <coemain.h> |
24 #include <barsread.h> //use of TResourceReader |
25 #include <barsread.h> //use of TResourceReader |
25 #include <sysap.mbg> |
26 //#include <sysap.mbg> |
26 #include "SysApShutdownImage.h" |
27 #include "SysApShutdownImage.h" |
27 #include "SysAp.hrh" |
28 #include "SysAp.hrh" |
28 #include <data_caging_path_literals.hrh> |
29 #include <data_caging_path_literals.hrh> |
|
30 #include <HbDeviceMessageBoxSymbian.h> |
|
31 #include <SVGEngineInterfaceImpl.h> |
|
32 |
|
33 //_LIT(KDC_APP_BITMAP_DIR,"\\resource\\apps\\"); |
29 |
34 |
30 // ============================ MEMBER FUNCTIONS ============================== |
35 // ============================ MEMBER FUNCTIONS ============================== |
31 |
36 |
32 // ---------------------------------------------------------------------------- |
37 // ---------------------------------------------------------------------------- |
33 // CSysApShutdownImage::NewL() |
38 // CSysApShutdownImage::NewL() |
67 // ---------------------------------------------------------------------------- |
72 // ---------------------------------------------------------------------------- |
68 |
73 |
69 void CSysApShutdownImage::ShowShutdownImageL(TInt aBitmapId) |
74 void CSysApShutdownImage::ShowShutdownImageL(TInt aBitmapId) |
70 { |
75 { |
71 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:start" ) ) ); |
76 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:start" ) ) ); |
|
77 |
72 TInt err ( 0 ); |
78 TInt err ( 0 ); |
73 |
79 TRect rect(iCoeEnv->ScreenDevice()->SizeInPixels()); |
74 SetRect(iAvkonAppUi->ApplicationRect()); |
80 SetRect(rect); |
|
81 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SetRect --Minus one" ) ) ); |
75 ActivateL(); |
82 ActivateL(); |
76 |
83 |
|
84 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ActivateL --Zero" ) ) ); |
|
85 |
77 if ( aBitmapId ) |
86 if ( aBitmapId ) |
78 { |
87 { |
79 _LIT( KDirAndFile, "z:sysap.mif" ); |
88 _LIT( KDirAndFile, "z:qgn_sysap_screen.svg" ); |
80 TParse* fp = new (ELeave) TParse(); |
89 TParse* fp = new (ELeave) TParse(); |
81 CleanupStack::PushL(fp); |
90 CleanupStack::PushL(fp); |
82 fp->Set( KDirAndFile, &KDC_APP_BITMAP_DIR, NULL ); |
91 fp->Set( KDirAndFile, &KDC_APP_BITMAP_DIR, NULL ); |
83 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL shutdown image: %S" ), &(fp->FullName())) ); |
92 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL shutdown image: %S" ), &(fp->FullName())) ); |
84 RFs fs; |
93 RFs fs; |
97 else |
106 else |
98 { |
107 { |
99 delete iBitmap; |
108 delete iBitmap; |
100 iBitmap = NULL; |
109 iBitmap = NULL; |
101 // Ownership of bitmap is transferred to CSysApShutdownImage in CreateIconL |
110 // Ownership of bitmap is transferred to CSysApShutdownImage in CreateIconL |
102 iBitmap = AknIconUtils::CreateIconL( fp->FullName(), aBitmapId ); |
111 iBitmap = ReadSVGL(fp->FullName()); |
103 TAknLayoutRect bitmapRect; |
112 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ReadSVGL --First" ) ) ); |
104 bitmapRect.LayoutRect( Rect(), AKN_LAYOUT_WINDOW_screen ); |
|
105 AknIconUtils::SetSize( iBitmap, bitmapRect.Rect().Size(), EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
106 TInt xDelta=0; // for x coordinates |
113 TInt xDelta=0; // for x coordinates |
107 TInt yDelta=0; // for y coordinates |
114 TInt yDelta=0; // for y coordinates |
108 TSize bmpSizeInPixels = iBitmap->SizeInPixels(); |
115 TSize bmpSizeInPixels = iBitmap->SizeInPixels(); |
|
116 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SizeInPixels --Second" ) ) ); |
109 //center image to the center of the screen |
117 //center image to the center of the screen |
110 TRect rect = Rect(); |
118 TRect rect = Rect(); |
111 xDelta=( rect.Width() - bmpSizeInPixels.iWidth ) / 2; |
119 xDelta=( rect.Width() - bmpSizeInPixels.iWidth ) / 2; |
112 yDelta=( rect.Height() - bmpSizeInPixels.iHeight ) / 2; |
120 yDelta=( rect.Height() - bmpSizeInPixels.iHeight ) / 2; |
113 TPoint pos = TPoint( xDelta , yDelta ); // displacement vector |
121 TPoint pos = TPoint( xDelta , yDelta ); // displacement vector |
114 //pos += rect.iTl; // bitmap top left corner position |
122 //pos += rect.iTl; // bitmap top left corner position |
|
123 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:TPoint --Three" ) ) ); |
115 CWindowGc& gc = SystemGc(); |
124 CWindowGc& gc = SystemGc(); |
|
125 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SystemGc --Four" ) ) ); |
116 ActivateGc(); |
126 ActivateGc(); |
|
127 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ActivateGc --Five" ) ) ); |
117 Window().Invalidate( rect ); |
128 Window().Invalidate( rect ); |
|
129 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:Invalidate --Six" ) ) ); |
118 Window().BeginRedraw( rect ); |
130 Window().BeginRedraw( rect ); |
|
131 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:BeginRedraw --Seven" ) ) ); |
119 gc.Clear(); |
132 gc.Clear(); |
|
133 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.Clear --Eight" ) ) ); |
120 gc.BitBlt( pos, iBitmap ); // CWindowGc member function |
134 gc.BitBlt( pos, iBitmap ); // CWindowGc member function |
|
135 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.BitBlt --Nine" ) ) ); |
121 Window().EndRedraw(); |
136 Window().EndRedraw(); |
|
137 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.EndRedraw --Ten" ) ) ); |
122 DeactivateGc(); |
138 DeactivateGc(); |
|
139 TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.DeactivateGc --Eleven" ) ) ); |
123 ControlEnv()->WsSession().Flush(); // force draw of the context |
140 ControlEnv()->WsSession().Flush(); // force draw of the context |
124 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:end" ) ) ); |
141 TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:end" ) ) ); |
125 } |
142 } |
126 } |
143 } |
127 |
144 |
142 Window().EndRedraw(); |
159 Window().EndRedraw(); |
143 DeactivateGc(); |
160 DeactivateGc(); |
144 ControlEnv()->WsSession().Flush(); // force draw of the context |
161 ControlEnv()->WsSession().Flush(); // force draw of the context |
145 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION |
162 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION |
146 } |
163 } |
147 |
164 } |
|
165 |
|
166 // ---------------------------------------------------------------------------- |
|
167 // CSysApShutdownImage::ShowShutdownImage() |
|
168 // ---------------------------------------------------------------------------- |
|
169 CFbsBitmap* CSysApShutdownImage::ReadSVGL (TFileName aFileName) |
|
170 { |
|
171 TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:start" ) ) ); |
|
172 TFontSpec fontspec; |
|
173 TDisplayMode mode = EColor16MA; |
|
174 TInt SIZE_X(360), SIZE_Y(360); |
|
175 TSize size(SIZE_X, SIZE_Y); |
|
176 |
|
177 //if ( mode >= (TDisplayMode)13 ) { mode = EColor16MA; } |
|
178 |
|
179 CFbsBitmap* frameBuffer = new ( ELeave ) CFbsBitmap; |
|
180 CleanupStack::PushL( frameBuffer ); |
|
181 frameBuffer->Create( size, mode ); |
|
182 |
|
183 CSvgEngineInterfaceImpl* svgEngine = NULL; |
|
184 svgEngine = CSvgEngineInterfaceImpl::NewL(frameBuffer, NULL, fontspec ); |
|
185 |
|
186 if (svgEngine == NULL) |
|
187 { |
|
188 TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:SVG engine creation failed" ) ) ); |
|
189 } |
|
190 |
|
191 CleanupStack::PushL( svgEngine ); |
|
192 TInt domHandle = 0; |
|
193 svgEngine->PrepareDom( aFileName, domHandle ) ; |
|
194 if (domHandle == 0) |
|
195 { |
|
196 TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL():DOM handle creation failed" ) ) ); |
|
197 } |
|
198 |
|
199 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; |
|
200 CleanupStack::PushL( bitmap ); |
|
201 User::LeaveIfError( bitmap->Create( size, EColor64K ) ); |
|
202 |
|
203 svgEngine->UseDom( domHandle, bitmap, NULL ) ; |
|
204 |
|
205 MSvgError* err; |
|
206 svgEngine->Start( err ); |
|
207 if (err->HasError()) |
|
208 { |
|
209 TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL(): SVG Engine Start failed" ) ) ); |
|
210 } |
|
211 |
|
212 svgEngine->DeleteDom( domHandle ); |
|
213 CleanupStack::Pop( bitmap ); |
|
214 CleanupStack::PopAndDestroy( svgEngine ); |
|
215 CleanupStack::PopAndDestroy( frameBuffer ); |
|
216 TRACES( RDebug::Print(_L("CSysApShutdownImage::ReadSVGL:End" ) ) ); |
|
217 return bitmap; |
148 } |
218 } |
149 |
219 |
150 // ---------------------------------------------------------------------------- |
220 // ---------------------------------------------------------------------------- |
151 // CSysApShutdownImage::ShutdownCoeControlWindow() |
221 // CSysApShutdownImage::ShutdownCoeControlWindow() |
152 // ---------------------------------------------------------------------------- |
222 // ---------------------------------------------------------------------------- |