|
1 /* |
|
2 * Copyright (c) 2005-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: JNI methods |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CM2GEventSource.h" |
|
20 #include "com_nokia_microedition_m2g_M2GManager.h" |
|
21 #include "CM2GSVGProxy.h" |
|
22 #include "CM2GEventSource.h" |
|
23 |
|
24 M2G_NS_START |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 // ================================ FUNCTIONS ================================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // Java_com_nokia_microedition_m2g_M2GManager::_createSvgEngine |
|
48 // ----------------------------------------------------------------------------- |
|
49 /** |
|
50 * Calls MM2GSVGProxy::CreateSvgEngineL method. |
|
51 * @since Series S60 3.0 |
|
52 * @param aProxy Proxy instance. |
|
53 * @param aHandle Svg engine handle |
|
54 */ |
|
55 /** |
|
56 * JNI method |
|
57 */ |
|
58 JNIEXPORT jint JNICALL |
|
59 Java_com_nokia_microedition_m2g_M2GManager__1createSvgEngine( |
|
60 JNIEnv* aJni, |
|
61 jclass, |
|
62 jint aSvgProxyHandle) |
|
63 { |
|
64 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine - begin"); |
|
65 |
|
66 TInt handle = M2G_INVALID_HANDLE; |
|
67 TInt err = KM2GNotOk; |
|
68 |
|
69 M2G_DO_LOCK |
|
70 if (aSvgProxyHandle) |
|
71 { |
|
72 TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->CreateSvgEngineL(handle);); |
|
73 } |
|
74 M2G_DO_UNLOCK(aJni) |
|
75 |
|
76 handle = M2GGeneral::CheckErrorCodeAndHandle( |
|
77 aJni, err, handle, M2G_INVALID_HANDLE); |
|
78 |
|
79 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine: %d - end", handle); |
|
80 return handle; |
|
81 } |
|
82 // ----------------------------------------------------------------------------- |
|
83 // Java_com_nokia_microedition_m2g_M2GManager::_createSvgProxy |
|
84 // ----------------------------------------------------------------------------- |
|
85 /** |
|
86 * Creates an svg proxy. |
|
87 * @since Series S60 3.0 |
|
88 * @param Svg proxy handle |
|
89 /** |
|
90 * JNI method |
|
91 */ |
|
92 JNIEXPORT jint JNICALL |
|
93 Java_com_nokia_microedition_m2g_M2GManager__1createSvgProxy( |
|
94 JNIEnv* aJni,jclass) |
|
95 { |
|
96 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy - begin"); |
|
97 TInt handle = M2G_INVALID_HANDLE; |
|
98 TInt err = KM2GNotOk; |
|
99 |
|
100 M2G_DO_LOCK |
|
101 TRAP(err, MM2GSVGProxy* proxy = CM2GSVGProxy::NewL(); handle = JavaMakeHandle(proxy);); |
|
102 M2G_DO_UNLOCK(aJni) |
|
103 |
|
104 handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err); |
|
105 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy: %d - end", handle); |
|
106 return handle; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgEngine |
|
111 // ----------------------------------------------------------------------------- |
|
112 /** |
|
113 * Calls MM2GSVGProxy::DeleteSvgEnginedL method. |
|
114 * @since Series S60 3.0 |
|
115 * @param aProxy Proxy instance. |
|
116 |
|
117 /** |
|
118 * JNI method |
|
119 */ |
|
120 JNIEXPORT void JNICALL |
|
121 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgEngine( |
|
122 JNIEnv* aJni, |
|
123 jclass, |
|
124 jint aSvgProxyHandle, |
|
125 jint aSvgEngineHandle ) |
|
126 { |
|
127 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine - begin"); |
|
128 |
|
129 TInt err = KM2GNotOk; |
|
130 |
|
131 M2G_DO_LOCK |
|
132 if (aSvgProxyHandle) |
|
133 { |
|
134 TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->DeleteSvgEngineL( |
|
135 STATIC_CAST(TM2GSvgEngineHandle, aSvgEngineHandle));); |
|
136 } |
|
137 M2G_DO_UNLOCK(aJni) |
|
138 |
|
139 M2GGeneral::CheckErrorCode(aJni, err); |
|
140 |
|
141 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine: - end"); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgProxy |
|
146 // ----------------------------------------------------------------------------- |
|
147 /** |
|
148 * Deletes a proxy object. NOTE: The proxy object has to be deleted inside same |
|
149 * thread as it was created, otherwice there will be problem to delete a CFbsBitmap |
|
150 * server object inside the SVGTopt componenet see KATA-6KYA9T (SVGEngineJI: SVGTopt |
|
151 * crashes when deleting svg document object that contains external resource) |
|
152 * @since Series S60 3.0 |
|
153 * @param aProxy Proxy instance. |
|
154 |
|
155 /** |
|
156 * JNI method |
|
157 */ |
|
158 JNIEXPORT void JNICALL |
|
159 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgProxy( |
|
160 JNIEnv* aJni, |
|
161 jclass, |
|
162 jint aSvgProxyHandle) |
|
163 { |
|
164 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy - begin"); |
|
165 TInt err = KM2GNotOk; |
|
166 |
|
167 M2G_DO_LOCK |
|
168 if (aSvgProxyHandle) |
|
169 { |
|
170 MM2GSVGProxy* proxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
171 TRAP(err,delete proxy;); |
|
172 } |
|
173 M2G_DO_UNLOCK(aJni) |
|
174 |
|
175 M2GGeneral::CheckErrorCode(aJni, err); |
|
176 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy: - end"); |
|
177 } |
|
178 // ----------------------------------------------------------------------------- |
|
179 // Java_com_nokia_microedition_m2g_M2GManager::_finalizeEventSource |
|
180 // ----------------------------------------------------------------------------- |
|
181 /** |
|
182 * JNI method TODO check this function for modifications |
|
183 */ |
|
184 //JNIEXPORT void JNICALL |
|
185 //Java_com_nokia_microedition_m2g_M2GManager__1finalizeEventSource( |
|
186 // JNIEnv *aJni, jclass, jint aEventSourceHandle, jboolean aUiToolkit) |
|
187 //{ |
|
188 // M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _finalizeEventSource: %d", aEventSourceHandle); |
|
189 // if (aUiToolkit) |
|
190 // { |
|
191 //// MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
192 //// if (client) |
|
193 //// { |
|
194 //// delete client; |
|
195 //// client = NULL; |
|
196 //// } |
|
197 // } |
|
198 // else |
|
199 // { |
|
200 // CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
201 // if (eventSource) |
|
202 // { |
|
203 // eventSource->Dispose(*aJni); |
|
204 // } |
|
205 // eventSource = NULL; |
|
206 // } |
|
207 //} |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // Java_com_nokia_microedition_m2g_M2GManager::_initEventSource |
|
211 // ----------------------------------------------------------------------------- |
|
212 /** |
|
213 * JNI method TODO check this function for modifications |
|
214 |
|
215 JNIEXPORT jint JNICALL |
|
216 Java_com_nokia_microedition_m2g_M2GManager__1initEventSource( |
|
217 JNIEnv *aJni, |
|
218 jclass aPeer, |
|
219 jint aServer) |
|
220 { |
|
221 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin"); |
|
222 |
|
223 M2G_DO_LOCK |
|
224 TRAPD(eventSourceHandle, eventSourceHandle = CM2GEventSource::NewL( |
|
225 *aJni, aPeer, aServer)); |
|
226 M2G_DO_UNLOCK(aJni) |
|
227 |
|
228 M2GGeneral::CheckHandle(aJni, eventSourceHandle); |
|
229 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle); |
|
230 return eventSourceHandle; |
|
231 }*/ |
|
232 ////TODO check this function for modifications |
|
233 //JNIEXPORT jint JNICALL |
|
234 //Java_com_nokia_microedition_m2g_M2GManager__1initSwtEventSource( |
|
235 // JNIEnv *aJni, |
|
236 // jclass /*aPeer*/) |
|
237 //{ |
|
238 // M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin"); |
|
239 // |
|
240 // MSwtClient* client = NULL; |
|
241 // TRAP_IGNORE(client = SWT::CreateClientL()); |
|
242 // if (!client) |
|
243 // { |
|
244 // return KErrNotFound; |
|
245 // } |
|
246 // M2GGeneral::CheckHandle(aJni, (int)client); |
|
247 // M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle); |
|
248 // return (int)client; |
|
249 //} |
|
250 M2G_NS_END |