javauis/m2g_qt/src/jni/M2GSVGAnimationElement.cpp
author hgs
Fri, 29 Oct 2010 11:49:32 +0300
changeset 87 1627c337e51e
parent 80 d6dafc5d983f
permissions -rw-r--r--
v2.2.21_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     1
/*
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     3
* All rights reserved.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     8
*
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
     9
* Initial Contributors:
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    11
*
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    12
* Contributors:
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    13
*
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    14
* Description:  JNI methods
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    15
*
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    16
*/
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    17
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    18
// INCLUDE FILES
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    19
#include "com_nokia_microedition_m2g_M2GSVGAnimationElement.h"
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    20
#include "MM2GSVGProxy.h"
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    21
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    22
M2G_NS_START
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    23
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    24
// EXTERNAL DATA STRUCTURES
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    25
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    26
// EXTERNAL FUNCTION PROTOTYPES
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    27
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    28
// CONSTANTS
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    29
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    30
// MACROS
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    31
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    32
// LOCAL CONSTANTS AND MACROS
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    33
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    34
// MODULE DATA STRUCTURES
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    35
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    36
// LOCAL FUNCTION PROTOTYPES
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    37
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    38
// FORWARD DECLARATIONS
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    39
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    40
// CLASS DECLARATION
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    41
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    42
// ================================ FUNCTIONS ==================================
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    43
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    44
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    45
// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_beginElementAt
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    46
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    47
/**
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    48
 * Calls MM2GSVGProxy::BeginElementAtL method.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    49
 * @since Series S60 3.0
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    50
 * @param aProxy Proxy instance.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    51
 * @param aDocumentHandle Document handle
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    52
 * @param aElementHandle Element handle
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    53
 * @param aOffset Offset time
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    54
 * @throws Exception if not ok.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    55
 */
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    56
JNIEXPORT void JNICALL
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    57
Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1beginElementAt(
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    58
    JNIEnv* aJni,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    59
    jobject,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    60
    jint aSvgProxyHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    61
    jint aDocumentHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    62
    jint aElementHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    63
    jfloat aOffset,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    64
    jfloat aCurrentTime)
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    65
{
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    66
    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin");
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    67
    TInt err = KM2GNotOk;
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    68
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    69
    if (aSvgProxyHandle && aDocumentHandle)
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    70
    {
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    71
        MM2GSVGProxy* aProxy =    JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    72
        TInt16 restartAttribute;
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    73
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    74
        TRAP(err, aProxy->GetEnumTraitL(
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    75
                 STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    76
                 STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    77
                 restartAttribute);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    78
            )
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    79
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    80
        TInt isActive;
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    81
        TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive);)
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    82
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    83
        if (isActive && (restartAttribute == KM2GRestartWhenNotActive))
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    84
        {
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    85
            M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    86
        }
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    87
        else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever))
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    88
        {
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    89
            // Cannot restart even if animation hasn't ended?
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    90
            M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute);
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
    91
        }
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    92
        else
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    93
        {
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    94
            M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    95
            TRAP(err,   aProxy->BeginElementAtL(
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    96
                     STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    97
                     STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    98
                     (aOffset+aCurrentTime));
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
    99
                )
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   100
        }
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   101
    }
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   102
    M2GGeneral::CheckErrorCode(aJni, err);
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   103
    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end");
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   104
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   105
}
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   106
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   107
// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   109
/**
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   110
 * Calls MM2GSVGProxy::EndElementAt method.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   111
 * @since Series S60 3.0
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   112
 * @param aProxy Proxy instance.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   113
 * @param aDocumentHandle Document handle
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   114
 * @param aElementHandle Element handle
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   115
 * @param aOffset Offset time
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   116
 */
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   117
JNIEXPORT void JNICALL
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   118
Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1endElementAt(
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   119
    JNIEnv* aJni,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   120
    jobject,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   121
    jint aSvgProxyHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   122
    jint aDocumentHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   123
    jint aElementHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   124
    jfloat aOffset)
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   125
{
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   126
    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin");
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   127
    TInt err = KM2GNotOk;
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   128
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   129
    MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   130
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   131
    TRAP(err,  aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   132
                                     STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   133
                                     aOffset);
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   134
        )
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   135
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   136
    M2GGeneral::CheckErrorCode(aJni, err);
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   137
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   138
    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end");
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   139
}
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   140
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   141
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   142
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   143
// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_isActive
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   144
// -----------------------------------------------------------------------------
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   145
/**
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   146
 * Calls MM2GSVGProxy::EndElementAt method.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   147
 * @since Series S60 3.0
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   148
 * @param aProxy Proxy instance.
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   149
 * @param aElementHandle Element handle
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   150
 */
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   151
JNIEXPORT jboolean JNICALL
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   152
Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1isActive(
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   153
    JNIEnv* aJni,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   154
    jobject,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   155
    jint aSvgProxyHandle,
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   156
    jint aElementHandle)
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   157
{
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   158
    M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin");
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   159
    TInt err = KM2GNotOk;
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   160
    TInt active = 0;
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   161
    MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   162
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   163
    TRAP(err, aProxy->IsActiveL(
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   164
             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   165
             active);
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   166
        )
87
1627c337e51e v2.2.21_1
hgs
parents: 80
diff changeset
   167
80
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   168
    M2GGeneral::CheckErrorCode(aJni, err);
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   169
    M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active);
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   170
    return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse));
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   171
}
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   172
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   173
M2G_NS_END
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   174
d6dafc5d983f v2.2.19_1
hgs
parents:
diff changeset
   175