|
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_M2GSVGAnimationElement.h" |
|
21 #include "MM2GSVGProxy.h" |
|
22 |
|
23 M2G_NS_START |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // LOCAL CONSTANTS AND MACROS |
|
34 |
|
35 // MODULE DATA STRUCTURES |
|
36 |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 // ================================ FUNCTIONS ================================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_beginElementAt |
|
47 // ----------------------------------------------------------------------------- |
|
48 /** |
|
49 * Calls MM2GSVGProxy::BeginElementAtL method. |
|
50 * @since Series S60 3.0 |
|
51 * @param aProxy Proxy instance. |
|
52 * @param aDocumentHandle Document handle |
|
53 * @param aElementHandle Element handle |
|
54 * @param aOffset Offset time |
|
55 * @throws Exception if not ok. |
|
56 */ |
|
57 JNIEXPORT void JNICALL |
|
58 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1beginElementAt( |
|
59 JNIEnv* aJni, |
|
60 jobject, |
|
61 jint aSvgProxyHandle, |
|
62 jint aDocumentHandle, |
|
63 jint aElementHandle, |
|
64 jfloat aOffset, |
|
65 jfloat aCurrentTime) |
|
66 { |
|
67 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin"); |
|
68 TInt err = KM2GNotOk; |
|
69 |
|
70 if (aSvgProxyHandle && aDocumentHandle) |
|
71 { |
|
72 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
73 TInt16 restartAttribute; |
|
74 |
|
75 TRAP(err, aProxy->GetEnumTraitL( |
|
76 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
77 STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute), |
|
78 restartAttribute); |
|
79 ) |
|
80 |
|
81 TInt isActive; |
|
82 TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive); ) |
|
83 |
|
84 if (isActive && (restartAttribute == KM2GRestartWhenNotActive)) |
|
85 { |
|
86 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute); |
|
87 } |
|
88 else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever)) |
|
89 { |
|
90 // Cannot restart even if animation hasn't ended? |
|
91 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute); |
|
92 } |
|
93 else |
|
94 { |
|
95 M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime); |
|
96 TRAP(err, aProxy->BeginElementAtL( |
|
97 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
98 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
99 (aOffset+aCurrentTime) ); |
|
100 ) |
|
101 } |
|
102 } |
|
103 M2GGeneral::CheckErrorCode(aJni, err); |
|
104 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end"); |
|
105 |
|
106 } |
|
107 // ----------------------------------------------------------------------------- |
|
108 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt |
|
109 // ----------------------------------------------------------------------------- |
|
110 /** |
|
111 * Calls MM2GSVGProxy::EndElementAt method. |
|
112 * @since Series S60 3.0 |
|
113 * @param aProxy Proxy instance. |
|
114 * @param aDocumentHandle Document handle |
|
115 * @param aElementHandle Element handle |
|
116 * @param aOffset Offset time |
|
117 */ |
|
118 JNIEXPORT void JNICALL |
|
119 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1endElementAt( |
|
120 JNIEnv* aJni, |
|
121 jobject, |
|
122 jint aSvgProxyHandle, |
|
123 jint aDocumentHandle, |
|
124 jint aElementHandle, |
|
125 jfloat aOffset) |
|
126 { |
|
127 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin"); |
|
128 TInt err = KM2GNotOk; |
|
129 |
|
130 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
131 |
|
132 TRAP(err, aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
133 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
134 aOffset); |
|
135 ) |
|
136 |
|
137 M2GGeneral::CheckErrorCode(aJni, err); |
|
138 |
|
139 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end"); |
|
140 } |
|
141 |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_isActive |
|
145 // ----------------------------------------------------------------------------- |
|
146 /** |
|
147 * Calls MM2GSVGProxy::EndElementAt method. |
|
148 * @since Series S60 3.0 |
|
149 * @param aProxy Proxy instance. |
|
150 * @param aElementHandle Element handle |
|
151 */ |
|
152 JNIEXPORT jboolean JNICALL |
|
153 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1isActive( |
|
154 JNIEnv* aJni, |
|
155 jobject, |
|
156 jint aSvgProxyHandle, |
|
157 jint aElementHandle) |
|
158 { |
|
159 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin"); |
|
160 TInt err = KM2GNotOk; |
|
161 TInt active = 0; |
|
162 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
163 |
|
164 TRAP(err, aProxy->IsActiveL( |
|
165 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
166 active); |
|
167 ) |
|
168 |
|
169 M2GGeneral::CheckErrorCode(aJni, err); |
|
170 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active); |
|
171 return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse)); |
|
172 } |
|
173 |
|
174 M2G_NS_END |
|
175 |
|
176 |