javauis/m2g_qt/src/jni/M2GSVGAnimationElement.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".
    63     jfloat aOffset,
    63     jfloat aOffset,
    64     jfloat aCurrentTime)
    64     jfloat aCurrentTime)
    65 {
    65 {
    66     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin");
    66     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin");
    67     TInt err = KM2GNotOk;
    67     TInt err = KM2GNotOk;
    68     
    68 
    69     if (aSvgProxyHandle && aDocumentHandle)
    69     if (aSvgProxyHandle && aDocumentHandle)
       
    70     {
       
    71         MM2GSVGProxy* aProxy =    JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
       
    72         TInt16 restartAttribute;
       
    73 
       
    74         TRAP(err, aProxy->GetEnumTraitL(
       
    75                  STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
    76                  STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute),
       
    77                  restartAttribute);
       
    78             )
       
    79 
       
    80         TInt isActive;
       
    81         TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive);)
       
    82 
       
    83         if (isActive && (restartAttribute == KM2GRestartWhenNotActive))
    70         {
    84         {
    71             MM2GSVGProxy* aProxy =    JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
    85             M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute);
    72             TInt16 restartAttribute;
       
    73             
       
    74             TRAP(err, aProxy->GetEnumTraitL(
       
    75                         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
    76                         STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute),
       
    77                         restartAttribute);
       
    78                     )
       
    79             
       
    80             TInt isActive;
       
    81             TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive); ) 
       
    82             
       
    83             if (isActive && (restartAttribute == KM2GRestartWhenNotActive))
       
    84             {
       
    85                 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute);
       
    86             }
       
    87             else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever))
       
    88             {
       
    89                 // Cannot restart even if animation hasn't ended?
       
    90                 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute);
       
    91             }
       
    92             else
       
    93                 {
       
    94                     M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime);
       
    95                     TRAP(err,   aProxy->BeginElementAtL(
       
    96                                 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
       
    97                                 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), 
       
    98                                 (aOffset+aCurrentTime) );
       
    99                     )
       
   100                 }
       
   101         }
    86         }
       
    87         else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever))
       
    88         {
       
    89             // Cannot restart even if animation hasn't ended?
       
    90             M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute);
       
    91         }
       
    92         else
       
    93         {
       
    94             M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime);
       
    95             TRAP(err,   aProxy->BeginElementAtL(
       
    96                      STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
       
    97                      STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
    98                      (aOffset+aCurrentTime));
       
    99                 )
       
   100         }
       
   101     }
   102     M2GGeneral::CheckErrorCode(aJni, err);
   102     M2GGeneral::CheckErrorCode(aJni, err);
   103     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end");
   103     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end");
   104     
   104 
   105 }
   105 }
   106 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   107 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt
   107 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt
   108 // -----------------------------------------------------------------------------
   108 // -----------------------------------------------------------------------------
   109 /**
   109 /**
   123     jint aElementHandle,
   123     jint aElementHandle,
   124     jfloat aOffset)
   124     jfloat aOffset)
   125 {
   125 {
   126     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin");
   126     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin");
   127     TInt err = KM2GNotOk;
   127     TInt err = KM2GNotOk;
   128     
   128 
   129     MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
   129     MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
   130     
   130 
   131     TRAP(err,  aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   131     TRAP(err,  aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
   132                STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
   132                                      STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
   133                aOffset);
   133                                      aOffset);
   134             )
   134         )
   135 
   135 
   136     M2GGeneral::CheckErrorCode(aJni, err);
   136     M2GGeneral::CheckErrorCode(aJni, err);
   137 
   137 
   138     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end");
   138     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end");
   139 }
   139 }
   157 {
   157 {
   158     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin");
   158     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin");
   159     TInt err = KM2GNotOk;
   159     TInt err = KM2GNotOk;
   160     TInt active = 0;
   160     TInt active = 0;
   161     MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
   161     MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
   162     
   162 
   163     TRAP(err, aProxy->IsActiveL(
   163     TRAP(err, aProxy->IsActiveL(
   164               STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
   164              STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
   165               active);
   165              active);
   166         )
   166         )
   167   
   167 
   168     M2GGeneral::CheckErrorCode(aJni, err);
   168     M2GGeneral::CheckErrorCode(aJni, err);
   169     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active);
   169     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active);
   170     return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse));
   170     return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse));
   171 }
   171 }
   172 
   172