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