33 |
33 |
34 // CONSTRUCTION |
34 // CONSTRUCTION |
35 // Static constructor, leaves pointer to cleanup-stack |
35 // Static constructor, leaves pointer to cleanup-stack |
36 CMMADCDisplay* CMMADCDisplay::NewLC(MMMAGuiPlayer* aPlayer, |
36 CMMADCDisplay* CMMADCDisplay::NewLC(MMMAGuiPlayer* aPlayer, |
37 MMAFunctionServer* aEventSource, |
37 MMAFunctionServer* aEventSource, |
|
38 JNIEnv* aJni, |
38 jobject aGUIObject) |
39 jobject aGUIObject) |
39 { |
40 { |
40 CMMADCDisplay* self = |
41 CMMADCDisplay* self = |
41 new(ELeave) CMMADCDisplay(aPlayer, aEventSource, aGUIObject); |
42 new(ELeave) CMMADCDisplay(aPlayer, aEventSource, aGUIObject); |
42 CleanupStack::PushL(self); |
43 CleanupStack::PushL(self); |
43 self->iRepaint = new(ELeave) CMMADCRepaintEvent(aGUIObject); |
44 self->iRepaint = new(ELeave) CMMADCRepaintEvent(aGUIObject); |
|
45 self->iIseSWT = ETrue; |
|
46 self->Construct(aEventSource, aJni, aGUIObject); |
|
47 |
44 return self; |
48 return self; |
45 } |
49 } |
46 |
50 |
47 // Destructor (virtual by CBase) |
51 // Destructor (virtual by CBase) |
48 CMMADCDisplay::~CMMADCDisplay() |
52 CMMADCDisplay::~CMMADCDisplay() |
108 // because SetDisplayLocationL call is ignored. |
112 // because SetDisplayLocationL call is ignored. |
109 return TPoint(0, 0); |
113 return TPoint(0, 0); |
110 } |
114 } |
111 |
115 |
112 // interface MMMADisplay |
116 // interface MMMADisplay |
|
117 |
113 void CMMADCDisplay::SetFullScreenL(TBool aFullScreen) |
118 void CMMADCDisplay::SetFullScreenL(TBool aFullScreen) |
114 { |
119 { |
115 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullScreenL %d", aFullScreen); |
120 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullScreenL %d", aFullScreen); |
116 // This method tries to set eSWT Widget size to its parent size. |
121 // This method tries to set eSWT Widget size to its parent size. |
117 // If real full screen mode is needed parent Composite must be in |
122 // If real full screen mode is needed parent Composite must be in |
118 // fullscreen mode (for example with MobileShell's setFullScreenMode method). |
123 // fullscreen mode (for example with MobileShell's setFullScreenMode method). |
119 if (iContainer) |
124 //if (iContainer) |
120 { |
125 //{ |
121 CMMADCFullScreenEvent* event = |
126 // CMMADCFullScreenEvent* event = |
122 new(ELeave)CMMADCFullScreenEvent(iGUIObject, aFullScreen); |
127 // new(ELeave)CMMADCFullScreenEvent(iGUIObject, aFullScreen); |
123 iEventSource->PostEvent(event, CMMAEvent::EEventPriority); |
128 // iEventSource->PostEvent(event, CMMAEvent::EEventPriority); |
124 } |
129 //} |
125 } |
130 iFullScreen = aFullScreen; |
|
131 if (iContainerVisible) |
|
132 { |
|
133 RemoveClippingRegion(); |
|
134 |
|
135 if (aFullScreen) |
|
136 { |
|
137 // use new scaled rect |
|
138 // iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize)); |
|
139 LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreen iFullScreenSize.Width = %d iFullscreenSize.Height = %d", |
|
140 iFullScreenSize.iWidth, iFullScreenSize.iHeight); |
|
141 |
|
142 iWindow->SetWindowRect(ScaleToFullScreen(iFullScreenSize, iSourceSize), MMMADisplay::EUiThread); |
|
143 iWindow->SetRWindowRect(ScaleToFullScreen(iFullScreenSize, iSourceSize), MMMADisplay::EUiThread); |
|
144 iWindow->SetDrawRectThread(ScaleToFullScreen(iFullScreenSize, iSourceSize)); |
|
145 //iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize)); |
|
146 } |
|
147 else |
|
148 { |
|
149 // use size set from java |
|
150 //iWindow->SetDrawRect(iUserRect); |
|
151 iWindow->SetDrawRectThread(iUserRect); |
|
152 } |
|
153 |
|
154 AddClippingRegion(); |
|
155 } |
|
156 } |
|
157 /* |
|
158 void CMMADCDisplay::SetFullScreenL(TBool aFullScreen) |
|
159 { |
|
160 LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreenL() +"); |
|
161 |
|
162 // TSize canvasSize(aJavaControlWidth, aJavaControlHeight); |
|
163 iSourceSize = SourceSize(); |
|
164 //iSourceSize=canvasSize; |
|
165 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullscreenL() asourcesize %d",iSourceSize ); |
|
166 #ifdef RD_JAVA_NGA_Enabled |
|
167 if(iWindow) |
|
168 { |
|
169 iWindow->SetVideoCropRegion( TRect(iUserRect.iTl, iSourceSize)); |
|
170 } |
|
171 #endif |
|
172 // TSize canvasSize(aJavaControlWidth, aJavaControlHeight); |
|
173 //chnaged |
|
174 |
|
175 //TSize canvasSize(iFullScreenSize.iWidth, iFullScreenSize.iHeight); |
|
176 //TSize iUser(iUserRect.Width(),iUserRect.Height()); |
|
177 //iFullScreenSize = canvasSize; |
|
178 // iFullScreenSize=iUser; |
|
179 // if(aFullScreen) |
|
180 // { |
|
181 // iFullScreenSize = canvasSize; |
|
182 // } |
|
183 TBool sourceIsBigger = (iSourceSize.iWidth > iFullScreenSize.iWidth || |
|
184 iSourceSize.iHeight > iFullScreenSize.iHeight); |
|
185 |
|
186 if(sourceIsBigger) |
|
187 { |
|
188 |
|
189 iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
190 iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
191 iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize)); |
|
192 } |
|
193 else |
|
194 { |
|
195 iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
196 iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
197 //iWindow->SetVideoCropRegion( TRect(iUserRect.iTl,iFullScreenSize)); |
|
198 //;iWindow->SetDrawRect( TRect(iUserRect.iTl, iSourceSize)); |
|
199 iWindow->SetDrawRect( TRect(iUserRect.iTl,iFullScreenSize)); |
|
200 |
|
201 } |
|
202 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()1 - %d",iUserRect.Size()); |
|
203 SetClippingRegion(); |
|
204 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()2 -%d",iUserRect.Size()); |
|
205 if(iUserRect.IsEmpty()) |
|
206 { |
|
207 iUserRect = iWindow->DrawRect(); |
|
208 |
|
209 if(!sourceIsBigger) |
|
210 { |
|
211 iUserRect = TRect(iUserRect.Size()); |
|
212 } |
|
213 } |
|
214 LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() -"); |
|
215 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()3 -%d",iUserRect.Size()); |
|
216 }*/ |
126 |
217 |
127 // interface MMMADisplay |
218 // interface MMMADisplay |
128 void CMMADCDisplay::SourceSizeChanged(const TSize& aSourceSize) |
219 void CMMADCDisplay::SourceSizeChanged(const TSize& aSourceSize) |
129 { |
220 { |
130 LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged %d %d", |
221 LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged %d %d", |
152 iWindow->SetVisible(ETrue, EFalse); |
243 iWindow->SetVisible(ETrue, EFalse); |
153 } |
244 } |
154 } |
245 } |
155 } |
246 } |
156 } |
247 } |
157 void CMMADCDisplay::SourceSizeChanged(TInt /*aJavaControlWidth*/, TInt /*aJavaControlHeight*/,TInt /*x*/, TInt /*y*/, TRect /*aBoundsRect*/) |
248 |
158 { |
249 |
|
250 void CMMADCDisplay::SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight,TInt /*x*/, TInt /*y*/, TRect /*aBoundsRect*/) |
|
251 { |
|
252 LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() +"); |
|
253 LOG2(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() aJavaControlWidth=%d aJavaControlHeight=%d", aJavaControlWidth, aJavaControlHeight); |
|
254 // TSize canvasSize(aJavaControlWidth, aJavaControlHeight); |
|
255 iSourceSize = SourceSize(); |
|
256 //iSourceSize=canvasSize; |
|
257 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() asourcesize %d",iSourceSize); |
|
258 #ifdef RD_JAVA_NGA_Enabled |
|
259 if (iWindow) |
|
260 { |
|
261 iWindow->SetVideoCropRegion(TRect(iUserRect.iTl, iSourceSize)); |
|
262 } |
|
263 #endif |
|
264 // TSize canvasSize(aJavaControlWidth, aJavaControlHeight); |
|
265 //chnaged |
|
266 TSize canvasSize(aJavaControlWidth, aJavaControlHeight); |
|
267 iFullScreenSize = canvasSize; |
|
268 |
|
269 TBool sourceIsBigger = (iSourceSize.iWidth > iFullScreenSize.iWidth || |
|
270 iSourceSize.iHeight > iFullScreenSize.iHeight); |
|
271 |
|
272 if (sourceIsBigger) |
|
273 { |
|
274 iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
275 iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
276 iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize)); |
|
277 } |
|
278 else |
|
279 { |
|
280 iWindow->SetWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
281 iWindow->SetRWindowRect(iFullScreenSize,MMMADisplay::EMmaThread); |
|
282 //;iWindow->SetDrawRect( TRect(iUserRect.iTl, iSourceSize)); |
|
283 iWindow->SetDrawRect(TRect(iUserRect.iTl,iFullScreenSize)); |
|
284 } |
|
285 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()1 - %d",iUserRect.Size()); |
|
286 SetClippingRegion(); |
|
287 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()2 -%d",iUserRect.Size()); |
|
288 if (iUserRect.IsEmpty()) |
|
289 { |
|
290 iUserRect = iWindow->DrawRect(); |
|
291 |
|
292 if (!sourceIsBigger) |
|
293 { |
|
294 iUserRect = TRect(iUserRect.Size()); |
|
295 } |
|
296 } |
|
297 LOG(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged() -"); |
|
298 LOG1(EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged()3 -%d",iUserRect.Size()); |
159 } |
299 } |
160 |
300 |
161 // interface MMMADisplay |
301 // interface MMMADisplay |
162 TBool CMMADCDisplay::IsVisible() |
302 TBool CMMADCDisplay::IsVisible() |
163 { |
303 { |