javauis/m2g_qt/src/jni/M2GManager.cpp
changeset 87 1627c337e51e
parent 80 d6dafc5d983f
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
     1 /*
     1 /*
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    58     JNIEnv* aJni,
    58     JNIEnv* aJni,
    59     jclass,
    59     jclass,
    60     jint aSvgProxyHandle)
    60     jint aSvgProxyHandle)
    61 {
    61 {
    62     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine - begin");
    62     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine - begin");
    63     
    63 
    64     TInt handle = M2G_INVALID_HANDLE;
    64     TInt handle = M2G_INVALID_HANDLE;
    65     TInt err = KM2GNotOk;
    65     TInt err = KM2GNotOk;
    66     
    66 
    67     M2G_DO_LOCK
    67     M2G_DO_LOCK
    68     if (aSvgProxyHandle)
    68     if (aSvgProxyHandle)
    69         {
    69     {
    70         TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->CreateSvgEngineL(handle););
    70         TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->CreateSvgEngineL(handle););
    71         }
    71     }
    72     M2G_DO_UNLOCK(aJni)
    72     M2G_DO_UNLOCK(aJni)
    73 
    73 
    74     handle = M2GGeneral::CheckErrorCodeAndHandle(
    74     handle = M2GGeneral::CheckErrorCodeAndHandle(
    75                         aJni, err, handle, M2G_INVALID_HANDLE); 
    75                  aJni, err, handle, M2G_INVALID_HANDLE);
    76     
    76 
    77     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine: %d - end", handle);
    77     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine: %d - end", handle);
    78     return handle;
    78     return handle;
    79 }
    79 }
    80 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
    81 // Java_com_nokia_microedition_m2g_M2GManager::_createSvgProxy
    81 // Java_com_nokia_microedition_m2g_M2GManager::_createSvgProxy
    82 // -----------------------------------------------------------------------------
    82 // -----------------------------------------------------------------------------
    83 /**
    83 /**
    84  * Creates an svg proxy.
    84  * Creates an svg proxy.
    85  * @since Series S60 3.0
    85  * @since Series S60 3.0
    86  * @param Svg proxy handle
    86  * @param Svg proxy handle
    87 /**
    87  *
    88  * JNI method
    88  * JNI method
    89  */
    89  */
    90 JNIEXPORT jint JNICALL
    90 JNIEXPORT jint JNICALL
    91 Java_com_nokia_microedition_m2g_M2GManager__1createSvgProxy(
    91 Java_com_nokia_microedition_m2g_M2GManager__1createSvgProxy(
    92     JNIEnv* aJni,jclass)
    92     JNIEnv* aJni,jclass)
   109 // -----------------------------------------------------------------------------
   109 // -----------------------------------------------------------------------------
   110 /**
   110 /**
   111  * Calls MM2GSVGProxy::DeleteSvgEnginedL method.
   111  * Calls MM2GSVGProxy::DeleteSvgEnginedL method.
   112  * @since Series S60 3.0
   112  * @since Series S60 3.0
   113  * @param aProxy Proxy instance.
   113  * @param aProxy Proxy instance.
   114  
   114  *
   115 /**
       
   116  * JNI method
   115  * JNI method
   117  */
   116  */
   118 JNIEXPORT void JNICALL
   117 JNIEXPORT void JNICALL
   119 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgEngine(
   118 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgEngine(
   120     JNIEnv* aJni,
   119     JNIEnv* aJni,
   121     jclass,
   120     jclass,
   122     jint aSvgProxyHandle,
   121     jint aSvgProxyHandle,
   123     jint aSvgEngineHandle   )
   122     jint aSvgEngineHandle)
   124 {
   123 {
   125     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine - begin");
   124     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine - begin");
   126     
   125 
   127     TInt err = KM2GNotOk;
   126     TInt err = KM2GNotOk;
   128     
   127 
   129     M2G_DO_LOCK
   128     M2G_DO_LOCK
   130     if (aSvgProxyHandle)
   129     if (aSvgProxyHandle)
   131         {
   130     {
   132            TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->DeleteSvgEngineL(
   131         TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->DeleteSvgEngineL(
   133            STATIC_CAST(TM2GSvgEngineHandle, aSvgEngineHandle)););
   132                  STATIC_CAST(TM2GSvgEngineHandle, aSvgEngineHandle)););
   134         }
   133     }
   135     M2G_DO_UNLOCK(aJni)
   134     M2G_DO_UNLOCK(aJni)
   136     
   135 
   137     M2GGeneral::CheckErrorCode(aJni, err);
   136     M2GGeneral::CheckErrorCode(aJni, err);
   138     
   137 
   139     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine: - end");
   138     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine: - end");
   140 }
   139 }
   141 
   140 
   142 // -----------------------------------------------------------------------------
   141 // -----------------------------------------------------------------------------
   143 // Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgProxy
   142 // Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgProxy
   147  * thread as it was created, otherwice there will be problem to delete a CFbsBitmap
   146  * thread as it was created, otherwice there will be problem to delete a CFbsBitmap
   148  * server object inside the SVGTopt componenet see KATA-6KYA9T (SVGEngineJI: SVGTopt
   147  * server object inside the SVGTopt componenet see KATA-6KYA9T (SVGEngineJI: SVGTopt
   149  * crashes when deleting svg document object that contains external resource)
   148  * crashes when deleting svg document object that contains external resource)
   150  * @since Series S60 3.0
   149  * @since Series S60 3.0
   151  * @param aProxy Proxy instance.
   150  * @param aProxy Proxy instance.
   152 
   151  *
   153 /**
       
   154  * JNI method
   152  * JNI method
   155  */
   153  */
   156 JNIEXPORT void JNICALL
   154 JNIEXPORT void JNICALL
   157 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgProxy(
   155 Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgProxy(
   158     JNIEnv* aJni,
   156     JNIEnv* aJni,
   159     jclass,
   157     jclass,
   160     jint aSvgProxyHandle)
   158     jint aSvgProxyHandle)
   161 {
   159 {
   162     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy - begin");
   160     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy - begin");
   163     TInt            err = KM2GNotOk;
   161     TInt            err = KM2GNotOk;
   164     
   162 
   165     M2G_DO_LOCK
   163     M2G_DO_LOCK
   166     if (aSvgProxyHandle)
   164     if (aSvgProxyHandle)
   167         {
   165     {
   168         MM2GSVGProxy* proxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   166         MM2GSVGProxy* proxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
   169         TRAP(err,delete proxy;);
   167         TRAP(err,delete proxy;);
   170         }
   168     }
   171     M2G_DO_UNLOCK(aJni)
   169     M2G_DO_UNLOCK(aJni)
   172 
   170 
   173     M2GGeneral::CheckErrorCode(aJni, err);
   171     M2GGeneral::CheckErrorCode(aJni, err);
   174     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy: - end");
   172     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy: - end");
   175 }
   173 }
   176 // -----------------------------------------------------------------------------
       
   177 // Java_com_nokia_microedition_m2g_M2GManager::_finalizeEventSource
       
   178 // -----------------------------------------------------------------------------
       
   179 /**
       
   180  * JNI method TODO check this function for modifications
       
   181  */
       
   182 //JNIEXPORT void JNICALL
       
   183 //Java_com_nokia_microedition_m2g_M2GManager__1finalizeEventSource(
       
   184 //    JNIEnv *aJni, jclass, jint aEventSourceHandle, jboolean aUiToolkit)
       
   185 //{
       
   186 //    M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _finalizeEventSource: %d", aEventSourceHandle);
       
   187 //    if (aUiToolkit)
       
   188 //    {
       
   189 ////        MSwtClient* client  = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   190 ////        if (client)
       
   191 ////        {
       
   192 ////            delete client;
       
   193 ////            client = NULL;
       
   194 ////        }
       
   195 //    }
       
   196 //    else
       
   197 //    {
       
   198 //        CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   199 //        if (eventSource)
       
   200 //        {
       
   201 //            eventSource->Dispose(*aJni);
       
   202 //        }
       
   203 //        eventSource = NULL;
       
   204 //    }
       
   205 //}
       
   206 
   174 
   207 // -----------------------------------------------------------------------------
       
   208 // Java_com_nokia_microedition_m2g_M2GManager::_initEventSource
       
   209 // -----------------------------------------------------------------------------
       
   210 /**
       
   211  * JNI method TODO check this function for modifications
       
   212  
       
   213 JNIEXPORT jint JNICALL
       
   214 Java_com_nokia_microedition_m2g_M2GManager__1initEventSource(
       
   215     JNIEnv *aJni,
       
   216     jclass aPeer,
       
   217     jint aServer)
       
   218 {
       
   219     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
       
   220 
       
   221     M2G_DO_LOCK
       
   222     TRAPD(eventSourceHandle, eventSourceHandle = CM2GEventSource::NewL(
       
   223                 *aJni, aPeer, aServer));
       
   224     M2G_DO_UNLOCK(aJni)
       
   225     
       
   226     M2GGeneral::CheckHandle(aJni, eventSourceHandle);
       
   227     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
       
   228     return eventSourceHandle;
       
   229 }*/
       
   230 ////TODO check this function for modifications
       
   231 //JNIEXPORT jint JNICALL
       
   232 //Java_com_nokia_microedition_m2g_M2GManager__1initSwtEventSource(
       
   233 //    JNIEnv *aJni,
       
   234 //    jclass /*aPeer*/)
       
   235 //{
       
   236 //    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
       
   237 //
       
   238 //    MSwtClient* client = NULL;
       
   239 //    TRAP_IGNORE(client = SWT::CreateClientL());
       
   240 //    if (!client)
       
   241 //    {
       
   242 //        return KErrNotFound;
       
   243 //    }
       
   244 //    M2GGeneral::CheckHandle(aJni, (int)client);
       
   245 //    M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
       
   246 //    return (int)client;
       
   247 //}
       
   248 M2G_NS_END
   175 M2G_NS_END