--- a/build/buildutils/svnchangeids.py Fri Jul 09 16:35:45 2010 +0300
+++ b/build/buildutils/svnchangeids.py Fri Jul 23 12:27:20 2010 +0300
@@ -59,6 +59,7 @@
re_change_id = re.compile("(\w+\#\d+)\s*,?", re.I | re.M)
re_change_id_keyword = re.compile(change_id_keyword + "[:=]?\s*(\w+\#\d+)",
re.I | re.M)
+ re_change_id_keyword_only = re.compile(change_id_keyword, re.I | re.M)
svn_change_ids = {}
cmd = "svn log -r " + rev_2 + ":" + rev_1 + " " + url
#print cmd
@@ -67,6 +68,11 @@
if rev:
current_rev = rev[0]
change_ids = re_change_id_keyword.findall(line)
+ change_id_keywords = re_change_id_keyword_only.findall(line)
+ if len(change_id_keywords) > len(change_ids):
+ print "WARNING: Rev " + current_rev + \
+ " has more matching changeid keywords" + \
+ " than matching change ids."
while change_ids:
for change_id in change_ids:
if change_id in svn_change_ids:
Binary file build/loc/resources_qt.jar has changed
--- a/build/makefile.javaversion Fri Jul 09 16:35:45 2010 +0300
+++ b/build/makefile.javaversion Fri Jul 23 12:27:20 2010 +0300
@@ -1,2 +1,2 @@
# Set Java version (must be dot separated, without spaces)
-JAVA_VERSION = 2.2.4
+JAVA_VERSION = 2.2.7
--- a/build/sis/java_3_1.pkg Fri Jul 09 16:35:45 2010 +0300
+++ b/build/sis/java_3_1.pkg Fri Jul 23 12:27:20 2010 +0300
@@ -50,6 +50,8 @@
"\epoc32\release\armv5\urel\javabackup.exe"-"c:\sys\bin\javabackup.exe"
"\epoc32\release\armv5\urel\javacaptain.exe"-"c:\sys\bin\javacaptain.exe"
"\epoc32\release\armv5\urel\javalauncher.exe"-"c:\sys\bin\javalauncher.exe"
+"\epoc32\release\armv5\urel\javaappscheme.exe"-"c:\sys\bin\javaappscheme.exe"
+"\epoc32\release\armv5\urel\javaqtrequest.exe"-"c:\sys\bin\javaqtrequest.exe"
"\epoc32\release\armv5\urel\javaupgradeapp.exe"-"c:\sys\bin\javaupgradeapp.exe"
;Odc file lists
@@ -165,7 +167,6 @@
; Misc dlls
-"\epoc32\release\armv5\urel\javaappschemeplugin.dll"-"c:\sys\bin\javaappschemeplugin.dll"
"\epoc32\release\armv5\urel\javabtl2capscplugin.dll"-"c:\sys\bin\javabtl2capscplugin.dll"
"\epoc32\release\armv5\urel\javabtsppscplugin.dll"-"c:\sys\bin\javabtsppscplugin.dll"
"\epoc32\release\armv5\urel\javabtgoepscplugin.dll"-"c:\sys\bin\javabtgoepscplugin.dll"
@@ -217,7 +218,6 @@
#endif
; resources
-"\epoc32\data\z\resource\plugins\javaappschemeplugin.rsc" -"c:\resource\plugins\javaappschemeplugin.rsc"
"\epoc32\winscw\c\private\102033E6\installer\inst_plugins.cfg"-"c:\private\102033E6\installer\inst_plugins.cfg"
"\epoc32\data\Z\Resource\versions\java.txt"-"c:\resource\versions\java.txt"
"\epoc32\data\z\resource\java\java_app_92.mif"-"c:\resource\java\java_app.mif"
--- a/inc/build_defines.hrh Fri Jul 09 16:35:45 2010 +0300
+++ b/inc/build_defines.hrh Fri Jul 23 12:27:20 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-#define RD_JAVA_VERSION 2,2,4
+#define RD_JAVA_VERSION 2,2,7
#define RD_JAVA_SYMBIAN_TARGET
#define RD_JAVA_S60_RELEASE_10_1
#define RD_JAVA_S60_RELEASE_10_1_ONWARDS
--- a/inc/java.txt Fri Jul 09 16:35:45 2010 +0300
+++ b/inc/java.txt Fri Jul 23 12:27:20 2010 +0300
@@ -1,1 +1,1 @@
-2.2.4
+2.2.7
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -409,10 +409,6 @@
checkConnection();
checkConnectionMode(Connector.WRITE);
- if (Connector.READ == iMode)
- {
- return false;
- }
return iFileUtility.canWrite();
}
--- a/javacommons/gcfprotocols/socket/socket/build/build.xml Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/build/build.xml Fri Jul 23 12:27:20 2010 +0300
@@ -41,7 +41,8 @@
<property name="javah.classnames"
value="com.nokia.mj.impl.socket.SocketConnectionImpl,
- com.nokia.mj.impl.socket.ServerSocketConnectionImpl"/>
+ com.nokia.mj.impl.socket.ServerSocketConnectionImpl,
+ com.nokia.mj.impl.properties.socket.SocketDynamicPropertyHandler"/>
<target name="create.internal.api.jar">
<omj.internal.apis includes="com/nokia/mj/impl/gcf/protocol/socket/Protocol.class,
@@ -54,6 +55,12 @@
<omj.public.apis includes="javax/microedition/io/SocketConnection.class,
javax/microedition/io/ServerSocketConnection.class"/>
</target>
+ <target name="system.properties">
+ <properties>
+ java.src.paths=${java.src.paths}
+ microedition.hostname=:socket.SocketDynamicPropertyHandler
+ </properties>
+ </target>
</project>
--- a/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h Fri Jul 23 12:27:20 2010 +0300
@@ -27,7 +27,7 @@
public:
OS_IMPORT static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType);
-
+ static char* getLocalHostName();
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/properties/socket/SocketDynamicPropertyHandler.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.properties.socket;
+
+import java.util.Hashtable;
+import java.io.IOException;
+import com.nokia.mj.impl.rt.support.Jvm;
+import com.nokia.mj.impl.rt.support.SystemPropertyProvider;
+import com.nokia.mj.impl.utils.Logger;
+
+public final class SocketDynamicPropertyHandler implements SystemPropertyProvider
+{
+ static
+ {
+ try
+ {
+ Jvm.loadSystemLibrary("javasocket");
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.ESOCKET, e.toString());
+ }
+ }
+
+ private static String SOCKET_LOCALHOST_NAME = "microedition.hostname";
+
+ private static final int LOCALHOST_NAME = 1;
+
+ private static Hashtable iPropertyKeys;
+
+ static
+ {
+ iPropertyKeys = new Hashtable();
+ iPropertyKeys.put(SOCKET_LOCALHOST_NAME, new Integer(
+ LOCALHOST_NAME));
+
+ }
+
+ /**
+ * Retrieves socket localhost system property.
+ *
+ * @param aKey
+ * The property to retrieve as defined in this class.
+ * @return The value of the property specified; null if the property is not
+ * defined
+ */
+ public String getProperty(String aKey)
+ {
+ String propertyValue = null;
+ String propertyName = aKey;
+
+ Object property = iPropertyKeys.get(propertyName);
+ if (null == property)
+ {
+ return "localhost";
+ }
+ propertyValue = _getLocalhostname();
+
+ return propertyValue;
+ }
+
+ public boolean isStatic(String aKey)
+ {
+ return true;
+ }
+
+ private static native String _getLocalhostname();
+}
--- a/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -22,7 +22,24 @@
#include "logger.h"
#include "connectionmanager.h"
+#define localhost_len 20
int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aApType);
+char* GetlocalHostNameL();
+
+char* SocketLocalHostInfo::getLocalHostName()
+{
+ char* localhostname =NULL;
+ TRAPD(err,localhostname = GetlocalHostNameL());
+ ILOG1(ESOCKET, "err %d ", err);
+ if (err != KErrNone)
+ {
+ localhostname = new char[localhost_len];
+ strcpy(localhostname,"localhost");
+ return localhostname;
+ }
+ else
+ return localhostname;
+}
OS_EXPORT int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr,
int aMidletIapId, int aApType)
@@ -190,3 +207,41 @@
}
+
+char* GetlocalHostNameL()
+{
+ TUint32 activeIapId = 0;
+
+ TConnectionInfoBuf connectionInfo;
+ TUint count = 0;
+ RSocketServ socketServ;
+ RSocket sock;
+ RConnection conn;
+
+ User::LeaveIfError(socketServ.Connect());
+ User::LeaveIfError(sock.Open(socketServ, KAfInet, KSockStream,
+ KProtocolInetTcp));
+ User::LeaveIfError(conn.Open(socketServ));
+ User::LeaveIfError(conn.EnumerateConnections(count));
+
+ char* localhost = new char[localhost_len];
+
+ if (count <= 0)
+ {
+ strcpy(localhost,"localhost");
+ }
+ else
+ {
+
+ User::LeaveIfError(conn.GetConnectionInfo(1, connectionInfo));
+ activeIapId = connectionInfo().iIapId;
+ getIPAddressL(activeIapId,localhost);
+ }
+
+ conn.Close();
+ sock.Close();
+ socketServ.Close();
+
+ return localhost;
+}
+
--- a/javacommons/gcfprotocols/socket/socket/src/socketconnectionjni.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src/socketconnectionjni.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -17,8 +17,10 @@
#include "com_nokia_mj_impl_socket_SocketConnectionImpl.h"
+#include "com_nokia_mj_impl_properties_socket_SocketDynamicPropertyHandler.h"
#include "nativesocketconnection.h"
-
+#include "socketlocalhostinfo.h"
+#include "logger.h"
using namespace java;
@@ -141,3 +143,13 @@
NativeSocketConnection* nativeConn = reinterpret_cast<NativeSocketConnection* >(aNativePeerHandle);
delete nativeConn;
}
+
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_properties_socket_SocketDynamicPropertyHandler__1getLocalhostname
+(JNIEnv *aJni, jclass)
+{
+ char* addr;
+ addr = SocketLocalHostInfo::getLocalHostName();
+ jstring jnistring = aJni->NewStringUTF(addr);
+ delete[] addr;
+ return jnistring;
+}
--- a/javacommons/security/src.s60/telutils.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/security/src.s60/telutils.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -63,6 +63,31 @@
}
}
+signed int TelUtils::getSecureTime()
+{
+ TTime t;
+ if (t.UniversalTimeSecure())
+ {
+ t.UniversalTime();
+ }
+ TTimeIntervalSeconds sec;
+ TTime baseTime(MAKE_TINT64(0x00dcddb3 ,0x0f2f8000)); // 1st Jan 1970
+ t.SecondsFrom(baseTime, sec);
+ return sec.Int();
+}
+
+/**
+ * Return 0 if secure time has not been set
+ */
+int TelUtils::isSecureTimeSet()
+{
+ TTime t;
+ if (KErrNoSecureTime == t.UniversalTimeSecure())
+ {
+ return 0;
+ }
+ return 1;
+}
void TelUtils::ConstructL()
{
--- a/javacommons/security/src.s60/telutils.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/security/src.s60/telutils.h Fri Jul 23 12:27:20 2010 +0300
@@ -35,6 +35,8 @@
static TelUtils* createInstance();
void getNetworkCodes(std::string& mnc, std::string& mcc);
void getImei(std::string& imei);
+ static signed int getSecureTime();
+ static int isSecureTimeSet();
virtual ~TelUtils();
private: //Methods
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -472,7 +472,21 @@
if (X509_verify_cert(x509_ctx) != 1)
{
ret_code = getErrCode(X509_STORE_CTX_get_error(x509_ctx));
- break;
+ // If the secure time of the device has not yet been set
+ // (can happen some times during the first device boot),
+ // allow installing with not yet valid certificates
+ if (KCertNotYetValidFailure == ret_code)
+ {
+ if (!TelUtils::isSecureTimeSet())
+ {
+ ret_code = KCertAndSignatureOk;
+ }
+ }
+
+ if (KCertAndSignatureOk != ret_code)
+ {
+ break;
+ }
}
// verify the extended key usage: it must point to id-kp-codeSigning (RFC3280 code signing)
// or 1.3.6.1.4.1.94.1.49.1.2.2.3 (Nokia Java Code Signing Extension)
--- a/javacommons/utils/inc/logger.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/utils/inc/logger.h Fri Jul 23 12:27:20 2010 +0300
@@ -115,8 +115,9 @@
EDebugApi, // =34
EJavaAppMngrPlugin, // =35
EJavaBroadcast, // =36
- EJavaAMMS, // =37
- EJavaSettings, // =38
+ EJavaAMMS, // =37
+ EJavaSettings, // =38
+ EJavaQtServiceApp, // =39
// add id of new components here
};
@@ -173,8 +174,9 @@
{"JavaDebugApi.log", "[JavaDebugApi]"}, // EDebugApi
{"JavaAppMngrPlugin.log","[JavaAppMngrPlugin]"}, // EJavaAppMngrPlugin
{"JavaBroadcast.log", "[JavaBroadcast]"}, // EJavaBroadcast
- {"JavaMMAPI.log", "[ MMAPPI ]"}, // EJavaAMMS
- {"JavaSettings.log", "[ JavaSettings ]"}, // EJavaSettings
+ {"JavaMMAPI.log", "[ MMAPPI ]"}, // EJavaAMMS
+ {"JavaSettings.log", "[ JavaSettings ]"}, // EJavaSettings
+ {"JavaQtServiceApp.log", "[ QtServiceApp ]"}, // EJavaQtServiceApp
// add new component file name and nickname here
};
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Fri Jul 23 12:27:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -28,6 +28,7 @@
* <UL>
* <LI>%nU - String in position n
* <LI>%U - Next string
+ * <LI>%Ln - Integer in position n
* <LI>%nN - Integer in position n
* <LI>%N - Next integer
* <LI>%nC - Character in position n
@@ -60,7 +61,7 @@
private String replaced;
/** Next replacement index */
- private int nextIndex = 0;
+ private int nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1);
/*** ----------------------------- PUBLIC ------------------------------ */
@@ -69,7 +70,7 @@
*
* @param pattern formatter pattern
*/
- public Formatter(String aPattern)
+ Formatter(String aPattern)
{
pattern = aPattern;
replaced = aPattern;
@@ -90,11 +91,12 @@
replace("%U", string))
{
nextIndex++;
-
}
else
{
- Logger.WLOG(Logger.EUtils, "String replacement failed");
+ Logger.WLOG(Logger.EUtils,
+ "String replacement failed on parameter " +
+ nextIndex + ": " + pattern);
}
return this;
}
@@ -110,8 +112,9 @@
{
String localisedNumber = _formatInteger(number);
- // Try to replace with patterns %nN, %n, %N
- if (replace("%" + nextIndex + "N", localisedNumber) ||
+ // Try to replace with patterns %Ln, %nN, %n, %N
+ if (replace("%" + "L" + nextIndex, localisedNumber) ||
+ replace("%" + nextIndex + "N", localisedNumber) ||
replace("%" + nextIndex, localisedNumber) ||
replace("%N", localisedNumber))
{
@@ -120,7 +123,9 @@
}
else
{
- Logger.WLOG(Logger.EUtils, "Integer replacement failed");
+ Logger.WLOG(Logger.EUtils,
+ "Integer replacement failed on parameter " +
+ nextIndex + ": " + pattern);
}
return this;
}
@@ -146,7 +151,9 @@
}
else
{
- Logger.WLOG(Logger.EUtils, "Character replacement failed");
+ Logger.WLOG(Logger.EUtils,
+ "Character replacement failed on parameter " +
+ nextIndex + ": " + pattern);
}
return this;
}
@@ -208,7 +215,7 @@
// Reset for next usage
replaced = pattern;
- nextIndex = 0;
+ nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1);
return result;
}
@@ -260,6 +267,18 @@
}
return toString();
}
+ /**
+ * Applies convertion from european digits into arabic-indic digits
+ * based on existing language settings
+ *
+ * @param str String which might contain european digits
+ * @return A string identical with the provided string but with the
+ * european digits (if any) converted to arabic-indic digits
+ */
+ public static String formatDigits(String str)
+ {
+ return _formatDigits(str);
+ }
/*** ----------------------------- PRIVATE ---------------------------- */
@@ -358,4 +377,14 @@
*
*/
private native String _formatDate(long timeInMilliSecs);
+
+ /**
+ * Applies convertion from european digits into arabic-indic digits
+ * based on existing language settings
+ *
+ * @param str String which might contain european digits
+ * @return A string identical with the provided string but with the
+ * european digits (if any) converted to arabic-indic digits
+ */
+ private static native String _formatDigits(String str);
}
--- a/javaextensions/satsa/build/javasatsa.pro Fri Jul 09 16:35:45 2010 +0300
+++ b/javaextensions/satsa/build/javasatsa.pro Fri Jul 23 12:27:20 2010 +0300
@@ -16,8 +16,8 @@
TARGET=javasatsa
TEMPLATE=lib
-CONFIG += hb omj java stl
-# CONFIG -= qt
+CONFIG += omj java stl
+CONFIG -= qt
symbian {
INCLUDEPATH += ../framework/inc \
@@ -35,8 +35,6 @@
LIBS += -ljavastorage \
- -lHbCore \
- -lHbWidgets \
-lCommonUI \
-lrandom \
-lx509 \
--- a/javaextensions/satsa/pki/src.s60/cstssignatureservice.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstssignatureservice.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -31,6 +31,10 @@
#include <CCMSEncapsulatedContentInfo.h>
#include <CCMSSignedData.h>
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <PKIDlg.h>
+#endif
+
#include "cstsseprompt.h"
#include <hash.h>
@@ -40,9 +44,6 @@
#include "logger.h"
#include "jstringutils.h"
-#include <hbdevicemessageboxsymbian.h>
-#include <hbpopup.h>
-
const TInt KDefaultGranularity = 1;
@@ -81,7 +82,12 @@
{
iDialog->Release(); // Release deletes the object
}
-
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ if (iPKIDialog)
+ {
+ iPKIDialog->Release();
+ }
+#endif
iCertificateArray.Close();
iCertInfos.Close();
delete iFilter;
@@ -274,34 +280,9 @@
{
iState = EFinalNote;
iStatus = KErrNone;
-
- // Using Orbit API
- CHbDeviceMessageBoxSymbian* messageBox
- = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
- CleanupStack::PushL(messageBox);
-
- _LIT(KQuestion, "Do you want to sign the data?");
- messageBox->SetTextL(KQuestion);
- messageBox->SetTimeout(HbPopup::NoTimeout);
-
- // Read localised versions instead of hard coded values.
- _LIT(KAllowButtonText, "Allow");
- _LIT(KDenyButtonText, "Deny");
-
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
-
- // by default the answer is Allow
- if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton)
- {
-
- }
-
- messageBox->Close();
- CleanupStack::PopAndDestroy(messageBox);
-
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->Note(MPKIDialog::ESigningCancelled, iStatus);
+#endif
SetActive();
}
else
@@ -504,7 +485,9 @@
{
User::LeaveIfError(iFileServer.Connect());
iDialog = SecurityDialogFactory::CreateL();
-
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog = PKIDialogFactory::CreateNoteL();
+#endif
iFilter = CCertAttributeFilter::NewL();
iWait = new(ELeave) CActiveSchedulerWait;
@@ -651,60 +634,18 @@
{
case EAuthWithoutText:
{
- // Use Orbit API
- CHbDeviceMessageBoxSymbian* messageBox
- = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
- CleanupStack::PushL(messageBox);
-
- _LIT(KQuestion, "Do you want to sign the data?");
- messageBox->SetTextL(KQuestion);
- messageBox->SetTimeout(HbPopup::NoTimeout);
-
- // Read localised versions instead of hard coded values.
- _LIT(KAllowButtonText, "Allow");
- _LIT(KDenyButtonText, "Deny");
-
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
-
- // by default the answer is Allow
- if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton)
- {
-
- }
- messageBox->Close();
- CleanupStack::PopAndDestroy(messageBox);
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->UserAuthentication(iCertificateArray, iCertificateHandle,
+ iStatus);
+#endif
break;
}
case EAuthWithText:
{
- // Use Orbit API
- CHbDeviceMessageBoxSymbian* messageBox
- = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
- CleanupStack::PushL(messageBox);
-
- _LIT(KQuestion, "Do you want to sign the data?");
- messageBox->SetTextL(KQuestion);
- messageBox->SetTimeout(HbPopup::NoTimeout);
-
- // Read localised versions instead of hard coded values.
- _LIT(KAllowButtonText, "Allow");
- _LIT(KDenyButtonText, "Deny");
-
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
-
- // by default the answer is Allow
- if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton)
- {
-
- }
- messageBox->Close();
- CleanupStack::PopAndDestroy(messageBox);
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->UserAuthenticationText(*iTextToDisplay, iCertificateArray,
+ iCertificateHandle, iStatus);
+#endif
break;
}
case ESignWithText:
@@ -991,32 +932,9 @@
if (iShowNotes)
{
iState = EFinalNote;
-
- //proper string for user prompt
- CHbDeviceMessageBoxSymbian* messageBox
- = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
- CleanupStack::PushL(messageBox);
-
- _LIT(KQuestion, "Do you want to sign the data?");
- messageBox->SetTextL(KQuestion);
- messageBox->SetTimeout(HbPopup::NoTimeout);
-
- // Read localised versions instead of hard coded values.
- _LIT(KAllowButtonText, "Allow");
- _LIT(KDenyButtonText, "Deny");
-
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
- messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
- messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
-
- // by default the answer is Allow
- if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton)
- {
-
- }
- messageBox->Close();
- CleanupStack::PopAndDestroy(messageBox);
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ iPKIDialog->Note(MPKIDialog::ESignatureDone, iStatus);
+#endif
SetActive();
}
else
--- a/javaextensions/satsa/pki/src.s60/cstssignatureservice.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstssignatureservice.h Fri Jul 23 12:27:20 2010 +0300
@@ -20,8 +20,6 @@
#define CSTSSIGNATURESERVICE_H
-#include "javaosheaders.h"
-#include <vector>
#include <e32base.h>
#include <badesca.h>
@@ -30,6 +28,9 @@
// FORWARD DECLARATIONS
class MSecurityDialog;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+class MPKIDialog;
+#endif
class CUnifiedCertStore;
class CUnifiedKeyStore;
class CCTCertInfo;
@@ -264,6 +265,11 @@
// security dialog, owned
MSecurityDialog* iDialog;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ // PKI Dialog, owned
+ MPKIDialog* iPKIDialog;
+#endif
+
// certificate store, owned
CUnifiedCertStore* iCertStore;
--- a/javaextensions/sensor/src.s60/cacceleratorsensorrawdata.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javaextensions/sensor/src.s60/cacceleratorsensorrawdata.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -97,6 +97,18 @@
TSensrvProperty property;
TInt intValue(0);
GetProperty(aList, KSensrvPropIdScaledRange,KSensrvItemIndexNone, property);
+
+ if ((property.GetArrayIndex() == ESensrvArrayPropertyInfo)&&
+ (property.PropertyType() == ESensrvIntProperty))
+ {
+ // Read index
+ TInt rangeIndex = 0;
+
+ // Read actual property data from array
+ GetProperty(aList, KSensrvPropIdScaledRange,
+ KSensrvItemIndexNone, rangeIndex, property);
+ }
+
if (property.PropertyType() == ESensrvIntProperty)
{
aPtr->Append(KMeasureRangeCount);
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/smscbs/utils/WmaUrl.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/smscbs/utils/WmaUrl.java Fri Jul 23 12:27:20 2010 +0300
@@ -95,7 +95,7 @@
int index = iAbsoluteUri.indexOf("://");
int nameLength = iAbsoluteUri.length();
if ((index == -1) || (index != iAbsoluteUri.indexOf(':'))
- || ((index + 3) > nameLength))
+ || ((index + 3) >= nameLength))
{
throw new IllegalArgumentException(INVALID_URL.concat(iAbsoluteUri));
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/build/javaappscheme.pro Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: QT Service application the implements support for
+# starting Java applications using "javaapp:" QUrl
+#
+
+TEMPLATE=app
+TARGET=javaappscheme
+CONFIG += omj no_icon stl service
+CONFIG -= gui
+
+symbian {
+ TARGET.UID3 = 0x200315F0
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -lxqservice -lxqserviceutil
+}
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+HEADERS=../src.s60/serviceapp.h
+
+include(../../../build/omj.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/build/service_conf.xml Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+ <name>javaappscheme</name>
+ <filepath>No path</filepath>
+ <description>Launch Java app service</description>
+ <interface>
+ <name>com.nokia.symbian.IUriView</name>
+ <version>1.0</version>
+ <description>Interface for showing URIs</description>
+ <customproperty key="schemes">javaapp</customproperty>
+ <customproperty key="deprecatedsn">com.nokia.services.serviceapp</customproperty>
+ </interface>
+</service>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/main.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the implements support for
+* starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QTimer>
+
+#include "logger.h"
+#include "serviceapp.h"
+
+
+int main(int argc, char **argv)
+{
+ LOG1(EJavaQtServiceApp, EInfo, "javaappscheme main() called with %d args", argc);
+ for (int nInd = 0; nInd < argc; nInd++)
+ {
+ LOG2(EJavaQtServiceApp, EInfo, "javaappscheme main() arg %d is %s", nInd, *(argv + nInd));
+ }
+
+ ServiceApp app(argc, argv);
+
+ // Close this service app after 14 seconds if no one has called us
+ QTimer::singleShot(14 * 1000, &app, SLOT(quit()));
+
+ int ret = app.exec();
+
+ LOG1(EJavaQtServiceApp, EInfo, "javaappscheme main() exiting with value %d", ret);
+
+ return ret;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/serviceapp.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the implements support for
+* starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QUrl>
+
+#include "logger.h"
+
+#include "serviceapp.h"
+#include <xqserviceutil.h>
+
+
+ServiceApp::ServiceApp(int &argc, char **argv)
+ : QApplication(argc, argv), mUriService(NULL)
+{
+ LOG(EJavaQtServiceApp, EInfo, "ServiceApp (QApplication) constructor called");
+ bool isService = XQServiceUtil::isService();
+ if (isService)
+ {
+ mUriService = new UriService(this);
+ }
+
+ QString interface = XQServiceUtil::interfaceName();
+ QString operation = XQServiceUtil::operationName();
+
+ QString t = "SERVICEAPP:\n";
+ t = t + (isService ? " Service launch\n" : " Normal launch\n");
+ t = t + (XQServiceUtil::isEmbedded() ? " Embedded\n" : " Not embedded\n");
+ t = t + (" Interface=" + interface + "\n");
+ t = t + (" Operation=" + operation + "\n");
+
+ std::string callType = t.toStdString();
+ LOG1(EJavaQtServiceApp, EInfo, "ServiceApp called as %s", callType.c_str());
+}
+
+ServiceApp::~ServiceApp()
+{
+ LOG(EJavaQtServiceApp, EInfo, "ServiceApp destructor called");
+ delete mUriService;
+}
+
+void ServiceApp::quit()
+{
+ LOG(EJavaQtServiceApp, EInfo, "ServiceApp quit() called");
+}
+
+
+// ----------UriService---------------
+
+// The service string param given to XQServiceProvider must contain first
+// the name of the name of the service and then the name of the interface
+// (from service_conf.xml)
+UriService::UriService(ServiceApp* parent)
+: XQServiceProvider(QLatin1String("javaappscheme.com.nokia.symbian.IUriView"),parent),
+ mServiceApp(parent)
+{
+ LOG(EJavaQtServiceApp, EInfo, "UriService::UriService called");
+ publishAll();
+}
+
+UriService::~UriService()
+{
+ LOG(EJavaQtServiceApp, EInfo, "UriService::~UriService called");
+}
+
+bool UriService::view(const QString& uri)
+{
+ LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri) called");
+ return view(uri, true);
+}
+
+bool UriService::view(const QString& uri, bool retValue)
+{
+ LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri, retValue) called");
+ std::wstring stdWStrUri = uri.toStdWString();
+ LOG1(EJavaQtServiceApp, EInfo, "url is %S", stdWStrUri.c_str());
+ if (retValue)
+ {
+ LOG(EJavaQtServiceApp, EInfo, "UriService::view retValue parameter is true");
+ }
+
+ XQRequestInfo info = requestInfo();
+ bool asyncAnswer = !info.isSynchronous();
+
+ // Start javalauncher.exe and pass the Url to it
+ _LIT(KJavaLauncherExe, "javalauncher.exe");
+ RProcess rProcess;
+ retValue = true;
+
+ // start
+ HBufC* bufUri = HBufC::New(stdWStrUri.size());
+ if (0 == bufUri)
+ {
+ return false;
+ }
+ TPtr16 ptrUri(bufUri->Des());
+ ptrUri.Append((const TUint16*)stdWStrUri.c_str(), stdWStrUri.size());
+
+ TInt err = rProcess.Create(KJavaLauncherExe, ptrUri);
+ if (KErrNone == err)
+ {
+ // This call will wait until javalauncher exits (or panics)
+ TRequestStatus status;
+ rProcess.Logon(status);
+ rProcess.Resume();
+
+ // now wait until javalauncher exits
+ User::WaitForRequest(status);
+ err = status.Int();
+ if (err != KErrNone)
+ {
+ ELOG1(EJavaQtServiceApp,
+ "UriService::view javalauncher exited with error %d", err);
+ retValue = false;
+ }
+ }
+ else
+ {
+ ELOG1(EJavaQtServiceApp,
+ "UriService::view Cannot create javalauncher process, error %d", err);
+ retValue = false;
+ }
+
+ // free resources before returning
+ rProcess.Close();
+ delete bufUri;
+
+ if (KErrNone != err)
+ {
+#ifndef _DEBUG
+ // Make sure Url is logged always if an error has happened
+ ELOG1(EJavaQtServiceApp, "UriService::view url was %S", stdWStrUri.c_str());
+#endif
+ retValue = false;
+ }
+
+ return retValue;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/serviceapp.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the implements support for
+* starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#ifndef JAVAQTSERVICEAPP_H
+#define JAVAQTSERVICEAPP_H
+
+
+// #include <QCoreApplication>
+#include <QApplication>
+#include <xqserviceprovider.h>
+
+
+class UriService;
+
+class ServiceApp : public QApplication // public QCoreApplication
+{
+ Q_OBJECT
+
+public:
+ ServiceApp(int &argc, char **argv);
+ ~ServiceApp();
+
+// TEMP TEST
+public slots:
+ static void quit();
+
+private:
+ UriService* mUriService;
+};
+
+
+class UriService : public XQServiceProvider
+{
+ Q_OBJECT
+ public:
+ UriService( ServiceApp *parent = 0 );
+ ~UriService();
+
+ public slots:
+ bool view(const QString& uri);
+ bool view(const QString& uri, bool returnValue);
+
+ private:
+ ServiceApp* mServiceApp;
+};
+
+
+#endif // JAVAQTSERVICEAPP_H
--- a/javamanager/javaappschemeplugin/build/bld.inf Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* Build information for the Java 2.x javaapp: scheme handler plugin
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-javaappschemeplugin.mmp
-
-
-
--- a/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is an ECOM plugin for Scheme Handler that handles
-* "javaapp:" URI scheme
-*/
-
-#include <platform_paths.hrh>
-#include <../../../inc/project_defines.hrh>
-#include <../../../inc/build_defines.hrh>
-
-TARGET javaappschemeplugin.dll
-TARGETTYPE plugin
-UID 0x10009D8D 0x2002875F
-
-// Use bytepair compression to enable code paging
-PAGED
-
-APP_LAYER_SYSTEMINCLUDE
-
-#ifndef RD_JAVA_S60_RELEASE_9_2
-SYSTEMINCLUDE /epoc32/include/ecom // Due to SchemeHandler.inl in 5.0 2009w18 and 10.1 builds
-#endif
-
-SOURCEPATH ../src
-
-SOURCE javaapphandler.cpp
-SOURCE proxy.cpp
-
-START RESOURCE ../data/2002875F.rss
-TARGET javaappschemeplugin.rsc
-END
-
-USERINCLUDE ../inc
-
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY apparc.lib
-LIBRARY flogger.lib
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
--- a/javamanager/javaappschemeplugin/data/2002875F.rss Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECOM resource definition for Java javaapp:
-* scheme handler plugin. Implements CSchemeHandler interface
-*
-*/
-
-// INCLUDES
-#include <ecom/registryinfov2.rh>
-
-// RESOURCE DEFINITIONS
-
-RESOURCE REGISTRY_INFO theInfo
- {
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
- // UID for the DLL, KJavaAppHandlerDllUid
- dll_uid = 0x2002875F;
-
- // Interface info array
- interfaces =
- {
- INTERFACE_INFO
- {
- // UID of the implemented interface
- interface_uid = 0x101f8534;
-
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- // KJavaLocalAppHandlerEcomImplUid
- implementation_uid = 0x20028767;
- version_no = 1;
- display_name = "URL handler for javaapp scheme";
- default_data = "javaapp";
- opaque_data = "";
- rom_only = 0;
- }
- };
- }
- };
- }
--- a/javamanager/javaappschemeplugin/inc/javaapphandler.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of Scheme handler interface implementation for
-* "javaapp:" URI scheme
-*
-*/
-
-#ifndef JAVAAPPHANDLER_H
-#define JAVAAPPHANDLER_H
-
-// INCLUDES
-
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <SchemeHandler.h>
-#else
-#include <schemehandler.h>
-#endif
-
-#include <e32base.h>
-
-
-namespace java
-{
-
-namespace javaapphandler
-{
-
-/**
-* Scheme Handler IF implementation class for javaapp: uri scheme
-*
-*/
-NONSHARABLE_CLASS(CJavaAppHandler) : public CSchemeHandler
-{
-
-public: // Constructors and destructor
-
- /**
- * Two phased constructor. Leaves on failure.
- * @param - aUrl
- * @return The created object.
- */
- static CJavaAppHandler* NewL(const TDesC& aUrl);
-
- /**
- * Destructor.
- */
- virtual ~CJavaAppHandler();
-
-private: // Constructors
-
- /**
- * Constructor.
- */
- CJavaAppHandler();
-
- /**
- * Second phase constructor. Leaves on failure.
- * @param - aUrl
- */
- void ConstructL(const TDesC& aUrl);
-
-public:
-
- /**
- * Url Handler with embedding.
- * All applications are always started standalone.
- * @param -
- */
- void HandleUrlEmbeddedL();
-
- /**
- * Url Handler without embedding
- * @param -
- */
- void HandleUrlStandaloneL();
-
- /**
- * Observer is not supported. Does nothing.
- * @param - aSchemeDoc
- */
- void Observer(MAknServerAppExitObserver* aSchemeDoc);
-
-protected: // Data
-
- // Results of parsing
- HBufC* mParsedUrl; ///< Owned.
-};
-
-} // javaapphandler
-
-} // java
-
-#endif // JAVAAPPHANDLER_H
--- a/javamanager/javaappschemeplugin/src/javaapphandler.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of Scheme handler interface implementation
-* for localapp://jam/launch scheme
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <escapeutils.h>
-#include <apgcli.h>
-#include <eikproc.h>
-#include <apacmdln.h>
-#include <e32const.h>
-#include <flogger.h>
-
-#include "javaapphandler.h"
-
-using namespace java;
-
-namespace java
-{
-
-namespace javaapphandler
-{
-
-// ================= CONSTANTS =======================
-
-_LIT(KJavaLogDir, "java\\full");
-_LIT(KJavaLogFile, "JavaUtils.log");
-
-// ================= MACROS =======================
-
-// Define logging macros here to remove dependencies to Java 2.0 libraries.
-#define LOG(str) { TBuf8<1024> f((const TUint8 *)str); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f); }
-#define LOG1(str, a) { TBuf8<1024> f((const TUint8 *)str); RFileLogger::WriteFormat(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f, a); }
-#define LOG1WSTR(str, wstr) { TBuf8<1024> f((const TUint8 *)str); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f); TBuf16<KLogBufferSize> w((const TUint16 *)wstr); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, w); }
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// ---------------------------------------------------------
-// CJavaAppHandler::CJavaAppHandler()
-// ---------------------------------------------------------
-//
-CJavaAppHandler::CJavaAppHandler()
- : CSchemeHandler()
-{
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::ConstructL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::ConstructL(const TDesC& aUrl)
-{
- mParsedUrl = aUrl.AllocL();
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::Observer()
-// ---------------------------------------------------------
-//
-
-void CJavaAppHandler::Observer(MAknServerAppExitObserver* /* aSchemeDoc */)
-{
- // do nothing
-}
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CJavaAppHandler::NewL()
-// ---------------------------------------------------------
-//
-CJavaAppHandler* CJavaAppHandler::NewL(const TDesC& aUrl)
-{
- CJavaAppHandler* self=new(ELeave) CJavaAppHandler();
- CleanupStack::PushL(self);
- self->ConstructL(aUrl);
- CleanupStack::Pop(self);
-
- return self;
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::~CJavaAppHandler()
-// ---------------------------------------------------------
-//
-CJavaAppHandler::~CJavaAppHandler()
-{
- delete mParsedUrl;
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::HandleUrlEmbeddedL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::HandleUrlEmbeddedL()
-{
- HandleUrlStandaloneL();
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::HandleUrlStandaloneL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::HandleUrlStandaloneL()
-{
-
-
- // Start javalauncher.exe and pass the Url to it
- _LIT(KJavaLauncherExe, "javalauncher.exe");
- RProcess rProcess;
-
- // start
- TInt err = rProcess.Create(KJavaLauncherExe, *mParsedUrl);
- if (KErrNone == err)
- {
- // This call will wait until javalauncher exits (or panics)
- TRequestStatus status;
- rProcess.Logon(status);
- rProcess.Resume();
-
- // now wait until javalauncher exits
- User::WaitForRequest(status);
- err = status.Int();
- if (err != KErrNone)
- {
- LOG1("javaapphandler: javalauncher exited with error %d", err);
- }
- }
- else
- {
- LOG1("javaapphandler: Cannot create javalauncher process, error %d", err);
- }
-
- // free resources before returning
- rProcess.Close();
-
- if (KErrNone != err)
- {
-#ifndef _DEBUG
- // Make sure Url is logged always if an error has happened
- TBuf<255> logBuf = mParsedUrl->Left(250);
- LOG1WSTR("javaapphandler: command line starts with : %s", (TUint16 *)(logBuf.PtrZ()));
-#endif
- User::Leave(err);
- }
-}
-
-} // namespace javaapphandler
-} // namespace java
--- a/javamanager/javaappschemeplugin/src/proxy.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements interface that exports ECOM implementation
-* factories within this .dll
-*/
-
-
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "javaapphandler.h"
-
-// CONSTANTS
-const TImplementationProxy KImplementationTable[] =
- { IMPLEMENTATION_PROXY_ENTRY(0x20028767,
- java::javaapphandler::CJavaAppHandler::NewL)
- };
-
-// -----------------------------------------------------------------------------
-// ImplementationGroupProxy
-// Returns the implementations in this DLL
-// Returns: The ECOM implementations in this DLL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
- aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
- return KImplementationTable;
-}
-
-// End of File
--- a/javamanager/javainstaller/installer/build/build.xml Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/build/build.xml Fri Jul 23 12:27:20 2010 +0300
@@ -74,6 +74,7 @@
value="com.nokia.mj.impl.installer.utils.SysUtil,
com.nokia.mj.impl.installer.utils.FileRoots,
com.nokia.mj.impl.installer.utils.FileWriter,
+ com.nokia.mj.impl.installer.utils.PropertyProvider,
com.nokia.mj.impl.installer.jadjarmatcher.JadJarMatcher,
com.nokia.mj.impl.installer.applicationregistrator.ApplicationRegistrator,
com.nokia.mj.impl.installer.applicationregistrator.SifNotifier,
--- a/javamanager/javainstaller/installer/build/javainstaller.pro Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/build/javainstaller.pro Fri Jul 23 12:27:20 2010 +0300
@@ -49,6 +49,8 @@
../src.s60/jadjarmatcher/jadjarmatcherscanfrominbox.cpp \
../src.s60/utils/filewriter.cpp \
../src.s60/utils/fileroots.cpp \
+ ../src.s60/utils/propertylistener.cpp \
+ ../src.s60/utils/propertyprovider.cpp \
../src.s60/utils/sysutil.cpp
LIBS += -lapgrfx -lbafl -lcentralrepository -lcharconv -lefsrv -lestor \
@@ -69,6 +71,9 @@
"$${LITERAL_HASH}include <bldvariant.hrh>" \
"$${LITERAL_HASH}ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK" \
"LIBRARY scrclient.lib" \
+ "$${LITERAL_HASH}else" \
+ "LIBRARY ecom.lib" \
+ "LIBRARY SWInstTaskManager.lib" \
"$${LITERAL_HASH}endif"
} else {
CONFIG += omj java javaonly stl
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Fri Jul 23 12:27:20 2010 +0300
@@ -18,6 +18,7 @@
package com.nokia.mj.impl.installer.applicationregistrator;
+import com.nokia.mj.impl.installer.storagehandler.SuiteInfo;
import com.nokia.mj.impl.installer.utils.InstallerException;
import com.nokia.mj.impl.installer.utils.FileRoots;
import com.nokia.mj.impl.installer.utils.FileUtils;
@@ -439,8 +440,50 @@
return;
}
+ /**
+ * Adds an entry to platform installation log.
+ *
+ * @param aSuite application suite information
+ * @param aAction 0 - installation, 1 - uninstallation
+ */
+ public static void addInstallLogEntry(SuiteInfo aSuite, int aAction)
+ {
+ // In S60 the version number is restricted to limited range.
+ // If version number is outside of this range, use version
+ // number 0 instead.
+ int result = _addInstallLogEntry(
+ aAction, PlatformUid.getIntValue(aSuite.getUid()),
+ aSuite.getName(), aSuite.getVendor(),
+ getVersion(aSuite.getVersion().getMajor(), 0, 127),
+ getVersion(aSuite.getVersion().getMinor(), 0, 99),
+ getVersion(aSuite.getVersion().getMicro(), 0, 32767));
+ if (result < 0)
+ {
+ Log.logError("Adding installation log entry failed, err=" + result);
+ }
+ else
+ {
+ Log.log("Added installation log entry");
+ }
+ }
+
/*** ----------------------------- PACKAGE ---------------------------- */
/*** ----------------------------- PRIVATE ---------------------------- */
+
+ /**
+ * Checks that given version number is between specified minimum and
+ * maximum value range (inclusive) and if it is returns version number.
+ * If version number is out of given range, returns 0.
+ */
+ private static int getVersion(int aVersion, int aMin, int aMax)
+ {
+ if (aVersion >= aMin && aVersion <= aMax)
+ {
+ return aVersion;
+ }
+ return 0;
+ }
+
/*** ----------------------------- NATIVE ----------------------------- */
/**
@@ -581,4 +624,20 @@
* @return true if Symbian 9.2 emulator environment
*/
private static native boolean _runningIn92Emulator();
+
+ /**
+ * Adds an entry to platform installation log.
+ *
+ * @param aAction 0 - installation, 1 - uninstallation
+ * @param aUid application suite uid
+ * @param aName application suite name
+ * @param aVendor application suite vendor
+ * @param aMajorVersion application suite major version
+ * @param aMinorVersion application suite minor version
+ * @param aMicroVersion application suite micro version
+ * @return Symbian error code (negative number) if fails, otherwise 0
+ */
+ private static native int _addInstallLogEntry(
+ int aAction, int aUid, String aName, String aVendor,
+ int aMajorVersion, int aMinorVersion, int aMicroVersion);
}
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/FileRoots.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/FileRoots.java Fri Jul 23 12:27:20 2010 +0300
@@ -62,7 +62,16 @@
*/
public static String getRegisteredIconDir(int aDrive)
{
- return FileUtils.getDriveName(aDrive) + ":\\data\\java\\";
+ String result = getAppsRoot();
+ result = FileUtils.setDrive(result, aDrive);
+ String replace = "\\private\\";
+ int i = result.indexOf(replace);
+ if (i == -1)
+ {
+ return FileUtils.getDriveName(aDrive) + ":\\data\\java\\";
+ }
+ return result.substring(0, i) + "\\public\\" +
+ result.substring(i + replace.length());
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/PropertyProvider.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.utils;
+
+/**
+ * Provides notifications whenever the subscribed property value changes.
+ * <br>
+ * One PropertyProvider instance can be used to subscribe events
+ * for only one property. If events for more properties are needed
+ * use separate PropertyProvider instance for each property.
+ *
+ * @see PropertyListener
+ */
+public class PropertyProvider
+{
+ /** Property category. */
+ private int iCategory = 0;
+ /** Property key. */
+ private int iKey = 0;
+ /** Property listener. */
+ private PropertyListener iListener = null;
+ /** Handle to native object. */
+ private int iHandle = 0;
+
+ /**
+ * Constructor.
+ */
+ public PropertyProvider()
+ {
+ }
+
+ /**
+ * Subscribe to listen changes of specified property value.
+ * One PropertyListener can subscribe to only one property
+ * value at a time.
+ *
+ * @param aCategory property category
+ * @param aKey property key
+ * @param aListener listener to be notified.
+ */
+ public void subscribe(int aCategory, int aKey, PropertyListener aListener)
+ {
+ if (iHandle != 0)
+ {
+ InstallerException.internalError("PropertyProvider already in use.");
+ }
+ iCategory = aCategory;
+ iKey = aKey;
+ iListener = aListener;
+ // Start a new thread which blocks until unsubscribe is called.
+ final PropertyProvider provider = this;
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ synchronized (provider)
+ {
+ iHandle = _subscribe(iCategory, iKey);
+ // Notify subscribe method after subscription
+ // result is available.
+ provider.notify();
+ }
+ if (iHandle > 0)
+ {
+ // Subscription succeeded, start to process events.
+ _processEvents(iHandle, provider);
+ }
+ }
+ }, "PropertyProviderThread").start();
+ synchronized (this)
+ {
+ try
+ {
+ if (iHandle == 0)
+ {
+ // Wait until subscription has been completed.
+ wait();
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ }
+ // Check if subscription failed.
+ if (iHandle < 0)
+ {
+ Log.logError("PropertyProvider.subscribe failed with code " + iHandle);
+ iHandle = 0;
+ }
+ }
+
+ /**
+ * Unubscribe from listening changes.
+ */
+ public void unsubscribe()
+ {
+ final PropertyProvider provider = this;
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ synchronized (provider)
+ {
+ if (iHandle <= 0)
+ {
+ Log.logWarning(
+ "PropertyProvider.unsubscribe: no subscription.");
+ return;
+ }
+ int err = _unsubscribe(iHandle);
+ if (err < 0)
+ {
+ Log.logError(
+ "PropertyProvider.unsubscribe failed with code " +
+ err);
+ }
+ else
+ {
+ iHandle = 0;
+ }
+ }
+ }
+ }, "PropertyProviderUnsubscribeThread").start();
+ }
+
+ /**
+ * Called from native when value for the subscribed property changes.
+ */
+ private void valueChanged(int aValue)
+ {
+ if (iListener != null)
+ {
+ iListener.valueChanged(iCategory, iKey, aValue);
+ }
+ }
+
+ /**
+ * Subscribe to listen changes of specified property value.
+ *
+ * @param aCategory property category
+ * @param aKey property key
+ * @return handle to native side object or Symbian error
+ * code (negative number)
+ */
+ private static native int _subscribe(int aCategory, int aKey);
+
+ /**
+ * Starts to process events. This call blocks until unsubscribe is called.
+ *
+ * @param aHandle handle to native side object
+ * @param aProvider PropertyProvider class instance to be notified
+ * @return 0 or Symbian error code (negative number)
+ */
+ private static native int _processEvents(int aHandle, PropertyProvider aProvider);
+
+ /**
+ * Unubscribe from listening changes.
+ *
+ * @param aHandle handle to native side object
+ * @return 0 or Symbian error code (negative number)
+ */
+ private static native int _unsubscribe(int aHandle);
+}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Fri Jul 23 12:27:20 2010 +0300
@@ -99,6 +99,11 @@
*/
static final int RET_NO_SYSTEM_EXIT = 100;
+ /** Id for installer cancel Comms message. */
+ private static final int INSTALLER_CANCEL_MESSAGE_ID = 603;
+ /** Id for installer cancel Comms response message. */
+ private static final int INSTALLER_CANCEL_RESPONSE_MESSAGE_ID = 604;
+
// ThreadDumper instance.
private static ThreadDumper iThreadDumper = null;
@@ -323,7 +328,7 @@
}
StartUpTrace.doTrace("Installer.mainWithResult " + aArgs[0] + " begins");
- StringBuffer buf = new StringBuffer("Java install process started with command: ");
+ StringBuffer buf = new StringBuffer("Java install process started with command:");
for (int i = 0; i < aArgs.length; i++)
{
buf.append(" ").append(aArgs[i]);
@@ -1235,6 +1240,8 @@
" -commsresult=endpoint In the end of operation, send\n"+
" InstallerResultMessage to specified comms\n"+
" endpoint.\n"+
+ " -base64=base64options Comma separated list of base64 encoded\n"+
+ " options.\n"+
"\n"+
"Either -jad or -jar must be specified, other options are optional.\n";
@@ -1264,10 +1271,13 @@
" -captainmsgs=yes|no If set to no, JavaInstaller will not send\n"+
" any messages to JavaCaptain during\n"+
" uninstallation. Default is yes.\n"+
+ " -resetpreinstall Reset preinstall state.\n"+
" -skipotastatus Skip OTA status handling.\n"+
" -commsresult=endpoint In the end of operation, send\n"+
" InstallerResultMessage to specified comms\n"+
" endpoint.\n"+
+ " -base64=base64options Comma separated list of base64 encoded\n"+
+ " options.\n"+
"\n"+
"The -uid option must be specified, other options are optional.\n";
@@ -1466,7 +1476,7 @@
if (aMessage.hasPermission(CommsPermission.INSTALL_APPLICATION))
{
int msgId = aMessage.getMessageId();
- if (msgId == 603)
+ if (msgId == INSTALLER_CANCEL_MESSAGE_ID)
{
Installer.cancel();
result = ERR_NONE;
@@ -1479,7 +1489,7 @@
}
CommsMessage response = new CommsMessage();
response.replyTo(aMessage);
- response.setMessageId(604);
+ response.setMessageId(INSTALLER_CANCEL_RESPONSE_MESSAGE_ID);
response.write(result);
iInstallerServer.send(response);
Log.log("InstallerListener sent " + response);
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java Fri Jul 23 12:27:20 2010 +0300
@@ -444,7 +444,7 @@
addValue(NAME_ERROR_CATEGORY,
SifRegistrator.getErrorCategory(aEb.getShortMessageId()));
addValue(NAME_ERROR_CODE,
- aEb.getShortMessageId() + aEb.getDetailedMessageId());
+ aEb.getShortMessageId()*1000 + aEb.getDetailedMessageId());
}
else if (aEb.getShortMessageId() >= ErrorMessageBase.SECURITY_RANGE_START &&
aEb.getShortMessageId() <= ErrorMessageBase.SECURITY_RANGE_END)
@@ -453,7 +453,7 @@
SifRegistrator.getErrorCategory(
InstallerErrorMessage.INST_AUTHORIZATION_ERR));
addValue(NAME_ERROR_CODE,
- aEb.getShortMessageId() + aEb.getDetailedMessageId());
+ aEb.getShortMessageId()*1000 + aEb.getDetailedMessageId());
}
else
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java Fri Jul 23 12:27:20 2010 +0300
@@ -73,7 +73,8 @@
// Application touch support detection is not needed
// if Nokia-MIDlet-On-Screen-Keypad has been defined.
boolean touchDetection = true;
- if (ball.iSuite.getOnScreenKeypad() != SuiteInfo.OSK_UNDEFINED)
+ if (ball.getAttributeValue("Nokia-MIDlet-On-Screen-Keypad") != null &&
+ ball.iSuite.getOnScreenKeypad() != SuiteInfo.OSK_UNDEFINED)
{
touchDetection = false;
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java Fri Jul 23 12:27:20 2010 +0300
@@ -150,6 +150,9 @@
Log.log("JavaCaptain notified");
}
+ // Add an entry to platform installation log.
+ ball.iApplicationRegistrator.addInstallLogEntry(ball.iSuite, 0);
+
String midletName = ball.getAttributeValue("MIDlet-Name");
ball.log("Application " + midletName + " successfully installed.");
ball.log(ball.iSuite.toShortString());
@@ -304,7 +307,14 @@
if (ball.iSifRegistrator.getSifMode() > 0 && launchApp)
{
- ball.iSifRegistrator.launchAppView();
+ ball.getInstallerUi().syncExec(new Runnable()
+ {
+ // launchAppView() must be called in the UI thread.
+ public void run()
+ {
+ ball.iSifRegistrator.launchAppView();
+ }
+ });
}
else
if (ball.iCaptainMsgs && launchApp &&
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java Fri Jul 23 12:27:20 2010 +0300
@@ -29,6 +29,7 @@
import com.nokia.mj.impl.installer.jsrpluginnotifier.JsrPluginNotifier;
import com.nokia.mj.impl.installer.storagehandler.StorageHandler;
import com.nokia.mj.impl.installer.utils.Args;
+import com.nokia.mj.impl.installer.utils.DriveInfo;
import com.nokia.mj.impl.installer.utils.FileRoots;
import com.nokia.mj.impl.installer.utils.FileUtils;
import com.nokia.mj.impl.installer.utils.InstallerException;
@@ -40,6 +41,8 @@
import com.nokia.mj.impl.fileutils.FileURL;
import com.nokia.mj.impl.utils.Uid;
+import java.util.Vector;
+
public class PrepareInstallation extends ExeStep
{
@@ -277,6 +280,7 @@
if (arg != null)
{
aBall.iInstallationDrive = args.parseDrive(arg);
+ checkInstallationDrive(aBall.iInstallationDrive);
}
}
@@ -389,4 +393,28 @@
}
return filePath;
}
+
+ /**
+ * Checks that given installation drive is a valid one.
+ *
+ * @param aDrive installation drive
+ * @throws InstallerException if installation drive is not valid
+ */
+ private static void checkInstallationDrive(int aDrive)
+ {
+ Vector drives = new Vector();
+ SysUtil.getUserVisibleDrives(drives);
+ for (int i = 0; i < drives.size(); i++)
+ {
+ DriveInfo driveInfo = (DriveInfo)drives.elementAt(i);
+ if (driveInfo.getNumber() == aDrive)
+ {
+ // Installation drive found from user visible drives.
+ return;
+ }
+ }
+ InstallerException.internalError(
+ "Invalid installation drive: " + aDrive +
+ " (" + (char)('A' + aDrive) + ")");
+ }
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java Fri Jul 23 12:27:20 2010 +0300
@@ -35,6 +35,7 @@
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.extension.ImageUtil;
/**
* Installation step PrepareSplashScreen prepares splash
@@ -106,15 +107,21 @@
for (int i = 0; i < tokens.length; i++)
{
tokens[i] = tokens[i].trim();
- currentImage = loadImage(tokens[i], ball.iJarFilename);
- if (currentImage == null)
+ imageSizes[i] = getImageSize(tokens[i], ball.iJarFilename);
+ if (imageSizes[i] == null)
{
- // Image loading failed, proceed to the next image.
- imageSizes[i] = new Point(0, 0);
- continue;
+ // Couldn't get image size, try to get it by loading
+ // the image.
+ currentImage = loadImage(tokens[i], ball.iJarFilename);
+ if (currentImage == null)
+ {
+ // Image loading failed, proceed to the next image.
+ imageSizes[i] = new Point(0, 0);
+ continue;
+ }
+ imageSizes[i] = new Point(
+ currentImage[0].width, currentImage[0].height);
}
- imageSizes[i] = new Point(
- currentImage[0].width, currentImage[0].height);
}
// Choose the images which best fill the portrait and
// landscape screens.
@@ -237,6 +244,74 @@
}
/**
+ * Gets image size for specified image from given jar file.
+ *
+ * @param aResource image file name
+ * @param aJar jar file name
+ * @return image size, or null if getting image size fails
+ */
+ private static Point getImageSize(String aResource, String aJar)
+ {
+ Point result = null;
+ JarFile jarFile = null;
+ InputStream is = null;
+ try
+ {
+ // Open jar file and input stream.
+ jarFile = new JarFile(aJar);
+ is = jarFile.getInputStream(
+ new JarEntry(FileUtils.trimJarEntry(aResource)));
+ if (is != null)
+ {
+ result = ImageUtil.getImageSize(is);
+ if (result != null)
+ {
+ Log.log("Image size for " + aResource + " from " +
+ aJar + ": " + result);
+ }
+ }
+ else
+ {
+ Log.logWarning("Image " + aResource + " not found from " + aJar);
+ }
+ }
+ catch (Throwable t)
+ {
+ Log.logWarning("Loading image " + aResource + " from " +
+ aJar + " failed", t);
+ }
+ finally
+ {
+ // Close streams and jar file.
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ is = null;
+ }
+ catch (IOException ioe)
+ {
+ Log.logWarning("Closing InputStream failed", ioe);
+ }
+ }
+ if (jarFile != null)
+ {
+ try
+ {
+ jarFile.close();
+ jarFile = null;
+ }
+ catch (IOException ioe)
+ {
+ Log.logWarning("Closing " + aJar + " failed", ioe);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
* Loads image from specified resource from given jar file.
*
* @param aResource resource file name
@@ -252,8 +327,8 @@
{
// Open jar file and input stream.
jarFile = new JarFile(aJar);
- is = jarFile.getInputStream
- (new JarEntry(FileUtils.trimJarEntry(aResource)));
+ is = jarFile.getInputStream(
+ new JarEntry(FileUtils.trimJarEntry(aResource)));
if (is != null)
{
result = (new ImageLoader()).load(is);
@@ -319,8 +394,8 @@
{
// Open jar file and input and output streams.
jarFile = new JarFile(aJar);
- is = jarFile.getInputStream
- (new JarEntry(FileUtils.trimJarEntry(aResource)));
+ is = jarFile.getInputStream(
+ new JarEntry(FileUtils.trimJarEntry(aResource)));
os = FileUtils.getOutputStream(imageFilename);
// Copy the image data from InputStream to OutputStream.
byte[] buf = new byte[16384];
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/FinalizeUninstallation.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/FinalizeUninstallation.java Fri Jul 23 12:27:20 2010 +0300
@@ -102,6 +102,10 @@
ball.log("Application with uid " + appUids[i] + " uninstalled");
}
}
+
+ // Add an entry to platform installation log.
+ ball.iApplicationRegistrator.addInstallLogEntry(ball.iSuite, 1);
+
ball.log("Application suite with uid " + ball.iSuite.getUid() +
" successfully uninstalled.");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/PropertyListener.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.utils;
+
+/**
+ * Interface for listening property value changes.
+ *
+ * @see PropertyProvider
+ */
+public interface PropertyListener
+{
+ /**
+ * Called when property value is changed.
+ * This method must return quickly.
+ *
+ * @param aCategory property category
+ * @param aKey property key
+ * @param aValue property value
+ */
+ public void valueChanged(int aCategory, int aKey, int aValue);
+}
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -30,6 +30,12 @@
#include <AknUtils.h>
#include <hal.h>
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include <SWInstLogTaskParam.h>
+#include <SWInstTask.h>
+#include <SWInstTaskManager.h>
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
#include <apgicnfl.h>
#else
@@ -50,6 +56,11 @@
// NAMESPACE DECLARATION
using namespace java;
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+using namespace SwiUI;
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
/**
@@ -980,3 +991,74 @@
}
}
#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/**
+ * See JNI method __1logComponent.
+ * This method makes calls that may leave.
+ */
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+void AddInstallLogEntryL(
+ JNIEnv */*aEnv*/, jint /*aAction*/, jint /*aUid*/,
+ jstring /*aName*/, jstring /*aVendor*/,
+ jint /*aMajorVersion*/, jint /*aMinorVersion*/, jint /*aMicroVersion*/)
+{
+}
+#else
+void AddInstallLogEntryL(
+ JNIEnv *aEnv, jint aAction, jint aUid, jstring aName, jstring aVendor,
+ jint aMajorVersion, jint aMinorVersion, jint aMicroVersion)
+{
+ TUid uid = TUid::Uid(aUid);
+ HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
+ HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
+ TVersion version(aMajorVersion, aMinorVersion, aMicroVersion);
+
+ // Create log task object.
+ CTask* task = CTask::NewL(KLogTaskImplUid, EFalse);
+ CleanupStack::PushL(task);
+
+ // Initalize log task parameters.
+ TLogTaskParam params;
+ params.iName.Copy(name->Left(KMaxLogNameLength));
+ params.iVendor.Copy(vendor->Left(KMaxLogVendorLength));
+ params.iVersion = version;
+ params.iUid = uid;
+ // Time must be universal time.
+ TTime time;
+ time.UniversalTime();
+ params.iTime = time;
+ params.iAction = (TLogTaskAction)aAction;
+ params.iIsStartup = EFalse; // Startup list was not modified.
+
+ TLogTaskParamPckg pckg(params);
+ task->SetParameterL(pckg, 0);
+
+ // Create log task manager.
+ CTaskManager* taskManager = CTaskManager::NewL();
+ CleanupStack::PushL(taskManager);
+
+ // Add the log task to the task list.
+ taskManager->AddTaskL(task);
+ taskManager->ExecutePendingTasksL();
+
+ // Cleanup.
+ CleanupStack::PopAndDestroy(taskManager);
+ CleanupStack::Pop(task);
+
+ CleanupStack::PopAndDestroy(vendor);
+ CleanupStack::PopAndDestroy(name);
+}
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/**
+ * Adds an entry to platform installation log.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1addInstallLogEntry
+(JNIEnv *aEnv, jclass, jint aAction, jint aUid, jstring aName, jstring aVendor,
+ jint aMajorVersion, jint aMinorVersion, jint aMicroVersion)
+{
+ TRAPD(err, AddInstallLogEntryL(
+ aEnv, aAction, aUid, aName, aVendor,
+ aMajorVersion, aMinorVersion, aMicroVersion));
+ return err;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertylistener.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* This class implements general wait object for calling
+* a callback function after subscribed P&S key value changes.
+*
+*/
+
+#include "propertylistener.h"
+#include "logger.h"
+
+using namespace java::installer;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CPropertyListener* CPropertyListener::NewL(TUid aUid, TUint aKey)
+{
+ CPropertyListener* self = new(ELeave) CPropertyListener(aUid, aKey);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+CPropertyListener::CPropertyListener(TUid aUid, TUint aKey)
+ : CActive(CActive::EPriorityStandard), iUid(aUid), iKey(aKey)
+{
+}
+
+void CPropertyListener::ConstructL()
+{
+ User::LeaveIfError(iProperty.Attach(iUid, iKey));
+ // PropertyListener is always created from a thread which does
+ // not have ActiveScheduler, so create ActiveScheduler now.
+ iActiveScheduler = new(ELeave) CActiveScheduler;
+ CActiveScheduler::Install(iActiveScheduler);
+ // Add this object to the ActiveScheduler.
+ CActiveScheduler::Add(this);
+}
+
+CPropertyListener::~CPropertyListener()
+{
+ Cancel();
+ iProperty.Close();
+ if (iActiveScheduler)
+ {
+ delete iActiveScheduler;
+ iActiveScheduler = 0;
+ }
+}
+
+void CPropertyListener::ProcessEventsL(JNIEnv *aEnv, jobject aProvider)
+{
+ // Get the java side callback method.
+ jclass clazz = aEnv->GetObjectClass(aProvider);
+ jmethodID method = aEnv->GetMethodID(clazz, "valueChanged", "(I)V");
+
+ iEnv = aEnv;
+ iProvider = aProvider;
+ iMethod = method;
+
+ // Run propertyListener once so that the current property value
+ // gets delivered and property value changes are subscribed.
+ RunL();
+
+ // Start ActiveScheduler.
+ CActiveScheduler::Start();
+}
+
+void CPropertyListener::RunL()
+{
+ if (iCancelled)
+ {
+ CActiveScheduler::Stop();
+ return;
+ }
+
+ // Resubscribe before handling the new value to prevent missing updates.
+ iProperty.Subscribe(iStatus);
+ SetActive();
+
+ TInt value;
+ TInt err = iProperty.Get(value);
+ if (KErrNone == err)
+ {
+ //ILOG3(EJavaInstaller,
+ // "CPropertyListener::RunL: property value changed"
+ // ", uid: 0x%x, key: 0x%x, value: %d", iUid.iUid, iKey, value);
+ // Use callback method to deliver the changed property value to
+ // Java side object.
+ iEnv->CallVoidMethod(iProvider, iMethod, value);
+ }
+ else if (KErrNotFound == err)
+ {
+ // Property deleted, no actions needed.
+ }
+ else
+ {
+ // Error while reading property value.
+ ELOG3(EJavaInstaller,
+ "CPropertyListener::RunL: getting property value failed"
+ ", uid: 0x%x, key: 0x%x, err=%d", iUid.iUid, iKey, err);
+ }
+}
+
+void CPropertyListener::DoCancel()
+{
+ iCancelled = ETrue;
+ iProperty.Cancel();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertylistener.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* This class implements general wait object for calling
+* a callback function after subscribed P&S key value changes.
+*
+*/
+
+#ifndef PROPERTYLISTENER_H
+#define PROPERTYLISTENER_H
+
+#include <e32base.h>
+#include <e32property.h>
+#include <jni.h>
+
+namespace java
+{
+namespace installer
+{
+
+/**
+ * This class implements wait object for calling a callback
+ * function after subscribed P&S key value changes.
+ */
+NONSHARABLE_CLASS(CPropertyListener) : public CActive
+{
+public: // Constructor and destructor
+
+ static CPropertyListener* NewL(TUid aUid, TUint aKey);
+
+ // Destructor.
+ virtual ~CPropertyListener();
+
+private:
+
+ // Constructor.
+ CPropertyListener(TUid aUid, TUint aKey);
+
+ // 2nd phase constructor.
+ void ConstructL();
+
+ // from base class CActive
+
+ void RunL();
+
+ void DoCancel();
+
+public: // Methods
+
+ void ProcessEventsL(JNIEnv *aEnv, jobject aProvider);
+
+private: // Data
+
+ CActiveScheduler* iActiveScheduler; // Owned
+
+ RProperty iProperty; // Property to listen
+ TUid iUid; // Property UID
+ TUint iKey; // Property key
+
+ JNIEnv *iEnv; // JNI environment, not owned
+ jobject iProvider; // Callback object
+ jmethodID iMethod; // Callback method
+
+ TBool iCancelled;
+};
+
+} // installer
+} // java
+
+#endif // PROPERTYLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertyprovider.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The JNI code for Java Installer class FileWriter.
+*
+*/
+
+#include "com_nokia_mj_impl_installer_utils_PropertyProvider.h"
+#include "logger.h"
+#include "propertylistener.h"
+
+// NAMESPACE DECLARATION
+using namespace java::installer;
+using namespace java::util;
+
+/*
+ * Class: com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method: _subscribe
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1subscribe
+(JNIEnv */*aEnv*/, jclass, jint aCategory, jint aKey)
+{
+ TUid uid = TUid::Uid(aCategory);
+ TUint key = (TUint)aKey;
+ // Construct PropertyListener.
+ CPropertyListener* propertyListener = 0;
+ TRAPD(err, propertyListener = CPropertyListener::NewL(uid, key));
+ if (KErrNone != err)
+ {
+ ELOG3(EJavaInstaller,
+ "PropertyProvider__1subscribe: creating property listener "
+ "failed, uid: 0x%x, key: 0x%x, err=%d", uid.iUid, key, err);
+ return err;
+ }
+
+ // Return handle to session. Utilize the fact that in Symbian
+ // all pointer addresses are MOD 4 so the last 2 bits are 0
+ // and can be shifted out. This way the returned handle is
+ // always positive whereas Symbian error codes are always negative.
+ return reinterpret_cast<TUint>(propertyListener)>>2;
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method: _processEvents
+ * Signature: (ILcom/nokia/mj/impl/installer/utils/PropertyProvider;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1processEvents
+ (JNIEnv *aEnv, jclass, jint aHandle, jobject aProvider)
+{
+ CPropertyListener* propertyListener =
+ reinterpret_cast<CPropertyListener*>(aHandle<<2);
+ // Start propertyListener for event sending.
+ TRAPD(err, propertyListener->ProcessEventsL(aEnv, aProvider));
+ if (KErrNone != err)
+ {
+ ELOG1(EJavaInstaller,
+ "PropertyProvider__1processEvents: initializing "
+ "propertyListener failed, err=%d", err);
+ }
+ return err;
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method: _unsubscribe
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1unsubscribe
+ (JNIEnv *, jclass, jint aHandle)
+{
+ CPropertyListener* propertyListener =
+ reinterpret_cast<CPropertyListener*>(aHandle<<2);
+
+ // Delete PropertyListener.
+ delete propertyListener;
+ propertyListener = 0;
+
+ return KErrNone;
+}
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java Fri Jul 23 12:27:20 2010 +0300
@@ -33,6 +33,8 @@
*/
public class SysUtilTest extends TestCase implements InstallerMain
{
+ private int iPropertyValue = 0; // Used in testPropertyListener test case.
+
// Begin j2meunit test framework setup
public void installerMain(String[] args)
@@ -169,6 +171,14 @@
if (Platform.isS60())
{
+ suite.addTest(new SysUtilTest("testPropertyListener", new TestMethod()
+ {
+ public void run(TestCase tc)
+ {
+ ((SysUtilTest)tc).testPropertyListener();
+ }
+ }));
+
suite.addTest(new SysUtilTest("testGetProcessState", new TestMethod()
{
public void run(TestCase tc)
@@ -266,13 +276,12 @@
{
try
{
- // Test PS keys defined in ScreensaverInternalPSKeys.h
- Uid uid = PlatformUid.createUid("0x101F8771"); // KPSUidScreenSaver
- int key = 0x00000001; // KScreenSaverPreviewMode
- // Set screensaver preview mode on (stays on for 10 secs).
+ Uid uid = SysUtil.PROP_CATEGORY_SYSTEM;
+ long key = SysUtil.PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS;
SysUtil.setPropertyValue(uid, key, 1);
int value = SysUtil.getPropertyValue(uid, key);
- assertTrue("KScreenSaverPreviewMode(!=1): " + value, value == 1);
+ assertTrue("PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS(!=1): " +
+ value, value == 1);
}
catch (InstallerException ie)
{
@@ -285,9 +294,8 @@
{
try
{
- // Test PS keys defined in ScreensaverInternalPSKeys.h
- Uid uid = PlatformUid.createUid("0x101F8771"); // KPSUidScreenSaver
- int key = 0x00000010; // Undefined key
+ Uid uid = SysUtil.PROP_CATEGORY_SYSTEM;
+ int key = 0x00000100; // Undefined key
SysUtil.setPropertyValue(uid, key, 1);
assertTrue("Setting undefined property value did not fail", false);
}
@@ -374,11 +382,12 @@
{
try
{
- // Test CenRep keys defined in ScreensaverInternalCRKeys.h
- Uid uid = PlatformUid.createUid("0x101F8770"); // KCRUidScreenSaver
- long key = 0x00000004; // KScreenSaverInvertedColors
+ // Test CenRep keys defined in Java security.
+ Uid uid = PlatformUid.createUid("0x2001B289"); // KJavaSecurity
+ long key = 0x00000004; // KJavaSecurity/KWarningsMode
int value = SysUtil.getRepositoryValue(uid, key);
- assertTrue("KScreenSaverInvertedColors(!=0): " + value, value == 0);
+ assertTrue("KJavaSecurity/KWarningsMode(!=2): " + value,
+ value == 2);
}
catch (InstallerException ie)
{
@@ -609,6 +618,81 @@
}
}
+ public void testPropertyListener()
+ {
+ final int category = 0x101f75b6;
+ final int key = 0x20019546;
+ final int value = 15;
+ final Object synchObject = this;
+ PropertyListener listener = new PropertyListener()
+ {
+ public void valueChanged(int aCategory, int aKey, int aValue)
+ {
+ try
+ {
+ if (aValue == 0)
+ {
+ // Ignore the first event which is sent when
+ // subscription is made.
+ return;
+ }
+ synchronized (synchObject)
+ {
+ iPropertyValue = aValue;
+ Log.log("PropertyListener.valueChanged: " + aValue +
+ " (" + aCategory + ", " + aKey + ")");
+ if (aCategory != category)
+ {
+ Log.logError("PropertyListener.valueChanged: " +
+ "invalid category " + aCategory);
+ }
+ if (aKey != key)
+ {
+ Log.logError("PropertyListener.valueChanged: " +
+ "invalid key " + aKey);
+ }
+ synchObject.notify();
+ }
+ }
+ catch (Throwable t)
+ {
+ Log.logError("PropertyListener.valueChanged exception", t);
+ }
+ }
+ };
+ try
+ {
+ iPropertyValue = 0;
+ SysUtil.setPropertyValue(
+ PlatformUid.createUid(category), key, iPropertyValue);
+ PropertyProvider provider = new PropertyProvider();
+ provider.subscribe(category, key, listener);
+ SysUtil.setPropertyValue(
+ PlatformUid.createUid(category), key, value);
+ try
+ {
+ synchronized (synchObject)
+ {
+ if (iPropertyValue == 0)
+ {
+ synchObject.wait(2000);
+ }
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ provider.unsubscribe();
+ assertTrue("Unexpected property value after test: " +
+ iPropertyValue, iPropertyValue == value);
+ }
+ catch (Throwable t)
+ {
+ Log.logError("testPropertyListener exception", t);
+ assertTrue("Unexpected exception " + t, false);
+ }
+ }
+
public void testGetProcessState()
{
int state = SysUtil.getProcessState(PlatformUid.createUid("[102033e6]"));
--- a/javamanager/javainstaller/installerui/data/javaapplicationinstaller.css Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/data/javaapplicationinstaller.css Fri Jul 23 12:27:20 2010 +0300
@@ -88,6 +88,15 @@
font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
}
+QLabel#urlLabel{
+ /* Text in authentication dialog (UsernamePasswordView) */
+ /* Note that this dialog is always in portrait */
+ font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+ margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+ margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+ margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
QLabel#authLabel{
/* Text in authentication dialog (UsernamePasswordView) */
/* Note that this dialog is always in portrait */
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallConfirmationView.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallConfirmationView.java Fri Jul 23 12:27:20 2010 +0300
@@ -23,18 +23,13 @@
import java.io.InputStream;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
/**
* InstallConfirmationView asks installation confirmation
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java Fri Jul 23 12:27:20 2010 +0300
@@ -35,6 +35,7 @@
import java.io.InputStream;
import java.io.IOException;
+import java.util.Enumeration;
import java.util.Hashtable;
import org.eclipse.ercp.swt.midp.UIThreadSupport;
@@ -48,6 +49,8 @@
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.extension.DisplayExtension;
+import org.eclipse.swt.internal.extension.ImageUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Composite;
@@ -201,10 +204,7 @@
display.sleep();
}
}
- if (iBoldFont != null && !iBoldFont.isDisposed())
- {
- iBoldFont.dispose();
- }
+ disposeResources();
display.dispose();
log("uiMain: display disposed");
synchronized (iExitWaitObject)
@@ -1047,17 +1047,21 @@
{
return iSecurityIcon;
}
- String iconFilename = ResourceUtil.UNTRUSTED_ICON_NAME;
+ int id = ImageUtil.THEME_IMAGE_SECURITY_UNTRUSTED;
if (aIdentified)
{
- iconFilename = ResourceUtil.TRUSTED_ICON_NAME;
+ id = ImageUtil.THEME_IMAGE_SECURITY_TRUSTED;
}
- String resourceDir = ResourceUtil.getResourceDir(0);
- for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+
+ try
{
- iSecurityIcon = loadImage(aDisplay, resourceDir + iconFilename, false);
- resourceDir = ResourceUtil.getResourceDir(i);
+ iSecurityIcon = ImageUtil.createImageFromTheme(aDisplay, id);
}
+ catch (Throwable t)
+ {
+ log("Can not load security icon: " + t);
+ }
+
return iSecurityIcon;
}
@@ -1147,22 +1151,26 @@
try
{
long startTime = System.currentTimeMillis();
- ImageData[] imageDatas = new ImageLoader().load(aInputStream);
- ImageData imageData = imageDatas[0];
+
+ Image image = new Image(aDisplay, aInputStream);
if (aScaleImage)
{
- Point bestSize = getBestImageSize(
- imageData.width, imageData.height);
- if (bestSize.x != imageData.width ||
- bestSize.y != imageData.height)
+ int maxWidth = DisplayExtension.getBestImageWidth(DisplayExtension.LIST_ELEMENT);
+ int maxHeight = DisplayExtension.getBestImageHeight(DisplayExtension.LIST_ELEMENT);
+ Rectangle rect = image.getBounds();
+ if (maxWidth != rect.width || maxHeight != rect.height)
{
- imageData = imageData.scaledTo(bestSize.x, bestSize.y);
- log("Image " + aImageName + " scaled from " +
- imageDatas[0].width + "x" + imageDatas[0].height +
- " to " + bestSize.x + "x" + bestSize.y);
+ // Copy and scale natively preserving the aspect ratio
+ result = ImageUtil.scaleImage(aDisplay, image, new Point(maxWidth, maxHeight), true);
+ image.dispose();
+ image = null;
}
}
- result = new Image(aDisplay, imageData);
+ if (result == null)
+ {
+ result = image;
+ }
+
long endTime = System.currentTimeMillis();
log("Loaded image " + aImageName + " (load time " +
(endTime - startTime) + " ms)");
@@ -1176,33 +1184,6 @@
return result;
}
- /**
- * Determines the best image size for the image of given size.
- */
- private static Point getBestImageSize(int aWidth, int aHeight)
- {
- // Actually maximum image width and height should be obtained with
- // org.eclipse.swt.internal.extension.DisplayExtension
- // getBestImageWidth() and getBestImageHeight().
- final int MAX_WIDTH = 50; // max width in pixels
- final int MAX_HEIGHT = 50; // max height in pixels
- Point result = new Point(aWidth, aHeight);
- if (result.x > MAX_WIDTH || result.y > MAX_HEIGHT)
- {
- if (result.x >= MAX_WIDTH)
- {
- result.x = MAX_WIDTH;
- result.y = MAX_WIDTH * aHeight / aWidth;
- }
- if (result.y >= MAX_HEIGHT)
- {
- result.x = MAX_HEIGHT * aWidth / aHeight;
- result.y = MAX_HEIGHT;
- }
- }
- return result;
- }
-
/** Returns true if UI has been created and can be used. */
protected boolean isUiReady()
{
@@ -1298,6 +1279,13 @@
}
return iBoldFont;
}
+
+ int iconLabelTopMargin()
+ {
+ // Aproximating the space at the top of a Label.
+ // eSWT's Label adds extra space around texts but not around images.
+ return getBoldFont().getFontData()[0].getHeight();
+ }
void setActiveView(ViewBase aView)
{
@@ -1313,4 +1301,24 @@
{
return iActiveView;
}
+
+ private void disposeResources() {
+ if (iBoldFont != null && !iBoldFont.isDisposed())
+ {
+ iBoldFont.dispose();
+ }
+ if (iSecurityIcon != null && !iSecurityIcon.isDisposed())
+ {
+ iSecurityIcon.dispose();
+ }
+ Enumeration e = iImageTable.elements();
+ while (e.hasMoreElements())
+ {
+ Image img = (Image)e.nextElement();
+ if (img != null && !img.isDisposed())
+ {
+ img.dispose();
+ }
+ }
+ }
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java Fri Jul 23 12:27:20 2010 +0300
@@ -412,7 +412,11 @@
gridData.horizontalSpan = aColumns;
gridData.horizontalAlignment = SWT.CENTER;
gridData.verticalAlignment = SWT.TOP;
+ // This is to lower the image at the same level with the texts.
+ // eSWT's Label adds extra space around texts but not around images.
+ gridData.verticalIndent = iInstallerUi.iconLabelTopMargin();
label.setLayoutData(gridData);
+ label.setFont(iInstallerUi.getBoldFont());
return label;
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Fri Jul 23 12:27:20 2010 +0300
@@ -36,6 +36,7 @@
import java.io.InputStream;
import java.io.IOException;
+import java.util.Enumeration;
import java.util.Hashtable;
import org.eclipse.ercp.swt.midp.UIThreadSupport;
@@ -219,10 +220,7 @@
display.sleep();
}
}
- if (iBoldFont != null && !iBoldFont.isDisposed())
- {
- iBoldFont.dispose();
- }
+ disposeResources();
display.dispose();
log("uiMain: display disposed");
synchronized (iExitWaitObject)
@@ -674,9 +672,10 @@
{
public void run()
{
- iOcspProgressView = new ProgressView(self, iDialog,
- InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS),
- true);
+ iOcspProgressView = new ProgressView(
+ self, iDialog,
+ InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS),
+ true);
}
});
iOcspProgressView.addCancelCommand();
@@ -805,45 +804,6 @@
}
/**
- * Notify user that an error has occurred using RuntimeUI.
- *
- * @param aInstallerException exception indicating the error reason
- */
- /*
- private void showRuntimeUiError(InstallerExceptionBase aInstallerException)
- {
- boolean identified = false;
- if (iInstallInfo != null)
- {
- if (iInstallInfo.getCertificates() != null)
- {
- identified = true;
- }
- }
- else if (iUninstallInfo != null)
- {
- if (iUninstallInfo.getCertificates() != null)
- {
- identified = true;
- }
- }
- String tmpTitle = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED);
-
- // Ensure that no confirmations are being displayed.
- cancelConfirmations();
- // Hide progress view before displaying error message.
- if (iProgressView != null)
- {
- iProgressView.setVisible(false);
- }
- // Use RuntimeUi to display uninstallation error message.
- RuntimeUi runtimeUi = RuntimeUiFactory.getRuntimeUi(identified);
- runtimeUi.error(tmpTitle, aInstallerException);
- runtimeUi.destroy();
- }
- */
-
- /**
* Seeks confirmation from the user.
*
* @param aAppName the name of the application on behalf of which the
@@ -1032,20 +992,23 @@
*/
protected String getTitle()
{
- String result = null;
- if (iMode == MODE_INSTALL)
- {
- result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING);
- }
- else if (iMode == MODE_UNINSTALL)
+ String result = super.getTitle();
+ if (isUiReady())
{
- result = InstallerUiTexts.get("Uninstalling");
- }
- else if (iMode == MODE_APP_CONVERSION)
- {
- result = InstallerUiTexts.get(
- "Converting data for application " +
- iAppConversionCurrent + "/" + iAppConversionTotal);
+ if (iMode == MODE_INSTALL)
+ {
+ result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING);
+ }
+ else if (iMode == MODE_UNINSTALL)
+ {
+ result = InstallerUiTexts.get("Uninstalling");
+ }
+ else if (iMode == MODE_APP_CONVERSION)
+ {
+ result = InstallerUiTexts.get(
+ "Converting data for application " +
+ iAppConversionCurrent + "/" + iAppConversionTotal);
+ }
}
return result;
}
@@ -1070,11 +1033,19 @@
{
iconFilename = "java_3_trusted.png";
}
- String resourceDir = ResourceUtil.getResourceDir(0);
- for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+ try
{
- iSecurityIcon = loadImage(aDisplay, resourceDir + iconFilename, false);
- resourceDir = ResourceUtil.getResourceDir(i);
+ String resourceDir = ResourceUtil.getResourceDir(0);
+ for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+ {
+ iSecurityIcon = loadImage(
+ aDisplay, resourceDir + iconFilename, false);
+ resourceDir = ResourceUtil.getResourceDir(i);
+ }
+ }
+ catch (Throwable t)
+ {
+ log("Can not load security icon: " + t);
}
return iSecurityIcon;
}
@@ -1363,4 +1334,24 @@
logError("Loading CSS from " + cssPath + " failed", t);
}
}
+
+ private void disposeResources() {
+ if (iBoldFont != null && !iBoldFont.isDisposed())
+ {
+ iBoldFont.dispose();
+ }
+ if (iSecurityIcon != null && !iSecurityIcon.isDisposed())
+ {
+ iSecurityIcon.dispose();
+ }
+ Enumeration e = iImageTable.elements();
+ while (e.hasMoreElements())
+ {
+ Image img = (Image)e.nextElement();
+ if (img != null && !img.isDisposed())
+ {
+ img.dispose();
+ }
+ }
+ }
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java Fri Jul 23 12:27:20 2010 +0300
@@ -30,73 +30,6 @@
/*** ----------------------------- PUBLIC ------------------------------ */
// Define constants for localised text ids.
- public static final String OK = "Ok";
- public static final String CANCEL = "Cancel";
- public static final String BACK = "Ok";
- public static final String HIDE = "Hide";
- public static final String SHOW = "Show";
- public static final String CLOSE = "Close";
- public static final String INSTALL_QUERY = "Install?";
- public static final String UPDATE_QUERY = "Update?";
- public static final String OCSP_CHECK_PROGRESS = "Checking certificate validity";
- public static final String INSTALLING = "Installing";
- public static final String INSTALL_FAILED = "Installation failed";
- public static final String INSTALLATION_COMPLETE = "Installed";
- public static final String DOWNLOADING = "Downloading";
- public static final String CONNECT_TO = "Connect to";
- public static final String DOWNLOAD_APPLICATION = "To download %U you need to authenticate yourself";
- public static final String USERNAME = "Username:";
- public static final String PASSWORD = "Password:";
- public static final String SUITE_NAME = "%U (%U)";
- public static final String SUITE_VENDOR = "%U";
- public static final String SUITE_VERSION = "%U";
- public static final String APP_NAME = "%U";
- public static final String SIZE_KB = "%U kB";
- public static final String SIZE_MB = "%U MB";
- public static final String RETAIN_USER_DATA = "Retain application data";
- // Certificate info texts.
- public static final String NOT_CERTIFIED_TITLE = "Application is not certified.";
- public static final String NOT_CERTIFIED_INFO = "Application %U is from an unknown source.";
- public static final String CERTIFICATE_TITLE = "Application is certified.";
- public static final String DOMAIN = "Domain: %U";
- public static final String DOMAIN_MANU = "Manufacturer";
- public static final String DOMAIN_OPER = "Operator";
- public static final String DOMAIN_ITP = "Trusted 3rd party";
- public static final String DOMAIN_UTP = "Untrusted 3rd party";
- public static final String ISSUER = "Issuer: %U";
- public static final String SUBJECT = "Subject: %U";
- public static final String ORGANIZATION = "Organization: %U";
- public static final String VALID_FROM = "Valid from: %U";
- public static final String VALID_UNTIL = "Valid until: %U";
- public static final String SERIAL_NUMBER = "Serial number: %U";
- public static final String FINGERPRINT = "Fingerprint: %U";
- // Texts for installation drive selection.
- public static final String DRIVE_TYPE_UNKNOWN = "%U: Unknown";
- public static final String DRIVE_TYPE_UNKNOWN_KB = "%U: Unknown (%N kB)";
- public static final String DRIVE_TYPE_UNKNOWN_MB = "%U: Unknown (%N MB)";
- public static final String DRIVE_TYPE_UNKNOWN_GB = "%U: Unknown (%N GB)";
- public static final String DRIVE_TYPE_PHONE_MEMORY = "%U: Phone memory";
- public static final String DRIVE_TYPE_PHONE_MEMORY_KB = "%U: Phone memory (%N kB)";
- public static final String DRIVE_TYPE_PHONE_MEMORY_MB = "%U: Phone memory (%N MB)";
- public static final String DRIVE_TYPE_PHONE_MEMORY_GB = "%U: Phone memory (%N GB)";
- public static final String DRIVE_TYPE_MEMORY_CARD = "%U: Memory card";
- public static final String DRIVE_TYPE_MEMORY_CARD_KB = "%U: Memory card (%N kB)";
- public static final String DRIVE_TYPE_MEMORY_CARD_MB = "%U: Memory card (%N MB)";
- public static final String DRIVE_TYPE_MEMORY_CARD_GB = "%U: Memory card (%N GB)";
- public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE = "%U: Internal Mass Storage";
- public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_KB = "%U: Internal Mass Storage (%N kB)";
- public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_MB = "%U: Internal Mass Storage (%N MB)";
- public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_GB = "%U: Internal Mass Storage (%N GB)";
- // Texts for permission confirmation view.
- public static final String PERM_QUERY = "Access for protected functionality needed.";
- public static final String PERM_VIEW_DETAILS = "Details";
- public static final String PERM_ALLOW_ALWAYS = "Allow always";
- public static final String PERM_ASK_ME_LATER = "Ask me later";
- public static final String PERM_CANCEL = "Cancel installing";
- public static final String PERM_VIEW_DETAILS_TITLE = "Application asks permissions for:";
-
- /*
- // Define constants for localised text ids.
public static final String OK = "button_ok";
public static final String CANCEL = "button_cancel";
public static final String BACK = "button_back_ok";
@@ -114,9 +47,8 @@
public static final String DOWNLOAD_APPLICATION = "info_auth_yourself";
public static final String USERNAME = "dialog_username";
public static final String PASSWORD = "dialog_password";
- public static final String SUITE_NAME = "info_app_suite_name";
+ public static final String SUITE_NAME_VERSION = "info_app_suite_name_version";
public static final String SUITE_VENDOR = "info_vendor";
- public static final String SUITE_VERSION = "info_version";
public static final String APP_NAME = "info_app_name";
public static final String SIZE_KB = "info_size_kb";
public static final String SIZE_MB = "info_size_mb";
@@ -161,7 +93,6 @@
public static final String PERM_ASK_ME_LATER = "button_perm_ask_me_later";
public static final String PERM_CANCEL = "button_perm_cancel_installing";
public static final String PERM_VIEW_DETAILS_TITLE = "title_perm_view_details";
- */
/**
* Method for retrieving a text string with given id and no parameters.
@@ -183,12 +114,12 @@
*/
public static String get(String aTextId, Object[] aTextParameters)
{
- return new com.nokia.mj.impl.utils.Formatter(aTextId).format(aTextParameters);
- //if (iRes == null)
- //{
- // iRes = ResourceLoader.getInstance("javaapplicationinstaller", "txt_java_inst_");
- //}
- //return iRes.format(aTextId, aTextParameters);
+ if (iRes == null)
+ {
+ iRes = ResourceLoader.getInstance(
+ null, null, "javaapplicationinstaller", "txt_java_inst_");
+ }
+ return iRes.format(aTextId, aTextParameters);
}
/*** ---------------------------- PROTECTED --------------------------- */
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java Fri Jul 23 12:27:20 2010 +0300
@@ -108,20 +108,20 @@
int labelStyle = SWT.WRAP;
- Label titleLabel = createLabel
- (InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO), labelStyle);
+ Label titleLabel = createLabel(
+ InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO), labelStyle);
setCssId(titleLabel, "heading");
- Label urlLabel = createLabel(iUrl, labelStyle);
+ Label urlLabel = createLabel(getServer(iUrl), labelStyle);
+ setCssId(urlLabel, "urlLabel");
- Label authLabel = createLabel
- (InstallerUiTexts.get
- (InstallerUiTexts.DOWNLOAD_APPLICATION, new String[] { iAppName }),
- labelStyle);
+ Label authLabel = createLabel(
+ InstallerUiTexts.get(InstallerUiTexts.DOWNLOAD_APPLICATION,
+ new String[] { iAppName }), labelStyle);
setCssId(authLabel, "authLabel");
- Label usernameLabel = createLabel
- (InstallerUiTexts.get(InstallerUiTexts.USERNAME), labelStyle);
+ Label usernameLabel = createLabel(
+ InstallerUiTexts.get(InstallerUiTexts.USERNAME), labelStyle);
setCssId(usernameLabel, "usernamePasswordLabel");
iUsernameText = new Text(getComposite(), SWT.BORDER);
@@ -129,8 +129,8 @@
iUsernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
addSoftKeyListenerFor(iUsernameText);
- Label passwordLabel = createLabel
- (InstallerUiTexts.get(InstallerUiTexts.PASSWORD), labelStyle);
+ Label passwordLabel = createLabel(
+ InstallerUiTexts.get(InstallerUiTexts.PASSWORD), labelStyle);
setCssId(passwordLabel, "usernamePasswordLabel");
iPasswordText = new Text(getComposite(), SWT.PASSWORD | SWT.BORDER);
@@ -156,4 +156,31 @@
{
return SWT.V_SCROLL;
}
+
+ /**
+ * Returns server part from HTTP URL.
+ */
+ private String getServer(String aUrl)
+ {
+ String server = aUrl;
+ int i = server.indexOf("://");
+ if (i != -1)
+ {
+ server = server.substring(i + 3);
+ i = server.indexOf(":");
+ if (i != -1)
+ {
+ server = server.substring(0, i);
+ }
+ else
+ {
+ i = server.indexOf("/");
+ if (i != -1)
+ {
+ server = server.substring(0, i);
+ }
+ }
+ }
+ return server;
+ }
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Fri Jul 23 12:27:20 2010 +0300
@@ -221,7 +221,7 @@
/** Set title for this view. */
public void setTitle(String aTitle)
{
- // Dialog shells have no title anymore
+ // Dialog shells have no title.
}
/** Disposes this view. */
@@ -549,7 +549,7 @@
// Add suite name and version.
createAppInfoLabel(
InstallerUiTexts.get(
- InstallerUiTexts.SUITE_NAME,
+ InstallerUiTexts.SUITE_NAME_VERSION,
new String[] { aInstallInfo.getName(),
aInstallInfo.getVersion() }));
if (aFull)
@@ -577,14 +577,14 @@
createAppInfoLabel(
InstallerUiTexts.get(
InstallerUiTexts.SIZE_MB,
- new String[] { Long.toString(1 + size/(1024*1024)) }));
+ new Object[] { new Integer((int)(1 + size/(1024*1024))) }));
}
else
{
createAppInfoLabel(
InstallerUiTexts.get(
InstallerUiTexts.SIZE_KB,
- new String[] { Long.toString(1 + size/1024) }));
+ new Object[] { new Integer((int)(1 + size/1024)) }));
}
}
if (aFull)
--- a/javamanager/javamanager.pro Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/javamanager.pro Fri Jul 23 12:27:20 2010 +0300
@@ -18,6 +18,8 @@
SUBDIRS += debugapi/build/debugapi.pro
SUBDIRS += javalauncher/build/javalauncher.pro
SUBDIRS += javaupgradeapp/build/javaupgradeapp.pro
+SUBDIRS += javaappscheme/build/javaappscheme.pro
+SUBDIRS += javaqtrequest/build/javaqtrequest.pro
SUBDIRS += javasettings_qt/build/javaapplicationsettingsview.pro
SUBDIRS += javacaptain
SUBDIRS += javainstaller
@@ -25,5 +27,4 @@
SUBDIRS += javabackup
SUBDIRS += javasettings
BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javarecognizer/build/bld.inf\""
-BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javaappschemeplugin/build/bld.inf\""
BLD_INF_RULES.prj_extensions += "prj_extensions"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/build/javaqtrequest.pro Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: QT Service application the makes Qt Highway API
+# request based on the command line of the application
+#
+
+TEMPLATE=app
+TARGET=javaqtrequest
+CONFIG += omj no_icon stl
+CONFIG -= gui
+
+symbian {
+ TARGET.UID3 = 0x20031D30
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -lxqservice -lxqserviceutil
+}
+
+HEADERS=../src.s60/requestapp.h
+
+include(../../../build/omj.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/main.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the makes Qt Highway API
+* request based on the command line of the application
+*
+*/
+
+#include <QTimer>
+
+#include "logger.h"
+#include "requestapp.h"
+
+
+int main(int argc, char **argv)
+{
+ LOG1(EJavaQtServiceApp, EInfo, "javaqtrequest main() called with %d args", argc);
+ for (int nInd = 0; nInd < argc; nInd++)
+ {
+ LOG2(EJavaQtServiceApp, EInfo, "javaqtrequest main() arg %d is %s", nInd, *(argv + nInd));
+ }
+
+ RequestApp app(argc, argv);
+
+ QTimer::singleShot(0, &app, SLOT(sendRequest()));
+
+ int ret = app.exec();
+
+ LOG1(EJavaQtServiceApp, EInfo, "javaqtrequest main() exiting with value %d", ret);
+
+ return ret;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/requestapp.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the implements support for
+* starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QList>
+#include <QUrl>
+#include <xqappmgr.h>
+#include <xqaiwrequest.h>
+
+#include "logger.h"
+#include "requestapp.h"
+
+
+RequestApp::RequestApp(int &argc, char **argv) : QApplication(argc, argv)
+{
+ LOG(EJavaQtServiceApp, EInfo, "RequestApp (QApplication) constructor called");
+}
+
+void RequestApp::sendRequest()
+{
+ QString uriString = arguments().at(1);
+ std::wstring stdWStrUri = uriString.toStdWString();
+ LOG1(EJavaQtServiceApp, EInfo,
+ "SLOT RequestApp::sendRequest called with Uri %S", stdWStrUri.c_str());
+
+ QUrl uri(uriString);
+ XQApplicationManager appMgr;
+ XQAiwRequest *request = appMgr.create(uri);
+ if (!request)
+ {
+ // No handlers for the URI
+ ELOG1(EJavaQtServiceApp,
+ "RequestApp::sendRequest No QtHighway service found for URI: %S",
+ stdWStrUri.c_str());
+ exit(KErrNotFound);
+ return;
+ }
+
+ // Set function parameters
+ QList<QVariant> args;
+ args << uri.toString();
+ request->setArguments(args);
+
+ // Send the request
+ if (!request->send())
+ {
+ // Request failed.
+ int error = request->lastError();
+ ELOG2(EJavaQtServiceApp,
+ "RequestApp::sendRequest QtHighway request failed "
+ "with err %d, URI was %S",
+ error, stdWStrUri.c_str());
+ delete request;
+ exit(KErrCompletion);
+ return;
+ }
+
+ delete request;
+
+ exit(KErrNone); // Exit with OK status
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/requestapp.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT Service application the makes Qt Highway API
+* request based on the command line of the application
+*
+*/
+
+#ifndef REQUESTAPP_H
+#define REQUESTAPP_H
+
+#include <QApplication>
+
+class RequestApp : public QApplication
+{
+ Q_OBJECT
+
+public:
+ RequestApp(int &argc, char **argv);
+
+public slots:
+ void sendRequest();
+};
+
+
+#endif // REQUESTAPP_H
--- a/javamanager/subsystem.mk Fri Jul 09 16:35:45 2010 +0300
+++ b/javamanager/subsystem.mk Fri Jul 23 12:27:20 2010 +0300
@@ -21,17 +21,16 @@
javainstaller \
javaregistry \
javabackup \
- javasettings
+ javasettings
COMPONENTS = \
preinstaller/build \
debugapi/build \
javalauncher/build \
- javaupgradeapp/build
-
+ javaupgradeapp/build
+
NONQTSUBSYSTEMS = \
- javarecognizer/build \
- javaappschemeplugin/build
+ javarecognizer/build
SYMBIAN_ONLY = \
javaregistry \
@@ -40,18 +39,20 @@
javabackup \
javarecognizer/build \
preinstaller/build \
- debugapi/build \
- javaappschemeplugin/build
+ debugapi/build
ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-NONQTSUBSYSTEMS += javasidchecker/build
-SYMBIAN_ONLY += javasidchecker/build
+NONQTSUBSYSTEMS += javasidchecker/build javaappschemeplugin/build
+SYMBIAN_ONLY += javasidchecker/build javaappschemeplugin/build
javasidchecker/build : javaregistry
+else
+COMPONENTS += javaappscheme/build javaqtrequest/build
+SYMBIAN_ONLY += javaappscheme/build javaqtrequest/build
endif
ifdef RD_JAVA_APPLICATION_SETTINGS_QT
-COMPONENTS += javasettings_qt/build
-SYMBIAN_ONLY += javasettings_qt/build
+COMPONENTS += javasettings_qt/build
+SYMBIAN_ONLY += javasettings_qt/build
endif
# Declare that release preparation removes subdirectories not in build, except
--- a/javaruntimes/installer/starterdll/src/main.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javaruntimes/installer/starterdll/src/main.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -377,7 +377,7 @@
L"com.nokia.mj.impl.installer.ui.eswt2.InstallerRuntimeUi");
#ifdef __SYMBIAN32__
#ifndef __WINS__
- jvm->appendSystemProperty(L"-Dcom.nokia.mj.impl.installer.ui.disableui=1");
+ //jvm->appendSystemProperty(L"-Dcom.nokia.mj.impl.installer.ui.disableui=1");
#endif //__WINS__
#endif // __SYMBIAN32__
#else // RD_JAVA_S60_RELEASE_10_1_ONWARDS
--- a/javaruntimes/midp/runtime/build/build.xml Fri Jul 09 16:35:45 2010 +0300
+++ b/javaruntimes/midp/runtime/build/build.xml Fri Jul 23 12:27:20 2010 +0300
@@ -33,7 +33,6 @@
<target name="system.properties">
<properties>
- microedition.hostname=localhost
microedition.jtwi.version=1.0
microedition.msa.version=1.1-SUBSET
microedition.profiles=MIDP-2.1
--- a/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -18,9 +18,7 @@
#include <memory>
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <SchemeHandler.h>
-#else
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
#include <schemehandler.h>
#endif
@@ -68,7 +66,7 @@
void PlatformRequestHandler::handleUri(const std::wstring& aUri)
{
JELOG2(EJavaRuntime);
- TRAPD(err,launchAppL(aUri););
+ TRAPD(err, launchAppL(aUri));
if (err != KErrNone)
{
ELOG1(EJavaRuntime, "ERROR!!! PlatformRequestHandler::handleUri() %d",
@@ -76,8 +74,8 @@
if (KErrNotFound == err)
{
if ((aUri.find(L"localapp:jam/launch?") == 0) ||
- (aUri.find(L"localapp://jam/launch?") == 0) ||
- (aUri.find(L"javaapp:") == 0))
+ (aUri.find(L"localapp://jam/launch?") == 0) ||
+ (aUri.find(L"javaapp:") == 0))
{
// The URI is supported but the MIDlet specified by the URI
// does not exist.
@@ -112,9 +110,71 @@
}
else
{
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ std::wstring uri;
+ std::wstring okScheme(L"javaapp:");
+ if (aUri.find(L"localapp:jam/launch?") == 0)
+ {
+ // Remove the scheme not supported by the devices in 10.1 from the
+ // beginning, replace it with okScheme that is supported
+ uri = okScheme;
+ uri += aUri.substr(20); // 20 == wstrlen(L"localapp:jam/launch?")
+ }
+ else if (aUri.find(L"localapp://jam/launch?") == 0)
+ {
+ uri = okScheme;
+ uri += aUri.substr(22); // 22 == wstrlen(L"localapp://jam/launch?")
+ }
+ else if (aUri.find(L"javaapp://") == 0)
+ {
+ // TODO: after QtHighway has been fixed to that
+ // it can recognize "javaapp://" scheme, remove this.
+ // At 2010wk26 it recognizes only "javaapp:"
+ uri = okScheme;
+ uri += aUri.substr(10); // 10 == wstrlen(L"javaapp://")
+ }
+ else
+ {
+ uri = aUri;
+ }
+ LOG1(EJavaRuntime, EInfo, "Platform request. Converted uri: %S", uri.c_str());
+
+ TPtrC ptr((const TUint16 *)uri.c_str(), uri.length());
+ // Start javaqtrequest.exe so that url is command line argument.
+ // javaqtrequest is a Qt application that will use Qt Highway API
+ // to send the url request to correct XQServiceProvider
+ _LIT(KJavaQtRequestExe, "javaqtrequest.exe");
+ RProcess rProcess;
+ TInt err = rProcess.Create(KJavaQtRequestExe, ptr);
+ if (KErrNone != err)
+ {
+ ELOG1(EJavaRuntime,
+ "PlatformRequestHandler: launchAppL: Starting javaqtrequest.exe failed, err %d",
+ err);
+ User::Leave(err);
+ }
+
+ // Wait until javaqtrequest exits
+ TRequestStatus status;
+ rProcess.Logon(status);
+ rProcess.Resume();
+ User::WaitForRequest(status);
+
+ // Check the exit code of javaqtrequest
+ err = status.Int();
+ rProcess.Close();
+ if (err != KErrNone)
+ {
+ ELOG1(EJavaRuntime,
+ "PlatformRequestHandler: launchAppL: javaqtrequest.exe exited with err %d",
+ err);
+ User::Leave(err);
+ }
+#else
TPtrC ptr((const TUint16 *)aUri.c_str(), aUri.length());
std::auto_ptr<CSchemeHandler> schemeHandler(CSchemeHandler::NewL(ptr));
schemeHandler->HandleUrlStandaloneL(); // Process Uri in standalone mode.
+#endif
}
}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Jul 23 12:27:20 2010 +0300
@@ -20,6 +20,7 @@
import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Internal_PackageSupport;
+import org.eclipse.swt.graphics.Point;
import java.io.IOException;
import java.io.InputStream;
@@ -432,6 +433,43 @@
static Image createImageWithoutSecurityCheck(Device device, String filename) {
return new Image(device, filename, false);
}
+
+ /*
+ * Returns the bounds of an image without creating an Image instance.
+ */
+ static Point getImageSize(Device device, String filename) {
+
+ if (filename == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ InputStream is = device.getClass().getResourceAsStream(filename);
+
+ if (is == null) {
+ SWT.error(SWT.ERROR_IO);
+ }
+
+ return getImageSize(is);
+ }
+
+ /*
+ * Returns the bounds of an image without creating an Image instance.
+ */
+ static Point getImageSize(InputStream stream) {
+ Point point = null;
+
+ try {
+ point = org.eclipse.swt.internal.qt.graphics.ImageLoader.getImageSize(stream);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO);
+ } catch (NullPointerException e) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ } catch (IllegalArgumentException e) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ return point;
+ }
/**
* Disposes of the operating system resources associated with the image.
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri Fri Jul 23 12:27:20 2010 +0300
@@ -10,7 +10,8 @@
#*******************************************************************************
QT += core \
- gui
+ gui \
+ svg
DEFINES += SWTQT_LIBRARY
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -11,6 +11,11 @@
#include <QFont>
#include <QFontMetrics>
#include <QSharedDataPointer>
+#include <QByteArray>
+#include <QBuffer>
+#include <QImageReader>
+#include <QSize>
+#include <QSvgRenderer>
#include <org_eclipse_swt_internal_qt_graphics_OS.h>
#include "graphics.h"
@@ -1244,6 +1249,46 @@
GFX_CATCH
}
+JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1getImageSize
+ (JNIEnv *aJniEnv, jclass, jbyteArray aData)
+{
+ jobject size = NULL;
+ GFX_TRY
+ {
+ SWT_LOG_JNI_CALL();
+
+ jbyte* data = NULL;
+ data = aJniEnv->GetByteArrayElements(aData, NULL);
+ int length = aJniEnv->GetArrayLength(aData);
+
+ QByteArray array = QByteArray::fromRawData(reinterpret_cast<const char*>(data), length);
+ QBuffer buffer(&array);
+ buffer.open(QIODevice::ReadOnly);
+
+ // Initialize imageReader
+ QImageReader imgReader(&buffer);
+ QSize imageSize(-1,-1);
+
+ if (imgReader.supportsOption(QImageIOHandler::Size))
+ {
+ imageSize = imgReader.size();
+ }
+ else //if (imgReader.format() == "svg")
+ {
+ // Qt SVG plugin does not support QImageIOHandler::Size option,
+ // use QSvgRenderer to get the default size of the image instead.
+ QSvgRenderer svg(array);
+ imageSize = svg.defaultSize();
+ }
+
+ size = swtApp->jniUtils().NewJavaPoint( aJniEnv, QPoint(imageSize.width(), imageSize.height()));
+
+ aJniEnv->ReleaseByteArrayElements(aData, data, JNI_ABORT);
+ }
+ GFX_CATCH
+
+ return size;
+}
//
// FontUtils
//
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java Fri Jul 23 12:27:20 2010 +0300
@@ -11,6 +11,8 @@
package org.eclipse.swt.graphics;
+import java.io.InputStream;
+
/**
* <p>
* <b>IMPORTANT:</b> This class is <em>not</em> part of the SWT public API. It
@@ -63,4 +65,13 @@
String filename) {
return Image.createImageWithoutSecurityCheck(device, filename);
}
+
+public static Point getImageSize(Device device, String filename) {
+ return Image.getImageSize(device, filename);
}
+
+public static Point getImageSize(InputStream stream) {
+ return Image.getImageSize(stream);
+}
+
+}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java Fri Jul 23 12:27:20 2010 +0300
@@ -754,25 +754,6 @@
{
return KeyTable.getKeyName(keyCode);
}
- /**
- * Gets height.
- *
- * @return Height of the Displayable in pixels.
- */
- public int getHeight()
- {
- if(onScreenkeypad != null)
- {
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- oskHeight = onScreenkeypad.getHeight();
- }
- });
- }
- return (super.getHeight() - oskHeight);
- }
/**
* Callback to be implemented by the application to render the
@@ -1563,9 +1544,11 @@
class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener
{
public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) {
- if (javax.microedition.lcdui.Canvas.this.getShell() == widget)
+ if (javax.microedition.lcdui.Canvas.this.getShell() == widget && graphicsBuffer != null)
{
- graphicsBuffer.getWindowSurface().handleSymbianWindowVisibilityChange(visible);
+ WindowSurface surface = graphicsBuffer.getWindowSurface();
+ if (surface != null)
+ surface.handleSymbianWindowVisibilityChange(visible);
}
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceImpl.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -295,9 +295,9 @@
validateSelectedArray(selectedArray);
final int size = size();
int numSelected = 0;
- for(int i = 0; i < size; i++)
+ for(int i = 0; i < selectedArray.length; i++)
{
- if(((ChoiceData) items.elementAt(i)).sel)
+ if( (i < size) && (((ChoiceData) items.elementAt(i)).sel))
{
selectedArray[i] = true;
numSelected++;
@@ -306,7 +306,8 @@
{
selectedArray[i] = false;
}
- }
+ }
+
return numSelected;
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java Fri Jul 23 12:27:20 2010 +0300
@@ -100,6 +100,7 @@
calendar.set(Calendar.HOUR_OF_DAY,0);
calendar.set(Calendar.MINUTE,0);
calendar.set(Calendar.SECOND,0);
+ calendar.set(Calendar.MILLISECOND,0);
}
return calendar.getTime();//date;
}
@@ -216,6 +217,8 @@
date = calendar.getTime();
break;
case DATE_TIME:
+ calendar.set(Calendar.SECOND,0);
+ calendar.set(Calendar.MILLISECOND,0);
date = calendar.getTime();
break;
default:
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Display.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Display.java Fri Jul 23 12:27:20 2010 +0300
@@ -201,12 +201,12 @@
*/
public int eswtNumColors()
{
-
- final int MAX_SHIFT = 30;
+ final int MAX_SHIFT = 24;
Screen[] screens = MobileDevice.getMobileDevice().getScreens();
Screen activeScreen = null;
int depth = 0;
+
if(screens != null)
{
for(int i = 0; i < screens.length; i++)
@@ -216,22 +216,20 @@
activeScreen = screens[i];
}
}
+
depth = activeScreen.getColorDepth();
- if(depth > MAX_SHIFT)
+
+ if(depth >= MAX_SHIFT)
{
- numColors = Integer.MAX_VALUE;
+ // For 16 Million Colors
+ numColors = (1 << 24);
}
else
{
numColors = (1 << depth);
}
}
- else
- {
- numColors = 0;
- }
- numColors = 2 << 16;
return numColors;
}
@@ -552,6 +550,9 @@
*/
public int getBestImageWidth(int imgType)
{
+ if ((imgType < LIST_ELEMENT) || (imgType > ALERT))
+ throw new IllegalArgumentException();
+
return DisplayExtension.getBestImageWidth(imgType);
}
@@ -563,6 +564,9 @@
*/
public int getBestImageHeight(int imgType)
{
+ if ((imgType < LIST_ELEMENT) || (imgType > ALERT))
+ throw new IllegalArgumentException();
+
return DisplayExtension.getBestImageHeight(imgType);
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Fri Jul 23 12:27:20 2010 +0300
@@ -52,6 +52,7 @@
private int maxValue;
private int value;
private boolean interactive;
+ private boolean isGaugeCreation;
/**
* Constructor.
@@ -64,9 +65,11 @@
public Gauge(String name, boolean interactive, int maxVal, int initVal)
{
setLabel(name);
+ isGaugeCreation = true;
this.interactive = interactive;
setMaxValue(maxVal);
setValue(initVal);
+ isGaugeCreation = false;
}
/**
@@ -76,22 +79,30 @@
* @param maxVal the maximum value.
* @return validated value.
*/
- private static int checkValue(int value, int maxVal)
+ private int checkValue(int value, int maxVal)
{
if(maxVal == INDEFINITE)
{
- switch(value)
+ if(isGaugeCreation)
{
- case CONTINUOUS_IDLE:
- case INCREMENTAL_IDLE:
- case CONTINUOUS_RUNNING:
- case INCREMENTAL_UPDATING:
- break;
- default:
- throw new IllegalArgumentException(
- MsgRepository.GAUGE_EXCEPTION_INVALID_VALUE);
+ switch(value)
+ {
+ case CONTINUOUS_IDLE:
+ case INCREMENTAL_IDLE:
+ case CONTINUOUS_RUNNING:
+ case INCREMENTAL_UPDATING:
+ break;
+ default:
+ throw new IllegalArgumentException(
+ MsgRepository.GAUGE_EXCEPTION_INVALID_VALUE);
+ }
+
+ return value;
}
- return value;
+ else
+ {
+ return CONTINUOUS_IDLE;
+ }
}
else
{
@@ -111,18 +122,14 @@
*/
private static int checkMaxValue(int maxVal, boolean interactive)
{
- if(!interactive)
+ if(interactive)
{
- if(maxVal == INDEFINITE)
+ if(maxVal <= 0)
{
- return maxVal;
+ throw new IllegalArgumentException(
+ MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
}
}
- if(maxVal <= 0)
- {
- throw new IllegalArgumentException(
- MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
- }
return maxVal;
}
@@ -257,7 +264,7 @@
{
return (!isInteractive()
&& getParent() == null
- && !hasLabel()
+ && getLabel() == null
&& getLayout() == Item.LAYOUT_DEFAULT
&& !isSizeLocked()
&& getNumCommands() == 0
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java Fri Jul 23 12:27:20 2010 +0300
@@ -750,7 +750,7 @@
public void drawSubstring(java.lang.String string, int offset, int length,
int xPos, int yPos, int anch)
{
- drawString(string.substring(offset, length), xPos, yPos, anch);
+ drawString(string.substring(offset, offset+length), xPos, yPos, anch);
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/KeyTable.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/KeyTable.java Fri Jul 23 12:27:20 2010 +0300
@@ -27,29 +27,33 @@
static final int[][] KEY_TO_GAME_TABLE =
{
{-1, Canvas.UP},
- {50, Canvas.UP},
+ {Canvas.KEY_NUM2, Canvas.UP},
{SWT.ARROW_UP, Canvas.UP},
{-2, Canvas.DOWN},
- {56, Canvas.DOWN},
+ {Canvas.KEY_NUM8, Canvas.DOWN},
{SWT.ARROW_DOWN, Canvas.DOWN},
{-3, Canvas.LEFT},
- {52, Canvas.LEFT},
+ {Canvas.KEY_NUM4, Canvas.LEFT},
{SWT.ARROW_LEFT, Canvas.LEFT},
{-4, Canvas.RIGHT},
- {54, Canvas.RIGHT},
+ {Canvas.KEY_NUM6, Canvas.RIGHT},
{SWT.ARROW_RIGHT, Canvas.RIGHT},
{-5, Canvas.FIRE},
- {53, Canvas.FIRE},
+ {Canvas.KEY_NUM5, Canvas.FIRE},
{-10, Canvas.FIRE},
- {55, Canvas.GAME_A},
- {57, Canvas.GAME_B},
- {42, Canvas.GAME_C},
- {35, Canvas.GAME_D},
+ {Canvas.KEY_NUM7, Canvas.GAME_A},
+ {Canvas.KEY_NUM9, Canvas.GAME_B},
+ {Canvas.KEY_STAR, Canvas.GAME_C},
+ {Canvas.KEY_POUND, Canvas.GAME_D},
+
+ {Canvas.KEY_NUM0, 0},
+ {Canvas.KEY_NUM1, 0},
+ {Canvas.KEY_NUM3, 0}
};
/**
@@ -91,43 +95,42 @@
switch(keyCode)
{
- /*case Canvas.KEY_NUM0:
- return "0";
+ case Canvas.KEY_NUM0:
+ return "0";
- case Canvas.KEY_NUM1:
- return "1";
+ case Canvas.KEY_NUM1:
+ return "1";
- case Canvas.KEY_NUM2:
- return "2";
+ case Canvas.KEY_NUM2:
+ return "2";
- case Canvas.KEY_NUM3:
- return "3";
+ case Canvas.KEY_NUM3:
+ return "3";
- case Canvas.KEY_NUM4:
- return "4";
+ case Canvas.KEY_NUM4:
+ return "4";
- case Canvas.KEY_NUM5:
- return "5";
+ case Canvas.KEY_NUM5:
+ return "5";
- case Canvas.KEY_NUM6:
- return "6";
+ case Canvas.KEY_NUM6:
+ return "6";
- case Canvas.KEY_NUM7:
- return "7";
+ case Canvas.KEY_NUM7:
+ return "7";
- case Canvas.KEY_NUM8:
- return "8";
+ case Canvas.KEY_NUM8:
+ return "8";
- case Canvas.KEY_NUM9:
- return "9";
-
+ case Canvas.KEY_NUM9:
+ return "9";
- case Canvas.KEY_STAR:
- return "*";
+ case Canvas.KEY_STAR:
+ return "*";
- case Canvas.KEY_POUND:
- return "#";
- */
+ case Canvas.KEY_POUND:
+ return "#";
+
case -1:
return OpenLcduiLocalization.getMessage("key_up");
@@ -144,7 +147,8 @@
return OpenLcduiLocalization.getMessage("key_select");
default:
- return "";
+ throw new IllegalArgumentException(
+ MsgRepository.CANVAS_EXCEPTION_INVALID_KEY_CODE);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/.cproject Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" extraSBSv2Args="" infBuildComponents="" infFileLocation="build\bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Emulator Debug (WINSCW) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;__WINSCW__;RD_JAVA_UI_QT;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__CW32__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;QT_USE_MATH_H_FLOATS;__S60_3X__;__WINS__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;_DEBUG;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586007160" useMmpMacrosCache="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+<cconfiguration id="Emulator Release (WINSCW) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Release (WINSCW) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Release (WINSCW) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;__WINSCW__;RD_JAVA_UI_QT;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__CW32__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;QT_USE_MATH_H_FLOATS;__S60_3X__;__WINS__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586008004" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Debug (ARMV5) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586008441" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Release (ARMV5) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586049270" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Debug (ARMV6) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV6) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV6) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;__ARMV6__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586049864" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Release (ARMV6) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV6) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV6) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;__ARMV6__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586050380" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Debug (ARMV7) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV7) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV7) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;__ARMV7__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586051427" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Release (ARMV7) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV7) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV7) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;__ARMV7__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586051833" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Debug (ARMV9E) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV9E) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV9E) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;RD_JAVA_S60_RELEASE_5_0_ONWARDS;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_STDCPPV5;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_S60_RELEASE_9_2_ONWARDS;RD_JAVA_NGA_ENABLED;QT_USE_MATH_H_FLOATS;__S60_3X__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;_DEBUG;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586052239" useMmpMacrosCache="true"/>
+</cconfiguration>
+<cconfiguration id="Phone Release (ARMV9E) [mcl_wk_26]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV9E) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV9E) [mcl_wk_26]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;RD_JAVA_S60_RELEASE_5_0_ONWARDS;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_STDCPPV5;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_S60_RELEASE_9_2_ONWARDS;RD_JAVA_NGA_ENABLED;QT_USE_MATH_H_FLOATS;__S60_3X__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586052645" useMmpMacrosCache="true"/>
+</cconfiguration>
+</storageModule>
+</cproject>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/.project Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>javam2g_0x2002DCBD</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
+ <nature>com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/build/build.xml Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,64 @@
+<!--
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+-->
+
+<project name="javam2g" default="deploy" basedir=".">
+
+ <import file="../../../build/utilities.xml"/>
+
+ <!-- Needed by the utilities.xml. See the description form the utilities.xml
+ file -->
+
+ <target name="compile">
+ <omj.javac classpath="${classpath}:${impl.cldc.jar}"/>
+ </target>
+
+
+ <!-- Needed by the utilities.xml. See the description form the utilities.xml
+ file -->
+
+ <property name="javah.classnames"
+ value="com.nokia.microedition.m2g.M2GDocument,
+ com.nokia.microedition.m2g.M2GSVGPath,
+ com.nokia.microedition.m2g.M2GSVGSVGElement,
+ com.nokia.microedition.m2g.M2GManager,
+ com.nokia.microedition.m2g.M2GScalableGraphics,
+ com.nokia.microedition.m2g.M2GSVGAnimationElement,
+ com.nokia.microedition.m2g.M2GSVGElement,
+ com.nokia.microedition.m2g.M2GSVGImage,
+ com.nokia.microedition.m2g.M2GRunnableQt"/>
+
+ <target name="system.properties">
+ <properties>
+ microedition.m2g.svg.baseProfile=tiny
+ microedition.m2g.svg.version=1.1
+ microedition.m2g.version=1.1
+ </properties>
+ </target>
+
+ <target name="create.public.api.jar">
+ <omj.public.apis includes="javax/microedition/m2g/ExternalResourceHandler.class,
+ javax/microedition/m2g/ScalableGraphics.class,
+ javax/microedition/m2g/ScalableImage.class,
+ javax/microedition/m2g/SVGAnimator.class,
+ javax/microedition/m2g/SVGEventListener.class,
+ javax/microedition/m2g/SVGImage.class"/>
+ </target>
+
+
+</project>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/build/bwins/javam2gu.def Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/build/javam2g.pro Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE=lib
+TARGET=javam2g
+CONFIG += omj java stl
+#CONFIG -= qt
+
+SOURCES += ../src/*.cpp
+SOURCES += ../src/jni/*.cpp
+
+LIBS += -lavkon \
+ -lbitgdi \
+ -lcharconv \
+ -lcone \
+ -leikcore \
+ -eswtqt \
+ -lfbscli \
+ -lgdi \
+ -ljavalegacyutils \
+ -lSVGEngineJI \
+ -lopenlcdui \
+ -lefsrv \
+ -lfbscli \
+ -limageconversion
+
+include(../../../build/omj.pri )
+
+INCLUDEPATH += ../../eswt_qt/org.eclipse.ercp.swt.s60/native/inc/
+INCLUDEPATH += ../../lcdui_qt/lcdgr/inc/
+INCLUDEPATH += ../../lcdui_qt/javalcdui/inc/
+INCLUDEPATH += ../../eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/CM2GEventSource.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event server framework's event source implementation
+*
+*/
+
+#ifndef CM2GEVENTSOURCE_H
+#define CM2GEVENTSOURCE_H
+
+// INCLUDE FILES
+#include <mevents.h> // CJavaEventSource, TConstructor
+#include "M2GGeneral.h"
+
+M2G_NS_START
+// CONSTANTS
+
+// DATA TYPES
+
+// MACROS
+
+// FORWARD DECLARATIONS
+
+// FUNCTION PROTOTYPES
+
+// CLASS DECLARATION
+/**
+ * @class CJavaM3GEventSource
+ * @brief Event source
+ */
+class CM2GEventSource : public CJavaEventSource<CM2GEventSource>
+{
+public:
+ /**
+ * Two-phased constructor.
+ * @since Series S60 3.1
+ * @param aJni JNI environment
+ * @param aPeer Peer object
+ * @param aServer Server
+ * @return Event source handle
+ */
+ static TInt NewL(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer);
+
+ /**
+ * Dtor
+ * @since Series S60 3.1
+ */
+ virtual ~CM2GEventSource();
+
+private:
+ /**
+ * Ctor
+ * @since Series S60 3.1
+ */
+ CM2GEventSource();
+
+ /**
+ * Constructor
+ * @since Series S60 3.1
+ * @param aJni JNI environment
+ * @param aPeer Peer object
+ * @param aServer Server
+ */
+ void ConstructL(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer);
+
+ /**
+ * C++ copy constructor
+ * @since Series S60 3.1
+ */
+ CM2GEventSource(const CM2GEventSource&);
+
+ /**
+ * C++ assignment operator
+ * @since Series S60 3.1
+ */
+ CM2GEventSource& operator=(const CM2GEventSource&);
+
+};
+
+M2G_NS_END
+
+#endif // CM2GEVENTSOURCE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/CM2GRenderContext.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Render context
+*
+*/
+
+#ifndef CM2GRENDERCONTEXT_H
+#define CM2GRENDERCONTEXT_H
+
+// INCLUDES
+#include <fbs.h>
+#include "MM2GRenderContext.h"
+#include <graphics.h>
+
+class CSvgtBitmap;
+
+M2G_NS_START
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MM2GSVGProxy;
+class CBitmapContext;
+#ifdef RD_JAVA_NGA_ENABLED
+class MMIDCanvas;
+#endif // RD_JAVA_NGA_ENABLED
+
+// CLASS DECLARATION
+/**
+ * Render context
+ */
+
+
+class CM2GRenderContext : public CBase, public MM2GRenderContext
+{
+private: // METHODS
+ /**
+ * C++ default constructor.
+ */
+ CM2GRenderContext();
+
+ /**
+ * C++ copy constructor
+ */
+ CM2GRenderContext(const CM2GRenderContext&);
+
+ /**
+ * C++ assignment operator
+ */
+ CM2GRenderContext& operator=(const CM2GRenderContext&);
+
+ /**
+ * Initialization
+ */
+ void ConstructL(MM2GSVGProxy* aProxy);
+
+public: // METHODS
+ /**
+ * Two-phased constructor.
+ */
+ static CM2GRenderContext* NewL(MM2GSVGProxy* aProxy);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CM2GRenderContext();
+
+ /**
+ * @see MM2GRenderContext::BindL()
+ */
+ virtual void BindL(TInt& aGraphicsHandle);
+
+ /**
+ * @see MM2GRenderContext::InitImageBitmapL()
+ */
+ virtual void InitImageBitmapL();
+
+ /**
+ * @see MM2GRenderContext::BlitToL()
+ */
+ virtual void ReleaseL();
+
+ /**
+ * @see MM2GRenderContext::RenderL()
+ */
+ virtual void RenderLCDUIL(
+ TM2GSvgDocumentHandle& aSvgDocumentHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW, TInt aSvgH,
+ TM2GRenderRect& aRect);
+ virtual void RenderESWTL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW, TInt aSvgH,
+ TM2GRenderRect& aRect,
+ TBool aUseNativeClear,
+ TInt* aReturnData);
+
+ /**
+ * @see MM2GRenderContext::SetRenderingQualityL()
+ */
+ virtual void SetRenderingQualityL(TInt aMode);
+
+ /**
+ * @see MM2GRenderContext::SetTransparency()
+ */
+ virtual void SetTransparency(TReal32 aAlpha);
+
+
+ TInt SaveBitmapL(const CFbsBitmap& aNVGBitmap, const TFileName& aFileName);
+protected: // METHODS
+ /**
+ * Get the image's bitmap handle
+ *
+ * @return Svg surface handle.
+ * @throws Exception if not ok.
+ */
+ TM2GBitmapHandle GetImgHandleL() const;
+
+private:
+ /**
+ * Prepare viewbox and anchor
+ *
+ * @param aRr clip area information
+ * @return aViewbox render rectangle area
+ * @return aAnchor recalculated anchor point
+ */
+ void PrepareViewbox(
+ TM2GRenderRect& aRr,
+ TInt aSvgW, TInt aSvgH,
+ TRect& aViewbox, TPoint& aAnchor);
+
+ /**
+ * Renders a SVG document at a current time.
+ *
+ * <p> The rendering is done in 2 steps:
+ * <li> render the document on an internal SVG buffer (iSvg)
+ * <li> alpha-blend it with the bound graphics target (iGraphicsBitmap)
+ *
+ * @note if transparency factor is not set, iSvg is simply blitted onto iGraphicsTarget
+ *
+ * @param aSvgDocumentHandle handle to SVG document
+ * @param aCurrentTime the current time of the animation
+ * @param aSvgW Svg image viewport width
+ * @param aSvgH Svg image viewport height
+ * @param aRect contains position about the rendered area
+ * @param aAnchor anchor point
+ *
+ * @since S60 3.1
+ */
+ void RenderLCDUIL(
+ TM2GSvgDocumentHandle& aSvgDocumentHandle,
+ const TReal32 aCurrentTime,
+ const TRect& aViewbox,
+ const TPoint& aAnchor);
+
+ void RenderESWTL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ TReal32 aCurrentTime,
+ const TRect& aViewbox,
+ const TPoint& aAnchor,
+ TBool aUseNativeClear,
+ TInt* aReturnData);
+
+ /**
+ * Clear the bitmap with 0
+ * Fills all pixel with 0 value
+ *
+ * @param aBmp the bitmap to be filled
+ */
+ void CM2GRenderContext::ClearBitmapL(CFbsBitmap* aBmp);
+
+ /**
+ * Fills all the pixels of a bitmap with a specific byte
+ *
+ * @param aBmp the bitmap to be filled
+ * @param aChar the character(byte) to fill with
+ */
+ void FillBitmapL(CFbsBitmap* aBmp, const TUint8& aChar);
+
+
+private: // VARIABLES
+
+ //For WindowsSurface CFbsBitmap || Qimage
+ Java::GFX::WindowSurface* iWindowSurface;
+
+
+ MM2GSVGProxy* iProxy;
+
+ TM2GSvgEngineHandle iEngineHandle;
+
+ TReal32 iAlpha;
+ TUint8 iScaledAlpha;
+
+//for eswt compatibility
+ CFbsBitmap* iImgBmp;
+ RFbsSession iFbsSession;
+
+
+// Temporary buffer ( offscreen ) for QImage support
+ QImage* iOffScreenQImage;
+ CFbsBitmap* iOffScreenBitmap;
+
+ QImage* iTargetQImage;
+
+ Java::GFX::WindowSurfaceType wSurfaceType;
+ CSvgtBitmap * targetBitmap;
+
+ CFbsBitmap* tempBitmapForMask ;
+
+protected:
+ TM2GSvgBitmapHandle GetBufferHandleL() const;
+ void InitializeQImageOffscreenBufferL(TSize aScreenSize,QImage* aQimage);
+ void InitializeCFbsBitmapOffscreenBufferL(TSize aScreenSize,CFbsBitmap* aBitmap);
+ void ClearSurfaceL(TM2GSvgBitmapHandle aSvgtBmpHandle);
+private:
+
+};
+/*-----------------------------------------------------------
+class : CFbsBitmapHack
+purpose: Class is provided as a solution for double render
+ issue in eSWT
+*-----------------------------------------------------------*/
+class CFbsBitmapHack : public CFbsBitmap
+{
+public:
+ TInt GetMyHandle()
+ {
+ return iHandle;
+ }
+};
+
+
+M2G_NS_END
+#endif // CM2GRENDERCONTEXT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/CM2GSVGProxy.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,585 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGTopt proxy
+*
+*/
+
+#ifndef CM2GSVGPROXY_H
+#define CM2GSVGPROXY_H
+
+// INCLUDES
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSvgJavaInterfaceImpl;
+
+// CLASS DECLARATION
+/**
+ *
+ */
+class CM2GSVGProxy : public CBase, public MM2GSVGProxy
+{
+public: // METHODS
+ /**
+ * Two-phased constructor.
+ * @return Reference counted proxy wrapper
+ */
+ static CM2GSVGProxy* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CM2GSVGProxy();
+
+ /**
+ * @see MM2GSVGProxy::AddCloseL
+ */
+ virtual void AddCloseL(const TM2GSvgPathHandle& aPathHandle);
+
+ /**
+ * @see MM2GSVGProxy::AddCurveToL
+ */
+ virtual void AddCurveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TM2GPathCurveData& aPathCurveData);
+
+ /**
+ * @see MM2GSVGProxy::AddLineToL
+ */
+ virtual void AddLineToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY);
+
+ /**
+ * @see MM2GSVGProxy::AddMoveToL
+ */
+ virtual void AddMoveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY);
+
+ /**
+ * @see MM2GSVGProxy::AddQuadToL
+ */
+ virtual void AddQuadToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX1, const TReal32& aY1,
+ const TReal32& aX2, const TReal32& aY2);
+
+ /**
+ * @see MM2GSVGProxy::AppendChildL
+ */
+ virtual void AppendChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::BeginElementAtL
+ */
+ virtual void BeginElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset);
+
+ /**
+ * @see MM2GSVGProxy::CheckRemoveableL
+ */
+ virtual void CheckRemoveableL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aRemoveable);
+
+ /**
+ * @see MM2GSVGProxy::ClearSvgSurfaceL
+ */
+ virtual void ClearSvgSurfaceL(const TM2GBitmapHandle& aSurfaceHandle);
+
+ /**
+ * @see MM2GSVGProxy::CreateDocumentL
+ */
+ virtual void CreateDocumentL(
+ const TPtrC16& aData,
+ TM2GSvgDocumentHandle& aDocumentHandle);
+
+ /**
+ * @see MM2GSVGProxy::CreateElementNsL
+ */
+ virtual void CreateElementNsL(
+ const TM2GSvgAttrType& aType,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TM2GSvgElementHandle& aElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::CreatePathL
+ */
+ virtual void CreatePathL(TM2GSvgPathHandle& aPathHandle);
+
+
+ /**
+ * @see MM2GSVGProxy::CreateSvgEngineL
+ */
+ virtual void CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle);
+
+
+ /**
+ * @see MM2GSVGProxy::TSvgSurfaceHandleL
+ */
+ virtual TM2GBitmapHandle CreateSvgSurfaceL(TInt aWidth, TInt aHeight);
+
+ /**
+ * @see MM2GSVGProxy::DeleteDocumentL
+ */
+ virtual void DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle);
+
+ /**
+ * @see MM2GSVGProxy::DeleteSvgEngineL
+ */
+ virtual void DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle);
+
+ /**
+ * @see MM2GSVGProxy::DeleteSvgSurfaceL
+ */
+ virtual void DeleteSvgSurfaceL(const TM2GBitmapHandle& aSurfaceHandle);
+
+ /**
+ * @see MM2GSVGProxy::DestroyPathL
+ */
+ virtual void DestroyPathL(const TM2GSvgPathHandle& aPathHandle);
+
+ /**
+ * @see MM2GSVGProxy::DispatchMouseEventL
+ */
+ virtual void DispatchMouseEventL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::EndElementAtL
+ */
+ virtual void EndElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset);
+
+ /**
+ * @see MM2GSVGProxy::FocusOnL
+ */
+ virtual void FocusOnL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::FocusOutL
+ */
+ virtual void FocusOutL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetBBoxL
+ */
+ virtual void GetBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult);
+
+ /**
+ * @see MM2GSVGProxy::GetColorTraitL
+ */
+ virtual void GetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GColorData& aColor,
+ TInt& aResult);
+
+ /**
+ * @see MM2GSVGProxy::GetElementByIdL
+ */
+ virtual void GetElementByIdL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aId,
+ TM2GSvgElementHandle& aElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetElementTypeIdL
+ */
+ virtual void GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId);
+
+ /**
+ * @see MM2GSVGProxy::GetEnumAttributeL
+ */
+ virtual void GetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt16& aEnumTrait);
+
+ /**
+ * @see MM2GSVGProxy::GetExternalItemL
+ */
+ virtual TInt GetExternalListItemL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aIndex,
+ TPtrC16& aItem);
+
+ /**
+ * @see MM2GSVGProxy::GetExternalListSizeL
+ */
+ virtual void GetExternalListSizeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aListSz);
+
+ /**
+ * @see MM2GSVGProxy::GetFirstElementChildL
+ */
+ virtual void GetFirstElementChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aChildHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetFloatTraitL
+ */
+ virtual void GetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TReal32& aFloatTrait);
+
+ /**
+ * @see MM2GSVGProxy::GetMatrixTraitL
+ */
+ virtual void GetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GMatrixData& aMatrix, TInt& aResult);
+
+ /**
+ * @see MM2GSVGProxy::GetMediaTimeL
+ */
+ virtual void GetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TReal32& aSeconds);
+
+ /**
+ * @see MM2GSVGProxy::GetNextElementSiblingL
+ */
+ virtual void GetNextElementSiblingL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aSiblingElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetNumberOfSegmentsL
+ */
+ virtual void GetNumberOfSegmentsL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt& aNumberOfSegments);
+
+ /**
+ * @see MM2GSVGProxy::GetParentL
+ */
+ virtual void GetParentL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aParentElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetPathTraitL
+ */
+ virtual void GetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt& aPathTrait);
+
+ /**
+ * @see MM2GSVGProxy::GetRectTraitL
+ */
+ virtual void GetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult);
+
+ /**
+ * @see MM2GSVGProxy::GetRootElementL
+ */
+ virtual void GetRootElementL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TM2GSvgElementHandle& aRootElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetScreenBBoxL
+ */
+ virtual void GetScreenBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GScreenBBoxData& aScreenBBoxData);
+
+ /**
+ * @see MM2GSVGProxy::GetSegmentParameterL
+ */
+ virtual void GetSegmentParameterL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex, TInt aParamIndex,
+ TReal32& aSegmentParam);
+
+ /**
+ * @see MM2GSVGProxy::GetSegmentTypeL
+ */
+ virtual void GetSegmentTypeL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex,
+ TInt16& aSegmentType);
+
+ /**
+ * @see MM2GSVGProxy::GetStringTraitL
+ */
+ virtual TInt GetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TPtrC16& aStr);
+
+
+ /**
+ * @see MM2GSVGProxy::GetSvgSurfaceHeightL
+ */
+ virtual TInt GetSvgSurfaceHeightL(const TM2GBitmapHandle& aSurfaceHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetSvgSurfaceWidthL
+ */
+ virtual TInt GetSvgSurfaceWidthL(const TM2GBitmapHandle& aSurfaceHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetUsedFromElement
+ */
+ virtual void GetUsedFromElementL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aHandle);
+
+ /**
+ * @see MM2GSVGProxy::GetViewportHeightL
+ */
+ virtual void GetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aHeight);
+
+ /**
+ * @see MM2GSVGProxy::GetViewportWidthL
+ */
+ virtual void GetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aWidth);
+
+ /**
+ * @see MM2GSVGProxy::InitViewportL
+ */
+ virtual void InitViewportL(
+ const TM2GSvgDocumentHandle& aDocumentHandle);
+
+ /**
+ * @see MM2GSVGProxy::InsertBeforeL
+ */
+ virtual void InsertBeforeL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aNewChildElementHandle,
+ const TM2GSvgElementHandle& aReferenceElementHandle);
+
+ /**
+ * @see MM2GSVGProxy::IsActiveL
+ */
+ virtual void IsActiveL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aActive);
+
+ /**
+ * @see MM2GSVGProxy::IsElementInDomL
+ */
+ virtual void IsElementInDomL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aIsElementInDom);
+
+ /**
+ * @see MM2GSVGProxy::IsUsedL
+ */
+ virtual void IsUsedL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aResult);
+
+ /**
+ * @see MM2GSVGProxy::RemoveChildL
+ */
+ virtual void RemoveChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle,
+ TM2GSvgElementHandle& aHandle);
+
+ /**
+ * @see MM2GSVGProxy::RenderDocumentL
+ */
+ virtual void RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GBitmapHandle& aSurfaceHandle,
+ TM2GBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime);
+
+// pankaj Qimage related changes TODO following Changes done
+ virtual void RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgBitmapHandle& aSurfaceHandle,
+ TM2GSvgBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime);
+ /**
+ * @see MM2GSVGProxy::RenderQualityL
+ */
+ virtual void RenderQualityL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ TInt aQuality);
+ /**
+ * @see MM2GSVGProxy::RequestCompletedL
+ */
+ virtual void RequestCompletedL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aURI,
+ const TPtrC8& aResourceData,
+ TInt& aCompleted);
+
+ /**
+ * @see MM2GSVGProxy::SetColorTraitL
+ */
+ virtual void SetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GColorData& aColor);
+
+ /**
+ * @see MM2GSVGProxy::SetEnumTraitL
+ */
+ virtual void SetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt16 aValue);
+
+ /**
+ * @see MM2GSVGProxy::SetFloatTraitL
+ */
+ virtual void SetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TReal32& aValue);
+
+ /**
+ * @see MM2GSVGProxy::SetMatrixTraitL
+ */
+ virtual void SetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GMatrixData& aMatrix);
+
+ /**
+ * @see MM2GSVGProxy::SetMediaTimeL
+ */
+ virtual void SetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TReal32& aSeconds);
+
+ /**
+ * @see MM2GSVGProxy::SetPathTraitL
+ */
+ virtual void SetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GSvgPathHandle& aPathHandle);
+
+ /**
+ * @see MM2GSVGProxy::SetRectTraitL
+ */
+ virtual void SetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GRectData& aRect);
+
+ /**
+ * @see MM2GSVGProxy::SetRenderingQualityL
+ */
+ virtual void SetRenderingQualityL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ TInt aMode);
+
+ /**
+ * @see MM2GSVGProxy::SetStringTraitL
+ */
+ virtual void SetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeTypeId,
+ const TPtrC16& aStr);
+
+ /**
+ * @see MM2GSVGProxy::SetViewportHeightL
+ */
+ virtual void SetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aHeight);
+
+
+ /**
+ * @see MM2GSVGProxy::SetViewportWidthL
+ */
+ virtual void SetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aWidth);
+
+protected: // METHODS
+ /**
+ * Close engine & document containers
+ */
+ virtual void CloseContainers();
+
+private: // METHODS
+ /**
+ * C++ default constructor.
+ */
+ CM2GSVGProxy();
+
+ /**
+ * Initialization.
+ */
+ void ConstructL();
+
+ /**
+ * C++ copy constructor
+ */
+ CM2GSVGProxy(const CM2GSVGProxy&);
+
+ /**
+ * C++ assignment operator
+ */
+ CM2GSVGProxy& operator=(const CM2GSVGProxy&);
+
+private: // VARIABLES
+ CSvgJavaInterfaceImpl* iNative;
+ RArray<TM2GSvgEngineHandle> iSvgEngines;
+ RArray<TM2GSvgDocumentHandle> iSvgDocuments;
+};
+
+M2G_NS_END
+
+#endif // CM2GSVGPROXY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/CSynchronization.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: M3GCore function call serialization and synchronization
+*
+*/
+
+#ifndef CSYNCHRONIZATION_H
+#define CSYNCHRONIZATION_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+// CLASS DECLARATION
+/**
+ * @class CSynchronization
+ */
+class CSynchronization : public CBase
+{
+public:
+ /**
+ * Two-phased constructor.
+ */
+ static CSynchronization* InstanceL();
+
+ /**
+ * Dtor
+ */
+ ~CSynchronization();
+
+ /**
+ * Locks the semaphore
+ */
+ void Lock();
+
+ /**
+ * Unlocks the semaphore
+ */
+ void Unlock();
+
+ /**
+ * Sets error code for error occured during lock period
+ */
+ void SetErrorCode(TInt aCode);
+
+ /**
+ * Returns error string set with SetErrorString
+ */
+ TInt GetErrorCode();
+
+private: // METHODS
+ /**
+ * Constructor
+ */
+ CSynchronization();
+
+ /**
+ * Two-phased constructor.
+ * @return New object
+ */
+ static CSynchronization* NewL();
+
+ /**
+ * Constructor
+ */
+ void ConstructL();
+
+private: // MEMBER VARIABLES
+ static CSynchronization* iSelf;
+ RCriticalSection iGuard;
+ TInt iErrorCode;
+};
+
+#endif // CSYNCHRONIZATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/JcfAutoPtr.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef JCFAUTOPTR_H
+#define JCFAUTOPTR_H
+
+#include <e32base.h>
+
+/**
+ * Functionality of this auto ptr class is same as stl's auto_ptr class
+ * except this works with cleanup stack.
+ * Implementation of the example operation with "traditional" way:
+ * void bar()
+ * {
+ * CFoo* myFoo = CFoo::NewL();
+ * CleanupStack::PushL(myFoo);
+ * myFoo->DoSomeThingL();
+ * CleanupStack::PopAndDestroy(1); //myFoo
+ * }
+ * Implementation of the same function with auto pointer class:
+ * void bar()
+ * {
+ * jcfcommon::auto_ptr<CFoo> myFoo(CFoo::NewL());
+ * myFoo->DoSomeThingL();
+ * }
+ *
+ */
+namespace jcfcommon
+{
+
+template<class X> class auto_ptr
+{
+public:
+ typedef X element_type;
+
+ auto_ptr(X* aPtr = 0): iPtr(aPtr),iCloseCalledFlag(EFalse)
+ {
+ CleanupStack::PushL(TCleanupItem(Close, (void*)this));
+ }
+
+ /**
+ * Copy constructor was commented out because current
+ * implementation doesn't support situation where auto_ptr
+ * is returned as return value of the function. Problem is that
+ * orig. auto_ptr is deleted when getBar() operation has been
+ * executed and this deleted local reference has been stored to the
+ * cleanup stack.
+ * E.g:
+ * void foo()
+ * {
+ * auto_ptr<bar> barObj = getBar();
+ * .
+ * .
+ * .
+ * User::Leave(KErrNotFound);
+ * }
+ */
+ /*auto_ptr(auto_ptr& aPtr): iPtr(aPtr.release())
+ {
+ CleanupStack::PushL(TCleanupItem(Close, (void*)this));
+ }*/
+
+ auto_ptr<X>& operator=(auto_ptr<X>& aRhs)
+ {
+ if (&aRhs != this)
+ {
+ delete iPtr;
+ iPtr = aRhs.release();
+ }
+ return (*this);
+ }
+
+ ~auto_ptr()
+ {
+ if (!iCloseCalledFlag)
+ {
+ CleanupStack::Pop();
+ delete iPtr;
+ }
+ }
+
+ X& operator *() const
+ {
+ return *iPtr;
+ }
+ X* operator ->() const
+ {
+ return iPtr;
+ }
+
+ X* get() const
+ {
+ return iPtr;
+ }
+
+ X* release()
+ {
+ X* result = iPtr;
+ iPtr = 0;
+ return result;
+ }
+
+ void reset(X* aPtr = 0)
+ {
+ if (aPtr != iPtr)
+ {
+ delete iPtr;
+ iPtr = aPtr;
+ }
+ }
+
+private:
+ static void Close(void* aPtr)
+ {
+ auto_ptr<X>* self = (auto_ptr<X>*)aPtr;
+ delete self->iPtr;
+ self->iPtr = 0;
+ self->iCloseCalledFlag = ETrue;
+ }
+
+ //Not implemented.
+ auto_ptr(auto_ptr& aPtr);
+
+private:
+ X* iPtr;
+ TBool iCloseCalledFlag;
+};
+
+}//end jcfcommon
+
+#endif // JCFAUTOPTR_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/M2GGeneral.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,463 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: General definitions
+*
+*/
+
+#ifndef M2GGENERAL_H
+#define M2GGENERAL_H
+
+#include <e32base.h>
+#include <jutils.h>
+
+#if defined ( _DEBUG )
+#if defined ( __WINSCW__ )
+// #define M2G_DEBUG
+#endif // __WINSCW__
+#endif // _DEBUG
+
+#ifdef M2G_DEBUG
+// #define M2G_INFO_POPUP
+#define M2G_STATISTIC_DEBUG
+#include <flogger.h>
+#include <jdebug.h>
+#ifdef M2G_STATISTIC_DEBUG
+#include <HAL.h>
+#include <hal_data.h>
+#endif // M2G_STATISTIC_DEBUG
+#endif // M2G_DEBUG
+
+#include "JcfAutoPtr.h"// cfcommon::auto_ptr<>
+#include "M2GNamespace.h"
+
+//#if defined( __cplusplus )
+//extern "C" {
+//#endif
+
+M2G_NS_START
+
+// CONSTANTS
+// == ALPHA BLEND CONSTANTS ==
+const TUint8 KFullOpaque = 0xFF;
+const TUint8 KFullTransparent = 0x00;
+
+// == ERROR TEXT CONSTANTS ==
+_LIT8(KM2GEmptyString8, "");
+_LIT(KM2GEmptyString, "");
+_LIT(KGraphicsContextErrText, "Invalid M2G graphics context");
+_LIT(KOffscreenErrText, "Invalid M2G offscreen bitmap");
+_LIT(KSvgProxyPointerErrText, "Invalid SVG proxy pointer");
+_LIT(KSvgEnginePointerErrText, "Invalid SVG engine pointer");
+_LIT(KSvgTargetGraphicsPointerErrText, "Invalid target graphics pointer");
+_LIT(KNotSupportedErrText, "Not supported");
+
+// == ERROR CODE CONSTANTS ==
+const TInt KM2GOk = KErrNone;
+const TInt KM2GNotOk = KErrGeneral;
+const TInt KM2GHandleNotOk = KErrBadHandle;
+const TInt KM2GArgNotOk = KErrArgument;
+const TInt KM2GSupportedNotOk = KErrNotSupported;
+const TInt KM2GMemoryNotOk = KErrNoMemory;
+
+// Own error codes
+const TInt KM2GIOException = -10;
+
+// Java exception class names
+_LIT8(KJavaExceptionClass, "java/lang/Exception");
+_LIT8(KJavaIOExceptionClass, "java/io/IOException");
+_LIT8(KJavaOutOfMemoryErrorClass, "java/lang/OutOfMemoryError");
+_LIT8(KJavaNullPointerException, "java/lang/NullPointerException");
+
+// == SVG CONSTANTS ==
+const TInt KM2GRestartAttribute = 114; // M2GSVGConstants.AT_RESTART
+const TInt KM2GRestartNever = 471; // M2GSVGConstants.RESTART_NEVER
+const TInt KM2GRestartWhenNotActive = 472; // M2GSVGConstants.RESTART_WHENNOTACTIVE
+
+// == HANDLE MACROS ==
+#define M2G_INVALID_HANDLE /**/ 0
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+
+// FUNCTION PROTOTYPES
+
+// CLASS DECLARATION
+/**
+ * General static methods
+ * @lib -
+ * @series Series S60 3.0
+ */
+class M2GGeneral
+{
+public: // STATIC METHODS
+ /**
+ * Check if a handle is valid
+ * @since Series S60 3.0
+ * @param aHandle
+ * @return ETrue if a handle is valid.
+ */
+ template<typename T>
+ inline static TBool IsHandleValid(const T& aHandle)
+ {
+ return ((aHandle == M2G_INVALID_HANDLE) ? EFalse : ETrue);
+ }
+
+ /**
+ * Returns min
+ * @since Series S60 3.0
+ * @param a Left parameter
+ * @param b Right parameter
+ * @return Returns min
+ */
+ template<typename T>
+ inline static T Min(const T& a, const T& b)
+ {
+ return ((a) <= (b) ? (a) : (b));
+ }
+
+
+ /**
+ * Returns max
+ * @since Series S60 3.0
+ * @param a Left parameter
+ * @param b Right parameter
+ * @return Returns max
+ */
+ template<typename T>
+ inline static T Max(const T& a, const T& b)
+ {
+ return ((a) >= (b) ? (a) : (b));
+ }
+ /**
+ * Instantiates an Java exception object with the message specified by
+ * message, and causes that exception to be thrown in Java side. A thrown
+ * exception will be pending in the current thread, but does not
+ * immediately disrupt native code execution.
+ * @param aEnv pointer to JNI environment
+ * @param aName The name of a java.lang.Throwable class.
+ * @param aMsg The message used to construct the java.lang.Throwable object.
+ */
+ static void RaiseException(
+ JNIEnv* aEnv,
+ const TDesC8& aName,
+ const TUint8* aMsg = (STATIC_CAST(const TDesC8&, KM2GEmptyString8)).Ptr());
+
+ /**
+ * Instantiates an Java exception object specified by error code,
+ * and causes that exception to be thrown in Java side.
+ * @param aEnv pointer to JNI environment
+ * @param aErrorCode Error code.
+ * @return Value passed in is returned if not an error.
+ */
+ static TInt CheckErrorCode(JNIEnv* aEnv, TInt aErrorCode);
+
+ /**
+ * If handle is invalid instantiates an Java exception object,
+ * and causes that exception to be thrown in Java side.
+ * @param aEnv pointer to JNI environment
+ * @param aHandle Handle.
+ * @return Handle passed in is returned if it is not invalid.
+ */
+ static TInt CheckHandle(JNIEnv* aEnv, TInt aHandle);
+
+ /**
+ * If handle is invalid or error code matches instantiates an
+ * Java exception object, and causes that exception to be thrown in Java side.
+ * @param aEnv pointer to JNI environment
+ * @param aErrorCode
+ * @param aHandle Handle.
+ * @param aErrorResult Result that is returned if error.
+ * @return Handle passed in is returned if no error otherwise the
+ * .aErrorResult is returned.
+ */
+ static TInt CheckErrorCodeAndHandle(
+ JNIEnv* aEnv, TInt aErrorCode, TInt aHandle, TInt aErrorResult);
+
+ /**
+ * Shows pop up dialog on the emulator
+ * @since Series S60 3.1
+ * @param aLine1
+ * @param aLine2
+ */
+#ifdef M2G_INFO_POPUP
+ static void PopupInfo(
+ const TDesC& aLine1,
+ const TDesC& aLine2);
+#endif // M2G_INFO_POPUP
+
+
+ /**
+ * Data array wrapper.
+ * @series Series S60 3.1
+ */
+ template <typename T>
+ class TDataArrayPtr
+ {
+
+ public: // METHODS
+ /**
+ * Ctor
+ */
+ TDataArrayPtr(T* aData = 0, TInt aSize = 0) : iData(aData), iSize(aSize) {}
+
+ /**
+ * Return pointer to a data
+ * @return Pointer
+ */
+ inline T* Begin()
+ {
+ return iData;
+ }
+
+ /**
+ * Check if data is valid
+ * @return ETrue if ok
+ */
+ inline TBool IsValid()
+ {
+ return (((iData != NULL) && (iSize > 0)) ? ETrue : EFalse);
+ }
+
+ /**
+ * Return data size
+ * @return Length
+ */
+ inline TInt Length()
+ {
+ return iSize;
+ }
+
+ /**
+ * Operator [] const
+ */
+ inline const T& operator[](TInt aIndex) const
+ {
+ return iData[ aIndex ];
+ }
+
+ /**
+ * Operator []
+ */
+ inline T& operator[](TInt aIndex)
+ {
+ return iData[ aIndex ];
+ }
+
+ private: // METHODS
+
+ /**
+ * Copy ctor
+ * @param aRhs Right side array
+ */
+ TDataArrayPtr(const TDataArrayPtr& aRhs);
+
+ /**
+ * Assignment operator
+ * @param aRhs Right side array
+ * @return Array object
+ */
+ TDataArrayPtr& operator=(const TDataArrayPtr& aRhs);
+
+ public: // VARIABLES
+ T* iData;
+ TInt iSize;
+ };
+
+
+ /**
+ * Statistic info
+ * @series Series S60 3.1
+ */
+#ifdef M2G_STATISTIC_DEBUG
+ class TM2GStatistic
+ {
+ public: // METHODS
+ /**
+ * Ctor
+ */
+ TM2GStatistic();
+
+ /**
+ * Reset
+ */
+ void Reset();
+
+ /**
+ * Print
+ * @param aPrintElapsedTime Print also en elapsed time
+ */
+ void Print(TBool aPrintElapsedTime = EFalse);
+
+ /**
+ * Print
+ * @param aStream
+ */
+ void Print(RWriteStream& aStream);
+
+ public: // STATIC METHODS
+ static void Log();
+
+ private: // METHODS
+ /**
+ * Copy ctor
+ */
+ TM2GStatistic(const TM2GStatistic&);
+
+ /**
+ * Assignment operator
+ */
+ TM2GStatistic& operator=(const TM2GStatistic&);
+
+ private: // VARIABLES
+ TTime iStartTime;
+ TTime iEndTime;
+ TThreadId iId;
+ TName iThreadName;
+ };
+#endif // M2G_STATISTIC_DEBUG
+
+private: // METHODS
+ /**
+ * Default constructor
+ */
+ M2GGeneral() {};
+
+ /**
+ * Copy constructor
+ */
+ M2GGeneral(const M2GGeneral&);
+
+ /**
+ * Assignment operator
+ */
+ M2GGeneral& operator=(const M2GGeneral&);
+};
+
+// MACROS
+// == TOOL MACROS ==
+#define M2G_MIN( a, b ) ( ( a ) <= ( b ) ? ( a ) : ( b ) )
+#define M2G_MAX( a, b ) ( ( a ) >= ( b ) ? ( a ) : ( b ) )
+
+// == SWITCHES ==
+#define M2G_NO_EXCEPTION_SWITCH
+// #define M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
+
+#if defined( M2G_DEBUG )
+#define M2G_TRACE
+#endif
+
+// == EXCEPTION MACROS ==
+// Common exception handling
+#ifndef M2G_NO_EXCEPTION_SWITCH
+#define M2G_THROW( ERR_CODE ) /**/ User::Leave( ( ERR_CODE ) )
+#define M2G_THROW2( ERR_TEXT, ERR_CODE ) /**/ M2G_DEBUG_0( ERR_TEXT ); User::Leave( ( ERR_CODE ) )
+#else
+#define M2G_THROW( ERR_CODE ) /**/
+#define M2G_THROW2( ERR_TEXT, ERR_CODE ) /**/
+#endif // !M2G_NO_EXCEPTION_SWITCH
+
+// Null pointer exception handling
+#ifndef M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
+#define M2G_CHECK_NULL_POINTER( JNI, POINTER ) /**/ M2GGeneral::CheckHandle( ( JNI, POINTER ) )
+#else
+#define M2G_CHECK_NULL_POINTER( JNI, POINTER ) /**/
+#endif // !M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
+
+
+// == STATIC LOG MACROS ==
+#if defined( M2G_STATISTIC_DEBUG )
+#define M2G_STATISTIC_LOG /**/ M2GGeneral::TM2GStatistic::Log()
+#else // M2G_STATISTIC_DEBUG
+#define M2G_STATISTIC_LOG /**/
+#endif // !M2G_STATISTIC_DEBUG
+
+// == POPUP MACROS ==
+#if defined( M2G_INFO_POPUP )
+#define M2G_POPUP( LINE1, LINE2 ) /**/ M2GGeneral::PopupInfo( LINE1, LINE2 );
+#else // !M2G_INFO_POPUP
+#define M2G_POPUP( LINE1, LINE2 ) /**/
+#endif // M2G_INFO_POPUP
+
+// == TRACE MACROS ==
+#if defined( M2G_TRACE )
+#define M2G_DEBUG_0( TEXT ) /**/ \
+ RFileLogger::Write( KLogDirectory, KLogFileName, EFileLoggingModeAppend, _L( TEXT ) )
+
+#define M2G_DEBUG_1( TEXT, VAL1 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1 )
+
+#define M2G_DEBUG_2( TEXT, VAL1, VAL2 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2 )
+
+#define M2G_DEBUG_3( TEXT, VAL1, VAL2, VAL3 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2, VAL3 )
+
+#define M2G_DEBUG_4( TEXT, VAL1, VAL2, VAL3, VAL4 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2, VAL3, VAL4 )
+
+#define M2G_DEBUG_5( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5 )
+
+#define M2G_DEBUG_6( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 )
+
+#define M2G_DEBUG_7( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 ) /**/ \
+ RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
+ _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 )
+#else // !M2G_TRACE
+#define M2G_POPUP( LINE1, LINE2 ) /**/
+
+#define M2G_DEBUG_0( TEXT ) /**/
+#define M2G_DEBUG_1( TEXT, VAL1 ) /**/
+#define M2G_DEBUG_2( TEXT, VAL1, VAL2 ) /**/
+#define M2G_DEBUG_3( TEXT, VAL1, VAL2, VAL3 ) /**/
+#define M2G_DEBUG_4( TEXT, VAL1, VAL2, VAL3, VAL4 ) /**/
+#define M2G_DEBUG_5( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5 ) /**/
+#define M2G_DEBUG_6( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 ) /**/
+#define M2G_DEBUG_7( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 ) /**/
+#endif // M2G_TRACE
+
+// DATA TYPES
+typedef TInt TM2GSvgEngineHandle;
+typedef TInt TM2GSvgDocumentHandle;
+typedef TInt TM2GSvgElementHandle;
+typedef TInt TM2GBitmapHandle;
+typedef TInt TM2GSvgPathHandle;
+typedef TInt16 TM2GSvgAttrType;
+typedef TUint8 TM2GPixelComponent;
+
+//For Qimage related changes
+typedef TUint TM2GSvgBitmapHandle;
+
+typedef TFixedArray<TInt, 3> TM2GColorData;
+typedef TFixedArray<TReal32, 6> TM2GMatrixData;
+typedef M2GGeneral::TDataArrayPtr<TReal32> TM2GMatrixData2;
+typedef TFixedArray<TReal32, 4> TM2GRectData;
+typedef TFixedArray<TReal32, 4> TM2GScreenBBoxData;
+typedef TFixedArray<TReal32, 6> TM2GPathCurveData;
+
+
+M2G_NS_END
+
+//#if defined( __cplusplus )
+//} // extern "C"
+//#endif
+
+#endif // M2GGENERAL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/M2GNamespace.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Namespace definitions
+*
+*/
+
+#ifndef M2GNAMESPACE_H
+#define M2GNAMESPACE_H
+// INCLUDES
+
+// CONSTANTS
+
+// MACROS
+
+#define M2G_NO_NAMESPACE_SWITCH
+#ifndef M2G_NO_NAMESPACE_SWITCH
+#define M2G_NS_ /**/ m2g_namespace
+#define M2G_NS_START /**/ namespace M2G_NS_ {
+#define M2G_NS_END /**/ }
+#define M2G_NS(X) /**/ ::M2G_NS_::X
+#define USING_WHOLE_M2G_NS /**/ using namespace ::M2G_NS_;
+#define USING_M2G_NS(X) /**/ using ::M2G_NS_::X;
+#else
+#define M2G_NS_ /**/
+#define M2G_NS_START /**/
+#define M2G_NS_END /**/
+#define M2G_NS(X) /**/
+#define USING_WHOLE_M2G_NS /**/
+#define USING_M2G_NS(X) /**/
+#endif // !M2G_NO_NAMESPACE_SWITCH
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // M2GNAMESPACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/M2GUtils.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: General functions
+*
+*/
+
+#ifndef M2GUTILS_H
+#define M2GUTILS_H
+
+// INCLUDE FILES
+#include <gdi.h> // DisplayMode, Draw, BitBlt
+#include <fbs.h> // CFbsBitmap
+#include "M2GGeneral.h"
+#include <QPixmap>
+
+M2G_NS_START
+
+// CONSTANTS
+
+// DATA TYPES
+
+// MACROS
+
+// FORWARD DECLARATIONS
+class CFbsBitmapDevice;
+class CFbsBitGc;
+
+// FUNCTION PROTOTYPES
+
+// CLASS DECLARATION
+
+
+//For UI Thread Execution.
+#include "CSynchronization.h"
+
+#define M2G_DO_LOCK CSynchronization::InstanceL()->Lock();
+
+
+//TODO Have to Raise Exception in case we find any error.
+#define M2G_DO_UNLOCK(aEnv) {\
+ TInt errorCode = CSynchronization::InstanceL()->GetErrorCode();\
+ CSynchronization::InstanceL()->Unlock();\
+ }\
+
+/**
+ * @class M2GBitmapUtils
+ * @brief Static methods for alpha blending and bitmaps
+ */
+
+class M2GBitmapUtils
+{
+public: // STATIC METHODS
+ /**
+ * Blits two bitmap
+ * @since Series S60 3.0
+ * @param aTarget Target bitmap.
+ * @param aSource Source bitmap.
+ * @param aPoint Position for the top left corner of the bitmap.
+ * @param aRect Rectangle defining the piece of the bitmap to be drawn.
+ * @param aSourceMask Mask.
+ * @return M2G_OK if ok
+ */
+ static TInt BitBlt(CFbsBitmap& aTarget,
+ const CFbsBitmap& aSource,
+ const TPoint& aPoint,
+ const TRect* aRect = NULL,
+ const CFbsBitmap* aSourceMask = NULL);
+
+ static TInt BitBlt(CBitmapContext& aTargetContext,
+ const CFbsBitmap& aSource,
+ const TPoint& aPoint,
+ const TRect* aRect,
+ const CFbsBitmap* aSourceMask,
+ /*MSwtClient* aClientHandle,*/
+ TBool aUseNativeClear = EFalse);
+
+ static TInt BitQBlt(QImage& aTargetQimage,
+ const QImage& aSourceQimage,
+ const TPoint& aPoint,
+ const TRect* aRect,
+ const CFbsBitmap* aSourceMask);
+
+ /**
+ * Checks if two bitmap are equal.
+ * @since Series S60 3.0
+ * @param aLhs Left side bitmap
+ * @param aRhs Right side bitmap
+ * @return ETrue if bitmaps are equal.
+ */
+ inline static TBool Equals(const CFbsBitmap& aLhs, const CFbsBitmap& aRhs)
+ {
+ return (aLhs.SizeInPixels() == aRhs.SizeInPixels());
+ }
+
+ /**
+ * Checks if a bitmap has same values as given values.
+ * @since Series S60 3.0
+ * @param aBitmap Bitmap
+ * @param aSz Size in pixels.
+ * @param aMode Display mode.
+ * @return ETrue if bitmaps are equal.
+ */
+ inline static TBool Equals(
+ const CFbsBitmap& aBitmap,
+ const TSize& aSz,
+ const TDisplayMode* aMode)
+ {
+ return (((aBitmap.SizeInPixels() == aSz) &&
+ ((aMode == NULL) || (aBitmap.DisplayMode() == *aMode))
+ ) ? ETrue : EFalse);
+ }
+
+ /**
+ * Return byte per pixel
+ * @since Series S60 3.1
+ * @param aBitmap
+ * @param aRhs Right side bitmap
+ * @return ETrue if bitmaps are equal.
+ */
+ inline static TInt BytesPerPixel(const CFbsBitmap& aBitmap)
+ {
+ switch (aBitmap.DisplayMode())
+ {
+ case EGray256 :
+ case EColor256 :
+ return 1;
+ case EColor64K :
+ return 2;
+ case EColor16M :
+ case EColor16MU :
+ case EColor16MA :
+ return 4;
+ default :
+ return 0;
+ }
+ }
+
+};
+
+/**
+ * @class TM2GRenderRect
+ * @brief Class for handling rendering rectangle
+ */
+class TM2GRenderRect : public TRect
+{
+private:
+ // NOTE ELength should be always the last one and indexing
+ // should start from 0
+ enum TArrayIndexes
+ {
+ EAnchorX = 0,
+ EAnchorY = 1,
+ EClipX = 2,
+ EClipY = 3,
+ EClipW = 4,
+ EClipH = 5,
+ ELength
+ };
+
+public: // METHODS
+ /**
+ * Ctor
+ * @since Series S60 3.0
+ * @param aAnchorX X anchor
+ * @param aAnchorY Y anchor
+ * @param aClipX Clip x
+ * @param aClipY Clip y
+ * @param aClipWidth Clip width
+ * @param aClipHeight Clip height
+ */
+ TM2GRenderRect(
+ TInt aAnchorX, TInt aAnchorY,
+ TInt aClipX, TInt aClipY,
+ TInt aClipW, TInt aClipH);
+
+ /**
+ * Ctor
+ * @since Series S60 3.0
+ * @param aDimensions Dimensions. @see TArrayIndexes.
+ * @param aLength Array length
+ */
+ TM2GRenderRect(TInt* aDimensions, TInt aLength);
+
+ /**
+ * Copy ctor
+ * @since Series S60 3.0
+ * @param aRd
+ */
+ TM2GRenderRect(const TM2GRenderRect& aRd);
+
+ /**
+ * Assignment operator
+ * @since Series S60 3.0
+ * @param aRd
+ * @return TM2GRenderRect
+ */
+ TM2GRenderRect& operator=(const TM2GRenderRect& aRd);
+
+ /**
+ * Dtor
+ * @since Series S60 3.0
+ */
+ virtual ~TM2GRenderRect();
+
+ /**
+ * Returns x anchor
+ * @since Series S60 3.0
+ * @return X anchor
+ */
+ inline TInt GetAnchorX()
+ {
+ return iAnchorX;
+ }
+
+ /**
+ * Returns y anchor
+ * @since Series S60 3.0
+ * @return Y anchor
+ */
+ inline TInt GetAnchorY()
+ {
+ return iAnchorY;
+ }
+
+ /**
+ * Returns clip height
+ * @since Series S60 3.0
+ * @return Clip height
+ */
+ inline TInt GetClipH()
+ {
+ return Height();
+ }
+
+ /**
+ * Returns x clip
+ * @since Series S60 3.0
+ * @return X clip
+ */
+ inline TInt GetClipX()
+ {
+ return iTl.iX;
+ }
+
+ /**
+ * Returns y clip
+ * @since Series S60 3.0
+ * @return Y clip
+ */
+ inline TInt GetClipY()
+ {
+ return iTl.iY;
+ }
+
+ /**
+ * Returns clip width
+ * @since Series S60 3.0
+ * @return Clip width
+ */
+ inline TInt GetClipW()
+ {
+ return Width();
+ }
+
+ /**
+ * Sets x anchor
+ * @since Series S60 3.0
+ * @param aX X anchor
+ */
+ inline void SetAnchorX(TInt aX)
+ {
+ iAnchorX = aX;
+ }
+
+ /**
+ * Sets y anchor
+ * @since Series S60 3.0
+ * @param aY Y anchor
+ */
+ inline void SetAnchorY(TInt aY)
+ {
+ iAnchorY = aY;
+ }
+
+ /**
+ * Sets clip height
+ * @since Series S60 3.0
+ * @param aH Clip height
+ */
+ inline void SetClipH(TInt aH)
+ {
+ SetHeight(aH);
+ }
+
+ /**
+ * Sets x clip
+ * @since Series S60 3.0
+ * @param aX X clip
+ */
+ inline void SetClipX(TInt aX)
+ {
+ iTl.iX = aX;
+ }
+
+ /**
+ * Sets y clip
+ * @since Series S60 3.0
+ * @param aY Y clip
+ */
+ inline void SetClipY(TInt aY)
+ {
+ iTl.iY = aY;
+ }
+
+ /**
+ * Sets clip width
+ * @since Series S60 3.0
+ * @param aW Clip width
+ */
+ inline void SetClipW(TInt aW)
+ {
+ SetWidth(aW);
+ }
+
+public: // STATIC METHODS
+ /**
+ * Gets region size
+ * @since Series S60 3.0
+ * @param aRect Render dimensions
+ * @param aSz Source surface size
+ * @return Region size to be paint
+ */
+ static TSize GetRegionSizeInPixels(
+ TM2GRenderRect& aRect,
+ const TSize& aSz);
+
+public: // VARIABLES
+ TInt iAnchorX;
+ TInt iAnchorY;
+};
+
+
+/**
+ * @class TM2GBitmapLock
+ * @brief Bitmap autolocker
+ */
+class TM2GBitmapLock
+{
+public: // METHODS
+ /**
+ * Ctor
+ * @param aBitmap Bitmap
+ * @param aLock If ETrue then bitmap is locked by ctor.
+ */
+ TM2GBitmapLock(const CFbsBitmap* aBitmap, TBool aLock = ETrue);
+
+ /**
+ * Dtor
+ * @since Series S60 3.0
+ */
+ virtual ~TM2GBitmapLock();
+
+ /**
+ * Locks bitmap heap
+ * @since Series S60 3.0
+ */
+ void Lock();
+
+ /**
+ * Unlocks bitmap heap
+ * @since Series S60 3.0
+ */
+ void Unlock();
+
+protected: // METHODS
+ /**
+ * Copy ctor
+ * @since Series S60 3.0
+ * @param aRd
+ */
+ TM2GBitmapLock(const TM2GBitmapLock& aRd);
+
+ /**
+ * Assignment operator
+ * @since Series S60 3.0
+ * @param aRd
+ * @return TM2GBitmapLock
+ */
+ TM2GBitmapLock& operator=(const TM2GBitmapLock& aRd);
+
+public: // VARIABLES
+ const CFbsBitmap* iBitmap;
+ TBool iIsLocked;
+};
+class TSWTBitBlt/*: public MSwtFunctor*/
+{
+public:
+ TSWTBitBlt(CBitmapContext& aTargetContext,
+ const TPoint& aPoint,
+ const CFbsBitmap* aBitmap,
+ const TRect* aSourceRect,
+ const CFbsBitmap* aMaskBitmap,
+ TBool aUseNativeClear);
+
+ void operator()() const;
+ CBitmapContext& iTargetContext;
+ const TPoint iPoint;
+ const CFbsBitmap* iBitmap;
+ const TRect* iRect;
+ const CFbsBitmap* iMaskBitmap;
+ TBool iUseNativeClear;
+};
+M2G_NS_END
+
+
+#endif // M2GUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/MM2GRenderContext.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Render context interface
+*
+*/
+
+#ifndef MM2GRENDERCONTEXT_H
+#define MM2GRENDERCONTEXT_H
+
+// INCLUDES
+#include <gdi.h> // TDisplayMode
+#include "M2GUtils.h"
+
+M2G_NS_START
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+ * Interface class
+ */
+class MM2GRenderContext
+{
+public: // STATIC CONSTANTS
+ static const TReal32 KFullOpaque;
+ static const TReal32 KFullTransparency;
+ static const TUint8 KMaxAlphaValue;
+ static const TDisplayMode KDefaultDisplayMode;
+ static const TDisplayMode KMaskDisplayMode;
+
+public: // METHODS
+
+ /**
+ * Dtor
+ */
+ virtual ~MM2GRenderContext() {};
+
+ /**
+ * Binds device's bitmap.
+ * @since Series S60 3.1
+ * @param aGraphicsHandle Target graphics handle
+ * @throws exception if not ok
+ */
+ virtual void BindL(TInt& aGraphicsHandle) = 0;
+
+ /**
+ * SVG image bitmap is (re)created if needed.
+ * @since Series S60 3.1
+ * @see MM2GRenderContext::SetRefreshModeL()
+ * @throws exception if not ok
+ */
+ virtual void InitImageBitmapL() = 0;
+
+ /**
+ * Blits an svg and a device bitmaps
+ * @since Series S60 3.1
+ * @throws M2G_OK if ok
+ * @throws exception if not ok
+ */
+ virtual void ReleaseL() = 0;
+
+ /**
+ * Renders a SVG document at a current time.
+ *
+ * <p> The rendering is done in 2 steps:
+ * <li> render the document on an internal SVG buffer (iSvg)
+ * <li> alpha-blend it with the bound graphics target (iGraphicsBitmap)
+ *
+ * @note if transparency factor is not set, iSvg is simply blitted onto iGraphicsTarget
+ *
+ * @param aSvgDocumentHandle handle to SVG document
+ * @param aCurrentTime the current time of the animation
+ * @param aSvgW Svg image viewport width
+ * @param aSvgH Svg image viewport height
+ * @param aRect contains position about the rendered area
+ * @since S60 3.1
+ */
+
+
+ virtual void RenderLCDUIL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW,
+ TInt aSvgH,
+ TM2GRenderRect& aRect) = 0 ;
+
+ virtual void RenderESWTL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW,
+ TInt aSvgH,
+ TM2GRenderRect& aRect,
+ TBool aUseNativeClear,
+ TInt* aReturnData) = 0;
+
+ /**
+ * Sets render quality
+ * @since Series S60 3.1
+ * @param aMode Mode
+ * @throws exception if not ok
+ */
+ virtual void SetRenderingQualityL(TInt aMode) = 0;
+
+ /**
+ * Sets transparency
+ * @since Series S60 3.1
+ * @param aAlpha Alpha factor
+ * @throws exception if not ok
+ */
+ virtual void SetTransparency(TReal32 aAlpha) = 0;
+
+};
+
+M2G_NS_END
+#endif // MM2GRENDERCONTEXT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/inc/MM2GSVGProxy.h Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,854 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGTopt proxy interface
+*
+*/
+
+#ifndef MM2GSVGPROXY_H
+#define MM2GSVGPROXY_H
+
+// INCLUDES
+#include "M2GUtils.h"
+
+M2G_NS_START
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+ * Interface class
+ */
+class MM2GSVGProxy
+{
+public: // METHODS
+
+ /**
+ * Dtor
+ */
+ virtual ~MM2GSVGProxy() {};
+
+ /**
+ * Add close to the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @throws exception if not ok
+ */
+ virtual void AddCloseL(const TM2GSvgPathHandle& aPathHandle) = 0;
+
+ /**
+ * Add curve to the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aPathCurveData Curve data
+ * @throws exception if not ok
+ */
+ virtual void AddCurveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TM2GPathCurveData& aPathCurveData) = 0;
+
+ /**
+ * Add line to the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aX -
+ * @param aY -
+ * @throws exception if not ok
+ */
+ virtual void AddLineToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY) = 0;
+ /**
+ * Add move to the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aX -
+ * @param aY -
+ * @throws exception if not ok
+ */
+ virtual void AddMoveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY) = 0;
+
+ /**
+ * Add quad to the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aX1 -
+ * @param aY1 -
+ * @param aX2 -
+ * @param aY2 -
+ * @throws exception if not ok
+ */
+ virtual void AddQuadToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX1, const TReal32& aY1,
+ const TReal32& aX2, const TReal32& aY2) = 0;
+
+ /**
+ * Append child
+ * @since Series S60 3.1
+ * @param aElementHandle
+ * @param aChildElementHandle
+ * @throws exception if not ok
+ */
+ virtual void AppendChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle) = 0;
+
+ /**
+ * Set the begin animation time for the given element.
+ * @since Series S60 3.1
+ * @param aDocumentHandle
+ * @param aElementHandle
+ * @param aOffset
+ * @throws exception if not ok
+ */
+ virtual void BeginElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset) = 0;
+
+ /**
+ * Check if element is removable
+ * @since Series S60 3.1
+ * @param aSurfaceHandle
+ * @param aRemoveable Result
+ * @throws exception if not ok
+ */
+ virtual void CheckRemoveableL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aRemoveable) = 0;
+
+
+ /**
+ * Clear svg surface
+ * @since Series S60 3.1
+ * @param aSurfaceHandle Surface handle
+ * @throws exception if not ok
+ */
+ virtual void ClearSvgSurfaceL(const TM2GSvgDocumentHandle& aSurfaceHandle) = 0;
+
+ /**
+ * Create document
+ * @since Series S60 3.1
+ * @param aData Document content
+ * @param aDocumentHandle Document handle to be returned
+ * @throws exception if not ok
+ */
+ virtual void CreateDocumentL(
+ const TPtrC16& aData,
+ TM2GSvgDocumentHandle& aDocumentHandle) = 0;
+
+ /**
+ * Create svg engine
+ * @since Series S60 3.1
+ * @param aEngineHandle Svg engine handle
+ * @throws exception if not ok
+ */
+ virtual void CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle) = 0;
+
+ /**
+ * Create path
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle to be returned
+ * @throws exception if not ok
+ */
+ virtual void CreatePathL(TM2GSvgPathHandle& aPathHandle) = 0;
+
+ /**
+ * Create svg surface
+ * @since Series S60 3.1
+ * @param aWidth Surface width
+ * @param aHeight Surface height
+ * @return Svg surface
+ * @throws exception if not ok
+ */
+ virtual TM2GBitmapHandle CreateSvgSurfaceL(TInt aWidth, TInt aHeight) = 0;
+
+ /**
+ * Create new element
+ * @since Series S60 3.1
+ * @param aType Element type id
+ * @param aParentHandle Parent of the new element.
+ * Note: Can be '0' if element is not added to DOM.
+ * @param aDocumentHandle Document handle.
+ * @param aRootHandle Root element handle.
+ * @param aEngineHandle Element handle to be returned
+ * @throws exception if not ok
+ */
+ virtual void CreateElementNsL(
+ const TM2GSvgAttrType& aType,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TM2GSvgElementHandle& aEngineHandle) = 0;
+
+ /**
+ * Delete document
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle
+ * @throws exception if not ok
+ */
+ virtual void DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle) = 0;
+
+ /**
+ * Delete svg engine
+ * @since Series S60 3.1
+ * @param aEngineHandle Engine handle
+ * @throws exception if not ok
+ */
+ virtual void DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle) = 0;
+
+ /**
+ * Deletes svg surface
+ * @since Series S60 3.1
+ * @param aSurfaceHandle Surface handle
+ * @throws exception if not ok
+ */
+ virtual void DeleteSvgSurfaceL(const TM2GSvgDocumentHandle& aSurfaceHandle) = 0;
+
+ /**
+ * Delete path
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle
+ * @throws exception if not ok
+ */
+ virtual void DestroyPathL(const TM2GSvgPathHandle& aPathHandle) = 0;
+
+ /**
+ * Dispatches a mouse event
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aX X coordinate.
+ * @param aY Y coordinate
+ * @param aElementHandle Target element handle
+ * @throws exception if not ok
+ */
+ virtual void DispatchMouseEventL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle) = 0;
+
+ /**
+ * Set the end animation time for the given element.
+ * @since Series S60 3.1
+ * @param aDocumentHandle
+ * @param aElementHandle
+ * @param aOffset
+ * @throws exception if not ok
+ */
+ virtual void EndElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset) = 0;
+
+
+ /**
+ * Set focus on.
+ * @since Series S60 3.1
+ * @param aDocumentHandle
+ * @param aElementHandle
+ * @throws exception if not ok
+ */
+ virtual void FocusOnL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle) = 0;
+
+ /**
+ * Set focus out.
+ * @since Series S60 3.1
+ * @param aDocumentHandle
+ * @param aElementHandle
+ * @throws exception if not ok
+ */
+ virtual void FocusOutL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle) = 0;
+
+ /**
+ * Get a bounding box
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aRectData Rect components are saved to this parameter
+ * @param aResult Result
+ * @throws exception if not ok
+ */
+ virtual void GetBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult) = 0;
+
+ /**
+ * Get colors
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle
+ * @param aAttributeType Attribute type
+ * @param aColor Result
+ * @param aResult Extra result info
+ * @throws exception if not ok
+ */
+ virtual void GetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GColorData& aColor,
+ TInt& aResult) = 0;
+
+ /**
+ * Get element by id
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aId Element id
+ * @param aElementHandle Element handle to be returned
+ * @throws exception if not ok
+ */
+ virtual void GetElementByIdL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aId,
+ TM2GSvgElementHandle& aElementHandle) = 0;
+
+ /**
+ * Get element by id
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aId Result element type id.
+ * @throws exception if not ok
+ */
+ virtual void GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId) = 0;
+
+ /**
+ * Get an enumeration value of the specified attribute.
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aEnumTraiT Enum attribute.
+ * @throws exception if not ok
+ */
+ virtual void GetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt16& aEnumTrait) = 0;
+
+ /**
+ * Get external list item
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aIndex Index.
+ * @param aItem Returns external item according to a given index
+ * @return KErrNone if no error
+ * @throws Exception if not ok
+ */
+ virtual TInt GetExternalListItemL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aIndex,
+ TPtrC16& aItem) = 0;
+
+ /**
+ * Get external list size
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aListSz Size.
+ * @throws exception if not ok
+ */
+ virtual void GetExternalListSizeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aListSz) = 0;
+
+ /**
+ * Get a first chlid element
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aChildHandle Returns child element handle.
+ * @throws exception if not ok
+ */
+ virtual void GetFirstElementChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aChildHandle) = 0;
+
+ /**
+ * Get a float trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param Float trait
+ * @throws exception if not ok
+ */
+ virtual void GetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TReal32& aFloatTrait) = 0;
+
+ /**
+ * Get a matrix trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aMatrix Matrix trait
+ * @param aResult
+ * @throws exception if not ok
+ */
+ virtual void GetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GMatrixData& aMatrix, TInt& aResult) = 0;
+
+ /**
+ * Get a media time
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aSeconds Media time to be returned
+ * @throws exception if not ok
+ */
+ virtual void GetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TReal32& aSeconds) = 0;
+
+ /**
+ * Get a next element sibling
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aSiblingElementHandle Sibling handle
+ * @throws exception if not ok
+ */
+ virtual void GetNextElementSiblingL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aSiblingElementHandle) = 0;
+
+ /**
+ * Get the segment count for the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aNumberOfSegments Segment count
+ * @throws exception if not ok
+ */
+ virtual void GetNumberOfSegmentsL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt& aNumberOfSegments) = 0;
+
+ /**
+ * Get a parent
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aParentElementHandle Parent Element handle
+ * @throws exception if not ok
+ */
+ virtual void GetParentL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aParentElementHandle) = 0;
+
+ /**
+ * Get a path trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aPathTrait Path trait
+ * @throws exception if not ok
+ */
+ virtual void GetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt& aPathTrait) = 0;
+
+ /**
+ * Get a rect trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aRectData Rect components are saved to this parameter
+ * @param aResult Result
+ * @throws exception if not ok
+ */
+ virtual void GetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult) = 0;
+
+ /**
+ * Get a root element
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aRootElementHandle Root element handle
+ * @throws exception if not ok
+ */
+ virtual void GetRootElementL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TM2GSvgElementHandle& aRootElementHandle) = 0;
+
+ /**
+ * Get screen b box
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle
+ * @param aScreenBBoxData Screen box data out
+ * @throws exception if not ok
+ */
+ virtual void GetScreenBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GScreenBBoxData& aScreenBBoxData) = 0;
+
+ /**
+ * Get the segment parameter for the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aSegmentIndex -
+ * @param aParamIndex -
+ * @param aSegmentParam Segment parameter to be returned.
+ * @throws exception if not ok
+ */
+ virtual void GetSegmentParameterL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex, TInt aParamIndex,
+ TReal32& aSegmentParam) = 0;
+
+ /**
+ * Get the segment type for the given path.
+ * @since Series S60 3.1
+ * @param aPathHandle Path handle.
+ * @param aSegmentIndex -
+ * @param aSegmentType Segment type
+ * @throws exception if not ok
+ */
+ virtual void GetSegmentTypeL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex,
+ TInt16& aSegmentType) = 0;
+
+ /**
+ * Get a string trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type.
+ * @param aStr Returns a string attribute
+
+ * @throws exception if not ok
+ */
+ virtual TInt GetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TPtrC16& aStr) = 0;
+ /**
+ * Get a svg surface height
+ * @since Series S60 3.1
+ * @param aSurfaceHandle Surface handle.
+ * @return Svg surface height
+ * @throws exception if not ok
+ */
+ virtual TInt GetSvgSurfaceHeightL(const TM2GBitmapHandle& aSurfaceHandle) = 0;
+
+ /**
+ * Get a svg surface width
+ * @since Series S60 3.1
+ * @param aSurfaceHandle Surface handle.
+ * @return Svg surface width
+ * @throws exception if not ok
+ */
+ virtual TInt GetSvgSurfaceWidthL(const TM2GBitmapHandle& aSurfaceHandle) = 0;
+
+ /**
+ * Finds handle to the actual cloned element
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aHandle Element handle to be returned
+ * @throws exception if not ok
+ */
+ virtual void GetUsedFromElementL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aHandle) = 0;
+
+ /**
+ * Viewport height.
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aHeight Wieport height to be returned.
+ * @throws exception if not ok
+ */
+ virtual void GetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aHeight) = 0;
+
+ /**
+ * Viewport width.
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aWidth Viewport width.
+ * @throws exception if not ok
+ */
+ virtual void GetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aWidth) = 0;
+
+ /**
+ * Init native engine & document
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle
+ * @throws exception if not ok
+ */
+ virtual void InitViewportL(
+ const TM2GSvgDocumentHandle& aDocumentHandle) = 0;
+
+ /**
+ * Add given child element to the given element before
+ * the given reference element.
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aNewChildElementHandle Child element handle.
+ * @param aReferenceElementHandle Child element handle.
+ * @throws exception if not ok
+ */
+ virtual void InsertBeforeL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aNewChildElementHandle,
+ const TM2GSvgElementHandle& aReferenceElementHandle) = 0;
+
+ /**
+ * Check if element is active.
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aActive Return "1" if active
+ * @throws exception if not ok
+ */
+ virtual void IsActiveL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aActive) = 0;
+
+ /**
+ * Checks if an element in DOM.
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aElementHandle Element handle.
+ * @param aIsElementInDom Result.
+ * @throws exception if not ok
+ */
+ virtual void IsElementInDomL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aIsElementInDom) = 0;
+
+ /**
+ * Checks whether this element is child of a use element
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aResult Return "1" if used otherwise returns "0"
+ * @throws exception if not ok
+ */
+ virtual void IsUsedL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aResult) = 0;
+
+ /**
+ * Remove child
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aURI Uri
+ * @param aResourceData Resource
+ * @param aHandle Removed element handle
+ * @throws exception if not ok
+ */
+ virtual void RemoveChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle,
+ TM2GSvgElementHandle& aHandle) = 0;
+ /**
+ * Render document
+ * @since Series S60 3.1
+ * @param aEngineHandle Engine handle.
+ * @param aDocumentHandle Document handle.
+ * @param aSurfaceHandle Surface.
+ * @param aSurfaceMaskHandle Mask.
+ * @throws exception if not ok
+ */
+ virtual void RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GBitmapHandle& aSurfaceHandle,
+ TM2GBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime) = 0;
+
+// pankaj Qimage related changes TODO following Changes done
+ virtual void RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgBitmapHandle& aSurfaceHandle,
+ TM2GSvgBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime)=0;
+
+ /**
+ * Sets render quality
+ * @since Series S60 3.1
+ * @param aEngineHandle Engine handle.
+ * @param aQuality Quality.
+ * @throws exception if not ok
+ */
+ virtual void RenderQualityL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ TInt aQuality) = 0;
+
+ /**
+ * Request completed
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aURI -
+ * @param aResourceData -
+ * @param aCompeleted Result
+ * @throws exception if not ok
+ */
+ virtual void RequestCompletedL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aURI,
+ const TPtrC8& aResourceData,
+ TInt& aCompleted) = 0;
+
+ /**
+ * Set color trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aColor Color components: RGB
+ * @throws exception if not ok
+ */
+ virtual void SetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GColorData& aColor) = 0;
+
+ /**
+ * Set enum trait
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aValue Value
+ * @throws exception if not ok
+ */
+ virtual void SetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt16 aValue) = 0;
+
+ /**
+ * Set float attribute
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aValue Value
+ * @throws exception if not ok
+ */
+ virtual void SetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TReal32& aValue) = 0;
+
+ /**
+ * Set matrix attribute
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aMatrix -
+ * @throws exception if not ok
+ */
+ virtual void SetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GMatrixData& aMatrix) = 0;
+
+ /**
+ * Set media time
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document handle.
+ * @param aSeconds Media time
+ * @throws exception if not ok
+ */
+ virtual void SetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TReal32& aSeconds) = 0;
+
+ /**
+ * Set path attribute
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aPathHandle -
+ * @throws exception if not ok
+ */
+ virtual void SetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GSvgPathHandle& aPathHandle) = 0;
+
+ /**
+ * Set rect attribute
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aRect Rect trait to be set
+ * @throws exception if not ok
+ */
+ virtual void SetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GRectData& aRect) = 0;
+
+ /**
+ * Set render quality
+ * @since Series S60 3.1
+ * @param aEngineHandle Engine handle.
+ * @param aMode
+ * @throws exception if not ok
+ */
+ virtual void SetRenderingQualityL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ TInt aMode) = 0;
+
+ /**
+ * Set string attribute
+ * @since Series S60 3.1
+ * @param aElementHandle Element handle.
+ * @param aAttributeType Attribute type
+ * @param aStr String trait to be set
+ * @throws exception if not ok
+ */
+ virtual void SetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeTypeId,
+ const TPtrC16& aStr) = 0;
+
+ /**
+ * Set viewport height
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document
+ * @param aWidth Width
+ * @throws exception if not ok
+ */
+ virtual void SetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aHeight) = 0;
+
+ /**
+ * Set viewport width
+ * @since Series S60 3.1
+ * @param aDocumentHandle Document
+ * @param aWidth Width
+ * @throws exception if not ok
+ */
+ virtual void SetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aWidth) = 0;
+};
+
+M2G_NS_END
+
+#endif // MM2GSVGPROXY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/ESWTScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import javax.microedition.m2g.ScalableGraphics;
+import javax.microedition.m2g.ScalableImage;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.*;
+
+public class ESWTScalableGraphics
+{
+ Display iDisplay = null;
+ Rectangle iCanvasBounds = null;
+ ScalableGraphics iSg = null;
+ GC iBufferGC = null;
+ GC iRealGC = null;
+ Image iBufferedImage = null;
+
+ public ESWTScalableGraphics(Display display)
+ {
+ System.out.println("P+ ESWTScalableGraphics(Display display)");
+
+ iSg = ScalableGraphics.createInstance();
+ iDisplay = display;
+ }
+
+ public ESWTScalableGraphics(Display display, Rectangle canvasBounds)
+ {
+ System.out.println(" P+ ESWTScalableGraphics(Display display, Rectangle canvasBounds)");
+ iSg = ScalableGraphics.createInstance();
+ iDisplay = display;
+ iCanvasBounds = canvasBounds;
+ }
+
+ public void setBounds(Rectangle canvasBounds)
+ {
+ iCanvasBounds = canvasBounds;
+ }
+
+ public void bindTarget(GC gc)
+ {
+ System.out.println(" bindTarget(GC gc)");
+ iRealGC = gc;
+ iBufferedImage = new Image(iDisplay, iCanvasBounds);
+ iBufferGC = new GC(iBufferedImage);
+ iSg.bindTarget(iBufferGC);
+ }
+
+ public void releaseTarget()
+ {
+ System.out.println(" releaseTarget");
+
+ iSg.releaseTarget();
+ iBufferedImage.dispose();
+ iBufferGC.dispose();
+ /* iRealGC is disposed in paintControl */
+ iRealGC = null;
+ }
+
+ public void render(int x, int y, ScalableImage image)
+ {
+ System.out.println(" render(int x, int y, ScalableImage image)");
+ iSg.render(x,y, image);
+ iRealGC.drawImage(iBufferedImage, x, y);
+ }
+
+ public void setRenderingQuality(int mode)
+ {
+ System.out.println("setRenderingQuality(int mode)");
+ iSg.setRenderingQuality(mode);
+ }
+
+ public void setTransparency(float alpha)
+ {
+ System.out.println("setTransparency(float alpha)");
+ iSg.setTransparency(alpha);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDOMChangeObserver.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+/**
+ * Anyone implementing this interface will receive notifications
+ * about changes in DOM.
+ * <br>
+ * Subject = M2GDocument
+ * Observer/listener = M2GSVGCanvas
+ * <br>
+ * M2GSVGCanvas from M2GSVGAnimator implements this in order to be notified
+ * about changes in DOM, so that SVGImage updates
+ * (via the API, e.g. setTrait(), insertBefore()) will be rendered
+ * while Animator is in pause state.
+ * <br>
+ * M2GSVGElement informs M2GDocument about changes in DOM
+ * (e.g. adding/removing nodes, changing traits),
+ * and then M2GDocument informs M2GSVGCanvas.
+ * <br>
+ * @since S60 3.2
+ */
+public interface M2GDOMChangeObserver
+{
+ /**
+ * Notifies about any change in DOM
+ */
+ public void notifyDOMChange();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDestroyable.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+//import com.nokia.mj.impl.rt.legacy.ToolkitInvoker;
+//import com.nokia.mj.impl.rt.legacy.ToolkitObserver;
+
+/**
+ * Interface
+ */
+public interface M2GDestroyable
+{
+ /**
+ * Finalization
+ */
+ void doDestroy();
+}
+
+//--------------------------------------------------
+// OTHER CLASSES
+//--------------------------------------------------
+/**
+ * M2GDestroyer implements the ToolkitObserver interface.
+ */
+class M2GDestroyer
+{
+ private M2GDestroyable iDestroyable;
+
+ /**
+ * Ctor
+ * @param aDestroyable Destroy target
+ */
+ M2GDestroyer(M2GDestroyable aDestroyable)
+ {
+ if (aDestroyable != null)
+ {
+ iDestroyable = aDestroyable;
+ }
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDocument.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1339 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.*;
+import org.w3c.dom.events.*;
+import org.w3c.dom.svg.SVGElement;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.lang.ref.WeakReference;
+import java.util.Vector;
+import java.util.Enumeration;
+import javax.microedition.m2g.*;
+import com.nokia.microedition.m2g.connection.*;
+import com.nokia.mj.impl.utils.Logger;
+
+public class M2GDocument extends M2GObject
+ implements Document, M2GConnectionPolicyHandler
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ // Error constants
+ /* Optimization: static finals changed to local variables
+ public static final String UNSUPORTED_ELEMENT_TYPE_ESTR =
+ "The type of element is not supported by the implementation.";
+ public static final String UNSUPORTED_NAMESPACE_ESTR =
+ "The URI is not the SVG namespace URI.";
+ public static final String ID_IS_NULL_ESTR =
+ "The ID is null.";
+ public static final String NAMESPACE_URI_IS_NULL_ESTR =
+ "The namespace URI is null.";
+ public static final String QUALIFIED_NAME_IS_NULL_ESTR =
+ "The qualifiedName is null.";
+ public static final String CANNOT_APPEND_CHILD_ESTR =
+ "Cannot appendChild to a Document node.";
+ public static final String CANNOT_INSERT_BEFORE_ESTR =
+ "Cannot insertBefore a Document node.";
+ public static final String CANNOT_REMOVE_CHILD_ESTR =
+ "Cannot removeChild from a Document node.";
+ public static final String DOCUMENT_IS_ILLEGAL_ESTR =
+ "The SVG document does not conform to the XML 1.0 specification.";
+ public static final String HEIGHT_IS_ILLEGAL_ESTR =
+ "The height is negative.";
+ public static final String WIDTH_IS_ILLEGAL_ESTR =
+ "The width is negative.";
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GEventDispatcher iEventDispatcher = null;
+ private ExternalResourceHandler iResourceHandler = null;
+ private M2GSVGImage iImage = null;
+ private M2GSVGSVGElement iRootElement = null;
+ private final M2GLiveElements iLiveElements = new M2GLiveElements(true);
+ private M2GConnectionPolicy iConnectionPolicy =
+ M2GConnectionFactory.getDefaultPolicy();
+ boolean iConnectionRight = true;
+ Vector iExternalResources = new Vector();
+
+ /** A base url from where a document was downloaded */
+ String iBaseUrl;
+
+ /** The suffix of the url from where the document was open*/
+ String iSuffixUrl;
+
+ /**
+ * Observer to be notified about changes in DOM
+ * @see M2GDOMChangeObserver.notifyDOMChange()
+ */
+ private M2GDOMChangeObserver iDOMChangeObserver = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Creates new document object. If aData is null or empty then
+ * an empty document is create.
+ * @param aImage Svg image
+ * @param aBaseUrl A base url from where a document is downloaded.
+ * @param aSuffixUrl A suffix url from where a document is downloaded
+ * @param aData Plain text svg data
+ */
+ public M2GDocument(M2GSVGImage aImage, String aBaseUrl, String aSuffixUrl,
+ String aData)
+ {
+ super();
+
+ System.out.println("P-M2GDocument Constructor getting Called.");
+ iImage = aImage;
+ iBaseUrl = aBaseUrl;
+ iSuffixUrl = aSuffixUrl;
+
+ setHandle(_createDocument(
+ getNativeSVGProxyHandle(),
+ aData)
+ );
+
+ doConstruct();
+ }
+
+ /**
+ * @see org.w3c.dom.Node#appendChild()
+ */
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "appendChild() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ Logger.ELOG(Logger.EJavaUI, "appendChild() - exception: "
+ + /*SF*/"Cannot appendChild to a Document node."/*SF*/);
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Cannot appendChild to a Document node."/*SF*/);
+ }
+
+ /**
+ * Appends external resource uri to internal container
+ * @param aUri External resource uri
+ * @return true if succeeds
+ */
+ boolean appendExternalResourceURI(String aUri)
+ {
+ boolean result = false;
+ if (aUri != null && !aUri.equals(""))
+ {
+ synchronized (iExternalResources)
+ {
+ if (!iExternalResources.contains(aUri))
+ {
+ iExternalResources.addElement(aUri);
+ result = true;
+ }
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "appendExternalResourceURI() uri=" +
+ ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
+ return result;
+ }
+
+ /**
+ * Checks if document contains the element
+ * @param id
+ * @return true if document contains the element
+ */
+ public boolean containsElement(String id)
+ {
+ if (id == null || id.equals(""))
+ {
+ return false;
+ }
+ int handle = _getElementById(
+ getNativeSVGProxyHandle(),
+ getHandle(), id);
+ return M2GObject.checkHandle(handle);
+ }
+
+ /**
+ * Check if external resource uri exists in internal container
+ * @param aUri External resource uri
+ * @return true if uri exists in container
+ */
+ boolean containsExternalResourceURI(String aUri)
+ {
+ boolean result = false;
+ if (aUri != null && !aUri.equals(""))
+ {
+ synchronized (iExternalResources)
+ {
+ result = iExternalResources.contains(aUri);
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "containsExternalResourceURI() uri=" +
+ ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
+ return result;
+ }
+
+
+ /**
+ * @see org.w3c.dom.Document#createElementNS()
+ */
+ public Element createElementNS(String namespaceURI, String qualifiedName)
+ {
+ if (namespaceURI == null || namespaceURI.equals(""))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "createElementNS() exception because namespace is null. qualifiedName="
+ + qualifiedName);
+ throw new NullPointerException(/*SF*/"The namespace URI is null."/*SF*/);
+ }
+ if (qualifiedName == null || qualifiedName.equals(""))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "createElementNS() exception - " + namespaceURI + ", "
+ + qualifiedName);
+ throw new NullPointerException(/*SF*/"The qualifiedName is null."/*SF*/);
+ }
+ // Checks element validity
+ if (!M2GSVGConstants.isQualifiedElement(qualifiedName))
+ {
+ Logger.ELOG(Logger.EJavaUI, "createElementNS() exception - "
+ + namespaceURI + ", " + qualifiedName);
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"The type of element is not supported by the implementation."/*SF*/);
+ }
+ // Checks namespace validity
+ if (!namespaceURI.equals(M2GSVGConstants.SVG_NAMESPACE_URI))
+ {
+ Logger.ELOG(Logger.EJavaUI, "createElementNS() exception - "
+ + namespaceURI + ", " + qualifiedName);
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"The URI is not the SVG namespace URI."/*SF*/);
+ }
+ // Creates native element. A native document owns the new element.
+ // NOTE: The element is NOT located in the DOM tree yet.
+ int elementHandle = _createElementNS(
+ getNativeSVGProxyHandle(),
+ M2GSVGConstants.parseElementTypeId(qualifiedName),
+ getHandle());
+ M2GSVGLocatableElement element = null;
+ // Checks native handle validity
+ if (M2GObject.checkHandle(elementHandle))
+ {
+ // Creates java element object
+ element = new M2GSVGLocatableElement(elementHandle, this);
+ registerLiveElement(element, new Integer(elementHandle));
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "createElementNS(): " + qualifiedName + " - end, NOK!!!");
+ }
+ return element;
+ }
+
+ /**
+ * Checks document validity.
+ * @return true if valid
+ */
+ public boolean doCheckValidity() throws IOException
+ {
+ boolean result = false;
+ if (isHandleValid())
+ {
+ M2GSVGSVGElement root = getRootElement();
+ if (root != null)
+ {
+ // Check svg version and base profile
+ root.checkVersionAndProfile();
+ result = true;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Cleanup
+ * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
+ */
+ public void doCleanup()
+ {
+ if (isHandleValid())
+ {
+ _deleteDocument(
+ getNativeSVGProxyHandle(),
+ getHandle());
+ }
+ iImage = null;
+ if (iEventDispatcher != null)
+ {
+ iEventDispatcher.clear();
+ iEventDispatcher = null;
+ }
+ resetHandles();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
+ */
+ protected void doConstruct()
+ {
+ super.doConstruct();
+ iEventDispatcher = new M2GEventDispatcher();
+ }
+
+ /**
+ * Find an element from the handle-to-element map.
+ * @see M2GLiveElements#findElement()
+ */
+ public SVGElement findLiveElement(Integer aElementHandle)
+ {
+ return iLiveElements.findElement(aElementHandle);
+ }
+
+ /**
+ * Get connection policy
+ * @see M2GConnectionListener#getConnectionPolicy()
+ */
+ public M2GConnectionPolicy getConnectionPolicy()
+ {
+ return iConnectionPolicy;
+ }
+
+ /**
+ * @see org.w3c.dom.Document#getDocumentElement()
+ */
+ public Element getDocumentElement()
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getDocumentElement() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return getRootElement();
+ }
+
+ /**
+ * @see org.w3c.dom.Document#getElementById()
+ */
+ public Element getElementById(String id)
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getElementById() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ if (id == null || id.equals(""))
+ {
+ Logger.ELOG(Logger.EJavaUI, "getElementById() - exception");
+ throw new NullPointerException(/*SF*/"The ID is null."/*SF*/);
+ }
+ int elementHandle = _getElementById(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ id );
+ return M2GSVGElement.buildElement(elementHandle, this);
+ }
+
+ /**
+ * Returns the image
+ */
+ public M2GSVGImage getImage()
+ {
+ return iImage;
+ }
+
+ /**
+ * @see org.w3c.dom.Node#getLocalName()
+ */
+ public String getLocalName()
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getLocalName() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.Node#getNamespaceURI()
+ */
+ public String getNamespaceURI()
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getNamespaceURI() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.Node#getParentNode()
+ */
+ public Node getParentNode()
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getParentNode() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return null;
+ }
+
+ /**
+ * Get root element
+ * @return M2GSVGSVGElement
+ */
+ public M2GSVGSVGElement getRootElement()
+ {
+ if (iRootElement == null)
+ {
+ iRootElement = M2GSVGSVGElement.buildRootElement(this);
+ }
+ return iRootElement;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#getViewportHeight()
+ */
+ public int getViewportHeight()
+ {
+ return _getViewportHeight(
+ getNativeSVGProxyHandle(),
+ getHandle());
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#getViewportWidth()
+ */
+ public int getViewportWidth()
+ {
+ return _getViewportWidth(
+ getNativeSVGProxyHandle(),
+ getHandle() );
+ }
+
+
+ /**
+ * Called by SVGImage upon creating an Event instance
+ * Calls the handleEvent() of all the listeners of the event
+ */
+ public void handleEvent(Event aEvent)
+ {
+ iEventDispatcher.handleEvent(aEvent);
+ }
+
+ /**
+ * @see org.w3c.dom.Node#insertBefore()
+ */
+ public Node insertBefore(Node newChild, Node refChild)
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "insertBefore() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+
+ Logger.ELOG(Logger.EJavaUI, "insertBefore() DOMException");
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Cannot insertBefore a Document node."/*SF*/);
+ }
+
+ /**
+ * Checks if element is in DOM
+ * @param aElementHandle -
+ * @return true if element is in DOM
+ */
+ public boolean isElementInDOM(int aElementHandle)
+ {
+ if (!M2GObject.checkHandle(aElementHandle))
+ {
+ return false;
+ }
+ return (_isElementInDOM(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ aElementHandle) > 0 ? true : false);
+ }
+
+ /**
+ * The external resource handler is invoked
+ * for any external resource referenced in the document.
+ * @param aUri External resource referenced in the document
+ */
+ public void invokeResourceHandler(String aUri)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeResourceHandler() - URI="
+ + aUri + " - begin");
+
+ if ((iImage != null) && (iResourceHandler != null) &&
+ (aUri != null) && (aUri.length() > 4))
+ {
+ StringBuffer urlBuf = new StringBuffer();
+ // The uri format for external resource must include the base url
+ // from which the document was loaded. It's also checked that the
+ // url read from svg doesn't contain already the base part.
+ if ((iBaseUrl != null) &&
+ !iBaseUrl.equals("") &&
+ (aUri.indexOf(iBaseUrl) == -1))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "invokeResourceHandler() append base url=" + iBaseUrl);
+ urlBuf.append(iBaseUrl);
+ }
+
+ urlBuf.append(aUri);
+
+ // append the url suffix in case of drm open mode
+ if (iSuffixUrl != null && !iSuffixUrl.equals(""))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "invokeResourceHandler() append suffix url=" + iSuffixUrl);
+ urlBuf.append(iSuffixUrl);
+ }
+
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "invokeResourceHandler() handler uri=" + urlBuf.toString());
+
+ iResourceHandler.requestResource(iImage, urlBuf.toString());
+ appendExternalResourceURI(aUri);
+ }
+
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "invokeResourceHandler() - URI:" + aUri + " - end");
+ }
+
+ /**
+ * Registers an event target and an event listener.
+ * @param aTarget Target element
+ * @param aType Event type
+ * @param aListener Event listener
+ */
+ void register(EventTarget aTarget, String aType, EventListener aListener)
+ {
+ iEventDispatcher.register(aTarget, aType, aListener);
+ }
+
+ /**
+ * Register element
+ * @see M2GLiveElements#registerElement()
+ */
+ public void registerLiveElement(SVGElement aElement, Integer aElementHandle)
+ {
+ iLiveElements.registerElement(aElement, aElementHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.Node#removeChild()
+ */
+ public Node removeChild(Node oldChild) throws DOMException
+ {
+ // Optimization: if(!getConnectionPolicy().getAccessRight())
+ if (!iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "removeChild() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ Logger.ELOG(Logger.EJavaUI, "removeChild() DOMException");
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"Cannot removeChild from a Document node."/*SF*/);
+ }
+
+ /**
+ * Removes external resource uri from internal container
+ * @param aUri External resource uri
+ * @return true if succeeds
+ */
+ boolean removeExternalResourceURI(String aUri)
+ {
+ boolean result = false;
+ if (aUri != null && !aUri.equals(""))
+ {
+ synchronized (iExternalResources)
+ {
+ result = iExternalResources.removeElement(aUri);
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "removeExternalResourceURI() uri="
+ + ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
+ return result;
+ }
+
+ /*
+ * @see com.nokia.microedition.m2g.M2GSVGImage#requestCompleted()
+ */
+ public int requestCompleted(String aUri, byte[] aResourceData)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "requestCompleted() uri=" + aUri + " - begin");
+ // If the aUri contains a base part it will be cut off
+ if (!aUri.equals("") &&
+ (iBaseUrl != null) &&
+ !containsExternalResourceURI(aUri) &&
+ (aUri.indexOf(iBaseUrl, 0) != -1))
+ {
+ aUri = aUri.substring(iBaseUrl.length(), aUri.length());
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "requestCompleted() uri when base part is cut off=" + aUri);
+ }
+
+ // Execute tha request command.
+ int status = _requestCompleted(
+ getNativeSVGProxyHandle(),
+ getHandle(), aUri, aResourceData);
+ if ((status == 0) || aUri.equals(""))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "requestCompleted() remove URI=" + aUri);
+ removeExternalResourceURI(aUri);
+ }
+ return status;
+ }
+
+ /**
+ * Set connection policy
+ * @see M2GConnectionListener#setConnectionPolicy()
+ */
+ public void setConnectionPolicy(M2GConnectionPolicy aConnectionPolicy)
+ {
+ iConnectionPolicy = aConnectionPolicy;
+ if (iConnectionPolicy != null)
+ {
+ iConnectionRight = iConnectionPolicy.getAccessRight();
+ }
+ else
+ {
+ iConnectionRight = true;
+ }
+ }
+
+ /**
+ * Set image
+ * @param aImage Image
+ */
+ public void setImage(M2GSVGImage aImage)
+ {
+ iImage = aImage;
+ }
+
+ /**
+ * Set external resource handler
+ * @param aHandler External resource handler
+ */
+ public void setResourceHandler(ExternalResourceHandler aHandler)
+ {
+ iResourceHandler = aHandler;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#setViewportHeight()
+ */
+ public void setViewportHeight(int height)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setViewportHeight():" + height + " - begin");
+ if (height < 0)
+ {
+ Logger.ELOG(Logger.EJavaUI, "setViewportHeight():"
+ + height + " - IllegalArgumentException is thrown");
+ throw new IllegalArgumentException(/*SF*/"The height is negative."/*SF*/);
+ }
+ _setViewportHeight(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ height);
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setViewportHeight():" + height + " - end");
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#setViewportWidth()
+ */
+ public void setViewportWidth(int width)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setViewportWidth:" + width + " - begin");
+ if (width < 0)
+ {
+ Logger.ELOG(Logger.EJavaUI, "setViewportWidth():"
+ + width + " - IllegalArgumentException is thrown");
+ throw new IllegalArgumentException(/*SF*/"The width is negative."/*SF*/);
+ }
+ _setViewportWidth(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ width );
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setViewportWidth:" + width + " - end");
+ }
+
+ /**
+ * Unregister event listener
+ * @param aTarget Target element
+ * @param aType Event type
+ * @param aListener Event listener
+ */
+ void unregister(EventTarget aTarget, String aType, EventListener aListener)
+ {
+ iEventDispatcher.unregister(aTarget, aType, aListener);
+ }
+
+ /**
+ * Unregister an element from the handle-to-element map
+ * @see M2GLiveElements#unregisterElement()
+ */
+ public void unregisterLiveElement(Integer aElementHandle)
+ {
+ iLiveElements.unregisterElement(aElementHandle);
+ }
+
+ //--------------------------------------------------
+ // INNER CLASSES
+ //--------------------------------------------------
+ /**
+ * M2GLiveElements
+ */
+ class M2GLiveElements
+ {
+ private Hashtable iLiveElements = new Hashtable();
+ private boolean iUseWeakReference;
+
+ /**
+ * Constructor
+ */
+ public M2GLiveElements(boolean aUseWeakReference)
+ {
+ iUseWeakReference = aUseWeakReference;
+ }
+
+ /**
+ * Find an element from the handle-to-element map.
+ * @param aElementHandle Handle
+ * @return SVGElement. Null if not found
+ */
+ public SVGElement findElement(Integer aElementHandle)
+ {
+ SVGElement element = null;
+ Object weakObject = null;
+ Object object = null;
+
+ synchronized (this)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "** findElement() handle: " + aElementHandle + " - begin **");
+ object = iLiveElements.get(aElementHandle);
+ if (object != null)
+ {
+ if (iUseWeakReference)
+ {
+ weakObject = ((WeakReference)object).get();
+ if (weakObject == null)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "** findElement() handle: " + aElementHandle
+ + " is garbage collected. **");
+ iLiveElements.remove(aElementHandle);
+ }
+ else
+ {
+ element = (SVGElement)weakObject;
+ }
+ }
+ else
+ {
+ element = (SVGElement)object;
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,"** findElement() handle: " + aElementHandle
+ + ((element != null) ? " FOUND" : " NOT FOUND") + " - end **");
+ }
+ return element;
+ }
+
+ /**
+ * Register element
+ * @param aElement Element
+ * @param aElementHandle Handle
+ */
+ public void registerElement(SVGElement aElement, Integer aElementHandle)
+ {
+ if (aElement == null)
+ {
+ return;
+ }
+ synchronized (this)
+ {
+ if (iUseWeakReference)
+ {
+ iLiveElements.put(aElementHandle, new WeakReference(aElement));
+ }
+ else
+ {
+ iLiveElements.put(aElementHandle, aElement);
+ }
+ }
+ }
+
+ /**
+ * Unregister an element from the handle-to-element map
+ * @param aElementHandle Handle
+ */
+ public void unregisterElement(Integer aElementHandle)
+ {
+ synchronized (this)
+ {
+ iLiveElements.remove(aElementHandle);
+ }
+ }
+ }
+
+
+ /**
+ * M2GEventDispatcher
+ */
+ protected class M2GEventDispatcher
+ {
+ static public final int INDEX_UNDEFINED = -1;
+ static public final int INDEX_CLICK = 0;
+ static public final int INDEX_ACTIVATE = 1;
+ static public final int INDEX_FOCUS_IN = 2;
+ static public final int INDEX_FOCUS_OUT = 3;
+
+ Hashtable[] iEventTypes;
+ int iCurrentIndex;
+ Hashtable iDelayedRegistrations = new Hashtable();
+ M2GEventData iCurrentEventData = new M2GEventData();
+
+ /**
+ * Constructor
+ */
+ public M2GEventDispatcher()
+ {
+ iEventTypes = new Hashtable[4];
+ iCurrentIndex = INDEX_UNDEFINED;
+ }
+
+ /**
+ * Clear all
+ */
+ public void clear()
+ {
+ synchronized (this)
+ {
+ for (int index = 0; index < iEventTypes.length; index++)
+ {
+ if (iEventTypes[index] != null)
+ {
+ iEventTypes[index].clear();
+ iEventTypes[index] = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Execute delayed registration
+ * If an EventListener is added to an EventTarget while it is
+ * processing an event, it will not be triggered by the current actions.
+ */
+ private void doDelayedRegistration()
+ {
+ try
+ {
+ Enumeration registrations = iDelayedRegistrations.elements();
+ while (registrations.hasMoreElements())
+ {
+ M2GEventData eventData =
+ (M2GEventData)registrations.nextElement();
+ register(
+ eventData.iTarget, eventData.iType, eventData.iListener);
+ }
+ }
+ catch (NullPointerException e)
+ {
+ }
+ iDelayedRegistrations.clear();
+ }
+
+
+ /**
+ * Handle event
+ * @param aEvent Event
+ */
+ public void handleEvent(Event aEvent)
+ {
+ synchronized (this)
+ {
+ if ((aEvent == null) || !prepare(aEvent.getType()))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent() FAILED - event invalid");
+ return;
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent(): " + aEvent.getType() + " - begin");
+ EventTarget target = aEvent.getCurrentTarget();
+ if (target == null)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent() FAILED - event's target is null");
+ return;
+ }
+ // Check if wrapped event target
+ if (target instanceof M2GSVGElementWrapper)
+ {
+ target = ((M2GSVGElementWrapper)target).getWrappedTarget();
+ if (target == null)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent() FAILED - wrapped event's target is null");
+ return;
+ }
+ }
+ if (iEventTypes[iCurrentIndex].containsKey(target))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent() - target handling begin");
+ iCurrentEventData.set(target, aEvent.getType(), null);
+ Vector listeners =
+ (Vector)iEventTypes[iCurrentIndex].get(iCurrentEventData.iTarget);
+
+ if (listeners != null)
+ {
+ Enumeration index = listeners.elements();
+ while (index.hasMoreElements())
+ {
+ Object listener = index.nextElement();
+ if ((listener != null) && (listener instanceof EventListener))
+ {
+ ((EventListener)listener).handleEvent(aEvent);
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent(): listener is null!");
+ }
+ }
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent(): listeners is null!");
+ }
+ iCurrentEventData.clear();
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "handleEvent(): target not found");
+ }
+ // Execute the delayed registration.
+ doDelayedRegistration();
+ }
+ }
+
+ /**
+ * Check is event targets are equal
+ * @param aLhs Left hand side
+ * @param aRhs Right hand side
+ * @return True if equal
+ */
+ private boolean isEquals(EventTarget aLhs, EventTarget aRhs)
+ {
+ int lhsHandle = M2GObject.INVALID_NATIVE_HANDLE;
+ int rhsHandle = M2GObject.INVALID_NATIVE_HANDLE;
+ if (aLhs instanceof M2GSVGElement)
+ {
+ lhsHandle = ((M2GSVGElement)aLhs).getHandle();
+ }
+ if (aRhs instanceof M2GSVGElement)
+ {
+ rhsHandle = ((M2GSVGElement)aRhs).getHandle();
+ }
+ if ((lhsHandle == rhsHandle) && (lhsHandle != M2GObject.INVALID_NATIVE_HANDLE))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Set an index that points to an event type hash table.
+ * The hash table is created if needed.
+ * @param aType Type
+ */
+ private boolean prepare(String aType)
+ {
+ if (!setIndex(aType))
+ {
+ return false;
+ }
+ if (iEventTypes[iCurrentIndex] == null)
+ {
+ iEventTypes[iCurrentIndex] = new Hashtable();
+ }
+ return true;
+ }
+
+ /**
+ * Register an event target and an event listener pair
+ * @param aTarget Target
+ * @param aType Type
+ * @param aListener Listener
+ */
+ public void register(EventTarget aTarget,
+ String aType,
+ EventListener aListener)
+ {
+ // NOTE: no need to check validity of aTarget & aListener. It's
+ // already done.
+ synchronized (this)
+ {
+ if (!prepare(aType))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "register() - failed: " + aType);
+ return;
+ }
+ // Check if delayed registration is needed
+ // If an EventListener is added to an EventTarget while it is
+ // processing an event, it will not be triggered by
+ // the current actions.
+ if ((iCurrentEventData.iType == aType) &&
+ isEquals(iCurrentEventData.iTarget, aTarget))
+ {
+ try
+ {
+ iDelayedRegistrations.put(
+ aListener,
+ new M2GEventData(aTarget, aType, aListener));
+ }
+ catch (NullPointerException e)
+ {
+ }
+ return;
+ }
+ Vector listeners = null;
+ if (iEventTypes[iCurrentIndex].containsKey(aTarget))
+ {
+ listeners = (Vector)iEventTypes[iCurrentIndex].get(aTarget);
+ }
+ else
+ {
+ listeners = new Vector();
+ iEventTypes[iCurrentIndex].put(aTarget, listeners);
+ }
+ // Don't add if the event target already contains the same listener
+ // for the same event.
+ if (!listeners.contains(aListener))
+ {
+ listeners.addElement(aListener);
+ }
+ }
+ }
+
+ /**
+ * Set an event type container index
+ * @param aType Type
+ * @return False if the type is invalid
+ */
+ private boolean setIndex(String aType)
+ {
+ if (aType.equals(M2GSVGConstants.EVENT_ACTIVATE))
+ {
+ iCurrentIndex = INDEX_ACTIVATE;
+ }
+ else if (aType.equals(M2GSVGConstants.EVENT_CLICK))
+ {
+ iCurrentIndex = INDEX_CLICK;
+ }
+ else if (aType.equals(M2GSVGConstants.EVENT_FOCUS_IN))
+ {
+ iCurrentIndex = INDEX_FOCUS_IN;
+ }
+ else if (aType.equals(M2GSVGConstants.EVENT_FOCUS_OUT))
+ {
+ iCurrentIndex = INDEX_FOCUS_OUT;
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setIndex() type:" + aType + " FALSE - end");
+ // Wrong event type
+ iCurrentIndex = INDEX_UNDEFINED;
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Unregister an event target and an event listener pair
+ * @param aTarget Target
+ * @param aType Type
+ * @param aListener Listener
+ */
+ public void unregister(EventTarget aTarget,
+ String aType,
+ EventListener aListener)
+ {
+ synchronized (this)
+ {
+ if (!prepare(aType))
+ {
+ return;
+ }
+ // Remove delayed registration
+ iDelayedRegistrations.remove(aListener);
+ // Remove real registration
+ Vector listeners = (Vector)iEventTypes[iCurrentIndex].get(aTarget);
+ boolean removed = false;
+ if (listeners != null)
+ {
+ removed = listeners.removeElement(aListener);
+ if (listeners.isEmpty())
+ {
+ iEventTypes[iCurrentIndex].remove(aTarget);
+ }
+ }
+ if (removed)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "unregister() ok - end");
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "unregister() failed - end");
+ }
+ }
+ }
+
+ /**
+ * Helper class for handling delayed registration
+ */
+ class M2GEventData
+ {
+ public EventTarget iTarget = null;
+ public String iType = null;
+ public EventListener iListener = null;
+
+ /**
+ * Ctor
+ */
+ public M2GEventData()
+ {
+ }
+
+ /**
+ * Ctor
+ * @param aTarget Target
+ * @param aType Event type
+ * @param aListener Event listener
+ */
+ public M2GEventData(
+ EventTarget aTarget,
+ String aType,
+ EventListener aListener)
+ {
+ set(aTarget, aType, aListener);
+ }
+
+ /**
+ * Clearing
+ */
+ public void clear()
+ {
+ iTarget = null;
+ iType = null;
+ iListener = null;
+ }
+
+ /**
+ * Setter
+ * @param aTarget Target
+ * @param aType Event type
+ * @param aListener Event listener
+ */
+ public void set(EventTarget aTarget,
+ String aType,
+ EventListener aListener)
+ {
+ iTarget = aTarget;
+ iType = aType;
+ iListener = aListener;
+ }
+ }
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+
+ /**
+ * Creates an empty SVG document. The document contains a
+ * root <svg> element with default viewport size of 100x100.
+ * @param aImage -
+ * @param aHander -
+ * @return document object
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+ static public M2GDocument buildEmptyDocument(M2GSVGImage aImage,
+ ExternalResourceHandler aHandler)
+ throws IllegalArgumentException, IOException
+ {
+ return M2GDocument.buildDocument(
+ aImage,
+ null,
+ null,
+ M2GSVGConstants.getInstance().iEmptySvgDocument,
+ aHandler);
+ }
+
+ /**
+ * Builds document
+ * @param aImage Svg image
+ * @param aBaseUrl A base url from where a document is downloaded.
+ * @param aSuffixUrl The suffix url from where a document is downloaded.
+ * @param aData Plain text svg data
+ * @param aHandler Resource handler. If null the default resource handler is
+ * used.
+ * @return document object
+ * @throws IllegalArgumentException
+ * @throws IOException
+ */
+ static public M2GDocument buildDocument(M2GSVGImage aImage,
+ String aBaseUrl,
+ String aSuffixUrl,
+ String aData,
+ ExternalResourceHandler aHandler)
+ throws IOException
+ {
+ System.out.println("P-M2GDocument");
+ if ((aData == null) || (aData.equals("")))
+ {
+ System.out.println("P-M2GDocument (aData == null) || (aData.equals()");
+ throw new IOException(
+ /*SF*/"The SVG document does not conform to the XML 1.0 specification."/*SF*/);
+ }
+
+ M2GDocument document = new M2GDocument(aImage, aBaseUrl, aSuffixUrl, aData);
+
+ if (document.doCheckValidity())
+ {
+ document.setResourceHandler(aHandler);
+ return document;
+ }
+ throw new IOException(
+ /*SF*/"The SVG document does not conform to the XML 1.0 specification."/*SF*/);
+ }
+
+ /**
+ * Registers an observer to any DOM change
+ * @since S60 3.2
+ */
+ public void registerDOMChangeObserver(M2GDOMChangeObserver aDOMChangeObserver)
+ {
+ iDOMChangeObserver = aDOMChangeObserver;
+ }
+
+ /**
+ * Notify the observer about any change in DOM
+ * SVGSVGElement is always part of DOM
+ * @since S60 3.2
+ */
+ public void notifyDOMChangeObserver()
+ {
+ if (iDOMChangeObserver != null)
+ {
+ iDOMChangeObserver.notifyDOMChange();
+ }
+ }
+
+ /**
+ * Notify the observer about any change in DOM only if the node is in DOM
+ * @param aNativeHandle the handle of a node
+ * @since S60 3.2
+ */
+ public void notifyDOMChangeObserver(int aNativeHandle)
+ {
+ if (iDOMChangeObserver != null && isElementInDOM(aNativeHandle))
+ {
+ iDOMChangeObserver.notifyDOMChange();
+ }
+ }
+
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private native static int _createDocument(
+ int aSvgProxyHandle, String aString);
+
+ private native static int _createElementNS(
+ int aSvgProxyHandle, short aType,
+ int aDocumentHandle);
+
+ private native static void _deleteDocument(
+ int aSvgProxyHandle, int aDocumentHandle);
+
+ private native static int _getElementById(
+ int aSvgProxyHandle, int aDocumentHandle,
+ String aId);
+
+ private static native int _getViewportHeight(
+ int aSvgProxyHandle, int aDocumentHandle);
+
+ private static native int _getViewportWidth(
+ int aSvgProxyHandle, int aDocumentHandle);
+
+ private native static int _isElementInDOM(
+ int aSvgProxyHandle, int aDocumentHandle,
+ int aElementHandle);
+
+ private static native int _requestCompleted(
+ int aSvgProxyHandle, int aDocumentHandle,
+ String aUri, byte[] aResourceData);
+
+ private static native void _setViewportHeight(
+ int aSvgProxyHandle, int aDocumentHandle, int aHeight);
+
+ private static native void _setViewportWidth(
+ int aSvgProxyHandle, int aDocumentHandle, int aWidth);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GEvent.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.events.*;
+import org.w3c.dom.svg.SVGElement;
+
+/**
+ * The Event interface is used to provide contextual information about an event to the handler
+ * processing the event. An object which implements the Event interface is passed as the first
+ * parameter to the {@link org.w3c.dom.events.EventListener#handleEvent handleEvent} call.
+ */
+public class M2GEvent implements Event
+{
+ public static final boolean EVENT_TARGET = false;
+ public static final boolean WRAPPED_EVENT_TARGET = true;
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private String iEventType;
+ private EventTarget iTarget;
+ private boolean iWrappedTarget;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aEventType Type
+ * @param aTarget Target
+ * @param aWrappedTarget If WRAPPED_EVENT_TARGET then <code>getCurrentTarget</code>
+ * method returns a wrapped event target (which base class is NOT <code>Node</code>.
+ * Otherwise normal event target (which base class is <code>Node</code>) is returned.
+ */
+ public M2GEvent(String aEventType, EventTarget aTarget, boolean aWrappedTarget)
+ {
+ iEventType = aEventType;
+ iTarget = aTarget;
+ iWrappedTarget = aWrappedTarget;
+ }
+
+ /**
+ * @see org.w3c.dom.events.Event#getCurrentTarget()
+ * @see M2GEvent()
+ */
+ public EventTarget getCurrentTarget()
+ {
+ if (iWrappedTarget)
+ {
+ if ((iTarget != null) && (iTarget instanceof M2GSVGElement))
+ {
+ return new M2GSVGElementWrapper((M2GSVGElement)iTarget);
+ }
+ return null;
+ }
+ return iTarget;
+ }
+
+ /**
+ * @see org.w3c.dom.events.Event#getType()
+ */
+ public String getType()
+ {
+ return iEventType;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GManager.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import java.lang.ref.WeakReference;
+//import com.nokia.mj.impl.rt.legacy.MIDEventServer;
+import java.util.Hashtable;
+//import com.nokia.mj.impl.rt.legacy.MemoryUtil;
+import java.util.Enumeration;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+
+
+public final class M2GManager implements Listener
+{
+ //--------------------------------------------------
+ // STATIC VARIABLES
+ //--------------------------------------------------
+
+ private static WeakReference sWeakManagerProxy = null;
+ static Object sQuard = new Object();
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private Hashtable iLiveObjects = new Hashtable();
+ private M2GWeakManager iWeakManager = null;
+ private int iSVGProxyHandle = M2GObject.INVALID_NATIVE_HANDLE;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * Constructor
+ */
+ private M2GManager()
+ {
+ super();
+ System.out.println("P- Manager Constructor.." );
+
+ //As Display is created in Thread only.. So no need to handle display over here.
+ //scom.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g");
+ /*// setup the finalization via eswt's Display
+ Display display = Display.getCurrent();
+ if (display == null)
+ {
+ return; // ?
+ }
+ display.addListener(SWT.Dispose, (Listener)this); */
+
+ System.out.println("P- Manager Constructor.._createSvgProxy calleds" );
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ iSVGProxyHandle = _createSvgProxy();
+ }
+ });
+ M2GManager.heuristicGC();
+ }
+
+ /**
+ * Impelements 'handleEvent' from Listener
+ */
+ public void handleEvent(Event e)
+ {
+ if (e.type == SWT.Dispose)
+ {
+ doCleanup();
+ }
+ }
+
+ /**
+ * Does the cleanuping
+ */
+ protected void doCleanup()
+ {
+ finalizeObjects();
+ synchronized (sQuard)
+ {
+ _deleteSvgProxy(iSVGProxyHandle);
+ iSVGProxyHandle = M2GObject.INVALID_NATIVE_HANDLE;
+ sWeakManagerProxy = null;
+ iLiveObjects = null;
+ }
+ }
+
+
+ /**
+ * Find an element from the handle-to-element map.
+ * @param aElementHandle Handle
+ * @return SVGElement. Null if not found
+ */
+ synchronized private void finalizeObjects()
+ {
+ Enumeration objects = iLiveObjects.elements();
+ while (objects.hasMoreElements())
+ {
+ Object weakObject = ((WeakReference)objects.nextElement()).get();
+ if (weakObject != null)
+ {
+ ((M2GObject)weakObject).registeredFinalize();
+ }
+ }
+ // Clear table
+ iLiveObjects.clear();
+ }
+
+
+ /**
+ * Gets native SVG proxy handle
+ * @return SVG proxy handle
+ */
+ public int getSVGProxyHandle()
+ {
+ synchronized (sQuard)
+ {
+ return iSVGProxyHandle;
+ }
+ }
+
+ /**
+ * Gets native SVG proxy handle
+ * @return SVG proxy handle
+ */
+ void init(M2GWeakManager aWeakManager)
+ {
+ iWeakManager = aWeakManager;
+ }
+
+ /**
+ * Register an object
+ * @param aObject Object
+ */
+ synchronized public void register(M2GObject aObject)
+ {
+ if (aObject == null)
+ {
+ return;
+ }
+ iLiveObjects.put(new Integer(aObject.getHandle()), new WeakReference(aObject));
+ }
+
+ /**
+ * Unregister an object
+ * @param aHandle Object's native handle
+ */
+ synchronized public void unregister(Integer aHandle)
+ {
+ iLiveObjects.remove(aHandle);
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+
+ /**
+ * Gets instance of singleton manager object
+ * @return manager object reference
+ */
+ static public M2GManager getInstance()
+ {
+ M2GWeakManager weakManager = null;
+ synchronized (sQuard)
+ {
+ if (sWeakManagerProxy != null)
+ {
+ System.out.println("P- getInstance M2GManager Construction sWeakManagerProxy != null.." );
+ weakManager = (M2GWeakManager)sWeakManagerProxy.get();
+ }
+ // Check if object null
+ if (weakManager == null)
+ {
+ // Create a new object and put it into the static member variable
+ System.out.println("P- getInstance M2GManager Construction sWeakManagerProxy == null.." );
+ weakManager = new M2GWeakManager(new M2GManager());
+ sWeakManagerProxy = new WeakReference(weakManager);
+ }
+ return weakManager.getInstance();
+ }
+ }
+
+ /**
+ * Trigger GC every N objects
+ */
+ static final void heuristicGC()
+ {
+ //MemoryUtil.ensureMinFreeRAM();
+ }
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private static native int _createSvgEngine(int aSvgProxyHandle );
+
+ private static native int _createSvgProxy();
+
+ private static native void _deleteSvgEngine(int aSvgProxyHandle, int aSvgEngineHandle);
+
+ private static native void _deleteSvgProxy( int aSvgProxyHandle);
+
+
+}
+
+//--------------------------------------------------
+// OTHER CLASSES
+//--------------------------------------------------
+
+/*
+ * M2GWeakManager takes care of carbage colletion of an M2GManager object
+ */
+class M2GWeakManager
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ M2GManager iManager;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * Constructor
+ * @param aManager Manager object
+ */
+ public M2GWeakManager(M2GManager aManager)
+ {
+ reset(aManager);
+ }
+
+ /**
+ * Return a reference to the manager
+ * @return a reference to the manager
+ */
+ M2GManager getInstance()
+ {
+ return iManager;
+ }
+
+ /**
+ * Reset
+ * @param aManager
+ */
+ void reset(M2GManager aManager)
+ {
+ iManager = aManager;
+ if (iManager != null)
+ {
+ iManager.init(this);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GObject.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import java.io.IOException;
+
+import com.nokia.microedition.m2g.NativeError;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * Base class
+ */
+abstract class M2GObject
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final int INVALID_NATIVE_HANDLE = 0;
+ // static final String ESWT_PACKAGE = "org.eclipse.swt.widgets.Display" ;
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ int iNativeHandle;
+ M2GManager iManager;
+ private Finalizer mFinalizer;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor.
+ */
+ M2GObject()
+ {
+ this(INVALID_NATIVE_HANDLE);
+ System.out.println("P- M2GObject(s)" );
+ }
+
+ /**
+ * Constructor.
+ * @param a native handle
+ */
+ M2GObject(int aHandle)
+ {
+ System.out.println("P- M2GObject(int aHandle)" );
+ iNativeHandle = aHandle;
+ System.out.println("P- M2GManager Construction.." );
+ iManager = M2GManager.getInstance();
+ System.out.println("P- M2GManager Construction complete.." );
+ }
+
+ /**
+ * Checks handle validity.
+ * @return true if valid
+ */
+ boolean doCheckValidity() throws IOException
+ {
+ return isHandleValid();
+ }
+
+ /**
+ * Cleanup operations.
+ */
+ abstract void doCleanup();
+
+ /**
+ * Construct operations. Registration for finalization is done here.
+ */
+ void doConstruct()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "doConstruct(), register for finalization: "
+ + this.getClass().getName());
+ M2GManager.heuristicGC();
+ mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+ }
+
+ /**
+ * Create destroyer.
+ */
+ void createDestroyer()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "createDestroyer(): " + this.getClass().getName());
+
+ }
+
+ /**
+ * Gets native handle
+ * @return native handle
+ */
+ int getHandle()
+ {
+ return iNativeHandle;
+ }
+
+ /**
+ * Gets native proxy handle
+ * @return native handle
+ */
+ int getNativeSVGProxyHandle()
+ {
+ return iManager.getSVGProxyHandle();
+ }
+
+ /**
+ * Checks if native handle is valid.
+ */
+ boolean isHandleValid()
+ {
+ M2GObject.checkNativeError(iNativeHandle);
+ return M2GObject.checkHandle(iNativeHandle);
+ }
+
+ /**
+ * Register an object
+ * @param aObject Object
+ */
+ void register(M2GObject aObject)
+ {
+ iManager.register(aObject);
+ }
+
+ /**
+ * @see ObjectExtensions#registerForFinalization()
+ */
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ synchronized final void registeredFinalize()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "registeredFinalize() begin - doCleanup() is called");
+ doCleanup();
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "registeredFinalize() end");
+ }
+
+ /**
+ * This method is called in Toolkit's destroyNotify call.
+ * This will release convenient native resources. All native resource
+ * will be deleted in registeredFinalize() method.
+ */
+ synchronized final void release()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "release()");
+ }
+
+ /**
+ * Initializes native handles.
+ */
+ void resetHandles()
+ {
+ iNativeHandle = INVALID_NATIVE_HANDLE;
+ }
+
+ /**
+ * Sets a native handle.
+ */
+ void setHandle(int aNativeHandle)
+ {
+ iNativeHandle = aNativeHandle;
+ }
+
+ /**
+ * Unregister an object
+ * @param aHandle Object's native handle
+ */
+ void unregister(Integer aHandle)
+ {
+ iManager.unregister(aHandle);
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /**
+ * Checks that the handle is valid.
+ * @param a native handle
+ * @return true if handle is valid.
+ */
+ static boolean checkHandle(int aHandle)
+ {
+ return (aHandle > INVALID_NATIVE_HANDLE ? true : false);
+ }
+
+ /**
+ * Checks for basic native error codes that maps to
+ * standard Java exceptions and throws the exception if the error
+ * code matches. Otherwise throws basic Error class.
+ * @param aErrorCode Error code
+ * @return Value passed in is returned if not an error
+ * @throws Error if error
+ */
+ static int checkNativeError(int aErrorCode)
+ {
+ return NativeError.check(aErrorCode);
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GRunnableQt.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+/**
+ * Class that wraps runnable in order to catch and forward
+ * exceptions that occured when executing in UI thread.
+ * This class is used only for running native methods in UI thread.
+ */
+abstract class M2GRunnableQt implements Runnable
+{
+ private Throwable e = null;
+
+ /**
+ * From Runnable interface
+ */
+ public void run()
+ {
+ try
+ {
+ doRun();
+ }
+ catch (Throwable t)
+ {
+ e = t;
+ }
+ }
+
+ /**
+ * Checks for possible exceptions and errors and throws them forward.
+ * Only unchecked exceptions and errors are thrown as only checked
+ * exception that m3gcore may throw comes from loader which is not
+ * executed in UI thread
+ *
+ * @throws RuntimeException
+ * @throws Error
+ */
+ public void checkAndThrow()
+ {
+ if (e == null)
+ {
+ return;
+ }
+ if (e instanceof RuntimeException)
+ {
+ throw(RuntimeException)e;
+ }
+ else if (e instanceof Error)
+ {
+ throw(Error)e;
+ }
+ }
+
+ /**
+ * Method to be implemented for the UI thead execution
+ */
+ abstract void doRun();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGAnimationElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * This interface represents an Animation element,
+ * which contains methods to control the timing of
+ * animations.
+ */
+public class M2GSVGAnimationElement
+ extends M2GSVGElement
+ implements SVGAnimationElement
+{
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aElemnetHandle -
+ * @param aDocument -
+ */
+ public M2GSVGAnimationElement(int aElementHandle, M2GDocument aDocument)
+ {
+ super(aElementHandle, aDocument);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt()
+ */
+ public void beginElementAt(float offset)
+ {
+ _beginElementAt(
+ getNativeSVGProxyHandle(),
+ getDocument().getHandle(), getHandle(), offset,
+ getDocument().getRootElement().getCurrentTime() );
+ }
+
+ /**
+ * Same as the beginElementAt with offset 0.0f
+ * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt()
+ */
+ public void beginElement()
+ {
+ beginElementAt(0.0f);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGAnimationElement#endElementAt()
+ */
+ public void endElementAt(float offset)
+ {
+ short endAttribute = _getEnumTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(), M2GSVGConstants.AT_END );
+ // NOTE Native SVG engine checks that element is active so
+ // java side doesn't have to do that
+ if (endAttribute == M2GSVGConstants.ANIM_INDEFINITE)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "endElementAt() - Cannot stop this animation, indefinite attribute");
+ }
+ else
+ {
+ _endElementAt(
+ getNativeSVGProxyHandle(),
+ getDocument().getHandle(), getHandle(),
+ (offset + getDocument().getRootElement().getCurrentTime()) );
+ }
+ }
+
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private native void _beginElementAt(
+ int aSvgProxyHandle, int aDocumentHandle,
+ int aElementHandle, float aOffset, float aCurrentTime);
+
+ private native void _endElementAt(
+ int aSvgProxyHandle, int aDocumentHandle,
+ int aElementHandle, float aOffset);
+
+ private native boolean _isActive(
+ int aSvgProxyHandle, int aElementHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGAnimator.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,765 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import javax.microedition.m2g.*;
+import java.util.*;
+import javax.microedition.lcdui.*;
+import javax.microedition.lcdui.game.GameCanvas;
+import java.lang.ref.WeakReference;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.utils.Logger;
+
+
+public class M2GSVGAnimator extends SVGAnimator
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ private static final String ANIMATOR_CANVAS_BASE_CLASS =
+ "javax.microedition.lcdui.Canvas";
+ // Exception text
+ /* Optimization: static finals changed to local variables
+ private static final String COMPONENT_BASE_CLASS_NOT_SUPPORTED_ESTR =
+ "The requested componentBaseClass is not supported by the implementation.";
+ private static final String ILLEGAL_TIME_INCREMENT_ESTR =
+ "The timeIncrement is less than or equal to zero.";
+ private static final String ANIMATOR_PLAY_ESTR =
+ "The animator is not currently in the stopped or paused state.";
+ private static final String ANIMATOR_PAUSE_ESTR =
+ "The animator is not in the playing state.";
+ private static final String ANIMATOR_STOP_ESTR =
+ "The animator is not in the playing or paused state.";
+ private static final String INVALID_RUNNABLE_ESTR =
+ "The runnable is null.";
+ private static final String ANIMATOR_IS_STOPPED_ESTR =
+ "The animator is in the stopped state.";
+ private static final String RUNNABLE_IS_NULL_ESTR =
+ "The runnable is null.";
+ private static final String ANIMATOR_INVOKE_ESTR =
+ "The animator is in the stopped state.";
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GSVGCanvas iSVGCanvas = null;
+ private Finalizer mFinalizer;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aImage
+ */
+ protected M2GSVGAnimator(SVGImage aImage)
+ {
+ System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).");
+ iSVGCanvas = new M2GSVGCanvas(false, aImage);
+ mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).mFinalizer creation doFinalize" );
+ doFinalize();
+ }
+ };
+ System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).mFinalizer M2GDestroyer creation " );
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTargetComponent()
+ */
+ public Object getTargetComponent()
+ {
+ return iSVGCanvas;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
+ */
+ public float getTimeIncrement()
+ {
+ return iSVGCanvas.getTimeIncrement();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#invokeAndWait()
+ */
+ public void invokeAndWait(java.lang.Runnable runnable)
+ {
+ if (runnable == null)
+ {
+ throw new NullPointerException(
+ /*SF*/"The runnable is null."/*SF*/);
+ }
+ if (iSVGCanvas.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is in the stopped state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeAndWait()");
+ runnable.run();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#invokeLater()
+ */
+ public void invokeLater(java.lang.Runnable runnable)
+ {
+ if (runnable == null)
+ {
+ throw new NullPointerException(
+ /*SF*/"The runnable is null."/*SF*/);
+ }
+ if (iSVGCanvas.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is in the stopped state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeLater()");
+ Thread thread = new Thread(runnable);
+ thread.start();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#pause()
+ */
+ public void pause()
+ {
+ if (!iSVGCanvas.isPlaying())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not in the playing or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
+ iSVGCanvas.pause();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#play()
+ */
+ public void play()
+ {
+ System.out.println("P-Do In M2GSVGAnimator Play " );
+ if (iSVGCanvas.isPlaying())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not currently in the stopped or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
+ System.out.println("P-Do In M2GSVGAnimator canvas sPlay " );
+ iSVGCanvas.play();
+ }
+
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ System.out.println("P-Do Finalize called");
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ /**
+ * Finalize
+ */
+ synchronized void registeredFinalize()
+ {
+ iSVGCanvas.cancel();
+ iSVGCanvas = null;
+ }
+
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
+ */
+ public void setSVGEventListener(SVGEventListener svgEventListener)
+ {
+ iSVGCanvas.setEventListener(svgEventListener);
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
+ */
+ public void setTimeIncrement(float timeIncrement)
+ {
+ System.out.println("P-Do In M2GSVGAnimator TimeIncrement.." );
+ if (timeIncrement <= 0)
+ {
+ throw new IllegalArgumentException(
+ /*SF*/"The time increment is less than or equal to zero."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - "
+ + timeIncrement);
+ iSVGCanvas.setTimeIncrement(timeIncrement);
+ System.out.println("P-Do In M2GSVGAnimator Canvas Time Increment.." );
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#stop()
+ */
+ public void stop()
+ {
+ System.out.println("P-Do In M2GSVGAnimator Stoop " );
+ if (iSVGCanvas.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not in the playing or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
+
+ iSVGCanvas.stop();
+ System.out.println("P-Do In M2GSVGAnimator Canvas Stop" );
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /**
+ * Builds animator
+ * @param svgImage -
+ * @return SVGAnimator
+ * @see javax.microedition.m2g.SVGAnimator#createAnimator()
+ */
+ public static SVGAnimator buildAnimator(SVGImage svgImage)
+ {
+ System.out.println("P-Do SVGAnimator buildAnimator.");
+ if (svgImage == null)
+ {
+ System.out.println("P-Do SVGAnimator buildAnimator.NullPointerException.");
+ throw new NullPointerException();
+ }
+ System.out.println("P-Do SVGAnimator buildAnimator.retunrning handle");
+ return new M2GSVGAnimator(svgImage);
+ }
+
+ /**
+ * Builds animator
+ * @param svgImage -
+ * @param componentBaseClass -
+ * @return SVGAnimator
+ * @see javax.microedition.m2g.SVGAnimator#createAnimator()
+ */
+ public static SVGAnimator buildAnimator(
+ SVGImage svgImage, String componentBaseClass)
+ {
+ if (svgImage == null)
+ {
+ throw new NullPointerException();
+ }
+ if ((componentBaseClass != null) &&
+ (!componentBaseClass.equals(ANIMATOR_CANVAS_BASE_CLASS)))
+ {
+ throw new IllegalArgumentException(
+ /*SF*/"The requested componentBaseClass is not supported by the implementation."/*SF*/);
+ }
+ return buildAnimator(svgImage);
+ }
+}
+
+//--------------------------------------------------
+// OTHER CLASSES
+//--------------------------------------------------
+
+/**
+ * Canvas
+ */
+class M2GSVGCanvas extends GameCanvas implements M2GDOMChangeObserver
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final int STATE_STOPPED = 1;
+ public static final int STATE_PLAYING = 2;
+ public static final int STATE_PAUSED = 3;
+ public static final float DEFAULT_DELTA_TIME = 0.1f; // (10fps) - defined by specs
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private int iState;
+ private SVGImage iSVGImage;
+ private ScalableGraphics iSg;
+ private Graphics iOffscreen = null;
+ private M2GSVGSVGElement iRootElement = null;
+
+ private float iDeltaTime;
+ private Timer iTimer = null;
+ private SVGCanvasTask iTask = null;
+
+ private SVGEventListener iEventListener = null;
+
+ /**
+ * True if the GameCanvas is in background or false otherwise
+ */
+ private boolean iWasPlaying = false;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * @see javax.microedition.lcdui.game.GameCanvas#GameCanvas()
+ */
+ public M2GSVGCanvas(boolean aSuppressKeyEvents, SVGImage aSVGImage)
+ {
+
+ super(aSuppressKeyEvents);
+ System.out.println("P-Do M2GSVGCanvas Canvas called");
+ // get the instance to the Graphics of the offscreen buffer
+ iOffscreen = getGraphics();
+
+ iSVGImage = aSVGImage;
+
+ // down-casting to M2GDocument/M2GSVGSVGElement to have access to internal methods
+ M2GDocument doc = (M2GDocument)iSVGImage.getDocument();
+ iRootElement = (M2GSVGSVGElement)iSVGImage.getDocument().getDocumentElement();
+
+ System.out.println("P-Do M2GSVGCanvas Doc and RootElement Created");
+ iState = STATE_STOPPED;
+ // Create render context
+ iSg = ScalableGraphics.createInstance();
+ iSg.setRenderingQuality(ScalableGraphics.RENDERING_QUALITY_HIGH);
+ iDeltaTime = DEFAULT_DELTA_TIME;
+
+ doc.registerDOMChangeObserver(this);
+
+ System.out.println("P-Do M2GSVGCanvas Canvas Registered Dom Observer");
+
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "Ctor - delta time:"
+ + iDeltaTime + ", state:" + iState);
+ }
+
+ /**
+ * Handles any change in DOM.
+ * <br>
+ * While in PAUSE state, SVGAnimator must repaint any changes in SVGImage
+ * done via the API (e.g. setTrait(), insertBefore())
+ * <br>
+ * @see M2GDOMChangeObserver.notifyDOMChange()
+ * @since S60 3.2
+ */
+ public void notifyDOMChange()
+ {
+ if (isPaused())
+ {
+ repaint();
+ }
+ }
+
+ /**
+ * Cancel a timed task
+ */
+ public void cancel()
+ {
+ if (iTimer != null)
+ {
+ iTimer.cancel();
+ }
+ if (iTask != null)
+ {
+ iTask.cancel();
+ }
+ iTask = null;
+ iTimer = null;
+ }
+
+ /**
+ * Returns event listener
+ * @return event listener
+ */
+ public synchronized SVGEventListener getEventListener()
+ {
+ return iEventListener;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
+ */
+ public synchronized float getTimeIncrement()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "getTimeIncrement() - "
+ + iDeltaTime);
+ return iDeltaTime;
+ }
+
+ /**
+ * Increases the increment time of the SVGImage.
+ * Increment is done only if the playing state is active.
+ * @see javax.microedition.m2g.SVGImage#incrementTime()
+ */
+ public synchronized void increaseCurrentTime(float time)
+ {
+ if (iState == STATE_PLAYING)
+ {
+ // update the time only in java side
+ // the time in engine side is updated during rendering
+ iRootElement.incrementTimeNoUpdate(time);
+ }
+ }
+
+ /**
+ * Checks if playing
+ * @return true if playing
+ */
+ public synchronized boolean isPlaying()
+ {
+ return iState == STATE_PLAYING;
+ }
+
+ /**
+ * Checks if paused
+ * @return true if paused
+ */
+ public synchronized boolean isPaused()
+ {
+ return iState == STATE_PAUSED;
+ }
+
+ /**
+ * Checks if stopped
+ * @return true if stopped
+ */
+ public synchronized boolean isStopped()
+ {
+ return iState == STATE_STOPPED;
+ }
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#keyPressed()
+ */
+ protected synchronized void keyPressed(int keyCode)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "keyPressed() - " + keyCode);
+ if (iEventListener != null)
+ {
+ iEventListener.keyPressed(keyCode);
+ }
+ }
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#keyReleased()
+ */
+ protected synchronized void keyReleased(int keyCode)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "keyReleased() - " + keyCode);
+ if (iEventListener != null)
+ {
+ iEventListener.keyReleased(keyCode);
+ }
+ }
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#pointerPressed()
+ * @see javax.microedition.m2g.SVGEventListener#pointerPressed()
+ */
+ protected synchronized void pointerPressed(int x, int y)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "pointerPressed() - x:" + x + ", y:" + y);
+ if (iEventListener != null)
+ {
+ iEventListener.pointerPressed(x, y);
+ }
+ }
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#pointerReleased()
+ * @see javax.microedition.m2g.SVGEventListener#pointerReleased()
+ */
+ protected synchronized void pointerReleased(int x, int y)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "pointerReleased() - x:" + x + ", y:" + y);
+ if (iEventListener != null)
+ {
+ iEventListener.pointerReleased(x, y);
+ }
+ }
+
+ /**
+ * @see javax.microedition.lcdui.game.GameCanvas#paint()
+ */
+ public void paint(Graphics g)
+ {
+ // Clears bitmap
+ System.out.println("P-Do M2GSVGAnimator Paint");
+ g.setColor(255, 255, 255);
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ try
+ {
+ System.out.println("P-Do M2GSVGAnimatorBind Target");
+ iSg.bindTarget(g);
+
+ System.out.println("P-Do M2GSVGAnimatorBind Target");
+ // NOTE: Source is defaultly fully opaque
+ iSg.render(0, 0, iSVGImage);
+ System.out.println("P-Do M2GSVGAnimatorBind Target");
+ }
+ finally
+ {
+ System.out.println("P-Do M2GSVGAnimator Release Target");
+ iSg.releaseTarget();
+ System.out.println("P-Out M2GSVGAnimator Release Target");
+ }
+ }
+
+ /**
+ * Paints a frame to the offscreen of this GameCanvas
+ * @note GameCanvas.getGraphics() is not used since it always creates a new instance of Graphics
+ */
+ public void paintToOffscreen()
+ {
+ paint(iOffscreen);
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
+ */
+ public synchronized void setEventListener(SVGEventListener eventListener)
+ {
+ iEventListener = eventListener;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
+ */
+ public synchronized void setTimeIncrement(float aDeltaTime)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - "
+ + aDeltaTime);
+
+ iDeltaTime = aDeltaTime;
+ }
+
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#showNotify()
+ * @see javax.microedition.m2g.SVGEventListener#showNotify()
+ */
+ protected synchronized void showNotify()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "showNotify()");
+
+ if (iEventListener != null)
+ {
+ iEventListener.showNotify();
+ }
+
+ // A common use-case could be that the developer plays the animation by themselves
+ // in SVGEventListener.showNotify().
+ // Therefore we play the animation only if the developer didn't resume it already.
+ if (iWasPlaying)
+ {
+ iWasPlaying = false;
+ play();
+ }
+ }
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#hideNotify()
+ * @see javax.microedition.m2g.SVGEventListener#hideNotify()
+ */
+ protected synchronized void hideNotify()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "hideNotify()");
+
+ if (iEventListener != null)
+ {
+ iEventListener.hideNotify();
+ }
+
+ // A common use-case could be that developer pause the animation by themselves
+ // in SVGEventListener.hideNotify().
+ // Therefore we pause the animation only if the developer didn't pause it already.
+ if (isPlaying())
+ {
+ pause();
+ iWasPlaying = true;
+ }
+ }
+
+
+ /**
+ * @see javax.microedition.lcdui.Canvas#sizeChanged()
+ * @see javax.microedition.m2g.SVGEventListener#sizeChanged()
+ */
+ protected synchronized void sizeChanged(int w, int h)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "sizeChanged() - w:"
+ + w + ", h:" + h);
+
+ // get a new instance of offscreen Graphics since the Graphics object
+ // does not update its size or clipping area.
+ // If not updating this, the GameCanvas is clipped when it is switched
+ // to full-screen
+ if (iOffscreen != null)
+ {
+ // sizeChanged() is called twice when the Canvas is set as Displayable.
+ // If we try to get the Graphics object (first time), the Graphics object is not
+ // fully initialized, so GameCanvas.getGraphics() will throw a NullPointerException
+ iOffscreen = getGraphics();
+ }
+
+ if (iSVGImage != null)
+ {
+ iSVGImage.setViewportWidth(w);
+ iSVGImage.setViewportHeight(h);
+ }
+
+ if (iEventListener != null)
+ {
+ iEventListener.sizeChanged(w, h);
+ }
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#play()
+ */
+ public synchronized void play()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
+ System.out.println("P-Do M2GSVGAnimator Play )= Target");
+ if (iState == STATE_PLAYING)
+ {
+ // don't do anything if animation is already playing
+ return;
+ }
+
+ if ((iState == STATE_PAUSED)||(iState == STATE_STOPPED))
+ {
+ iTask = new SVGCanvasTask(this);
+ iTimer = new Timer();
+ }
+ iState = STATE_PLAYING;
+ if (iTimer != null && iTask != null)
+ {
+
+ iTimer.schedule(iTask,0,(long)(iDeltaTime*1000.0f));
+
+ }
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#pause()
+ */
+ public synchronized void pause()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
+
+ if (iState == STATE_PLAYING)
+ {
+ iTask.cancel();
+ iTask = null;
+ iTimer.cancel();
+ iTimer = null;
+ }
+ iState = STATE_PAUSED;
+
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#stop()
+ */
+ public synchronized void stop()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
+ if (iState == STATE_PLAYING)
+ {
+ iTask.cancel();
+ iTask = null;
+ iTimer.cancel();
+ iTimer = null;
+ }
+ iState = STATE_STOPPED;
+ }
+}
+
+/**
+ * Timer task for rendering frames
+ */
+class SVGCanvasTask extends TimerTask
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ // private WeakReference iWeakCanvas;
+
+ private M2GSVGCanvas iCanvas = null;
+ private long iPrevTime = 0;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aCanvas SVG canvas
+ */
+ public SVGCanvasTask(M2GSVGCanvas aCanvas)
+ {
+ // iWeakCanvas = new WeakReference(aCanvas);
+ // iCanvas = (M2GSVGCanvas)iWeakCanvas.get();
+
+ iCanvas = aCanvas;
+ iPrevTime = System.currentTimeMillis();
+ }
+ /**
+ * Updates the animation time and generates frames which get flushed to the screen
+ * <br>
+ * * @note The timing for the next frame is decided upon the max(iDeltaTime*1000, elapsedTime)
+ * iDeltaTime: FrameTime set by client.
+ * elapsedTime: Actual Time taken for rendering
+ the max(iDeltaTime*1000, elapsedTime) will be incremented on the SVGElement
+ * @note rendering will be done only in PLAY state.
+ * @note While in PAUSE state, SVGAnimator will repaint any changes done
+ * to SVGImage via <code>M2GDOMChangeObserver.notifyDOMChange()</code>
+ */
+ public void run()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "SVGCanvasTask: run() - begin");
+
+ if (iCanvas == null)
+ {
+ return;
+ }
+
+ try
+ {
+ synchronized (iCanvas)
+ {
+ long elapsedTime = System.currentTimeMillis()- iPrevTime;
+ if (elapsedTime > 0)
+ iCanvas.increaseCurrentTime((float)(elapsedTime/ 1000.));
+ iPrevTime = System.currentTimeMillis();
+ iCanvas.paintToOffscreen();
+ iCanvas.flushGraphics();
+ }
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "SVGCanvasTask: run() - exception: " + e.toString());
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "SVGCanvasTask: run() - end");
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGConstants.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1893 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.w3c.dom.svg.SVGPath;
+
+/*
+ * General constants
+ */
+public class M2GSVGConstants
+{
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - General exception messages
+ //--------------------------------------------------
+ public static final String ACCESS_RIGHTS_ESTR =
+ "Not necessary privilege rights to access this (SVG) content.";
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ static final String SVG_NAMESPACE_URI =
+ "http://www.w3.org/2000/svg";
+ static final String XLINK_NAMESPACE_URI =
+ "http://www.w3.org/1999/xlink";
+ static final String ROOT_SVG_ELEMENT_NAME =
+ "svg";
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Supported event types
+ //--------------------------------------------------
+ static final String EVENT_ACTIVATE = "DOMActivate";
+ static final String EVENT_CLICK = "click";
+ static final String EVENT_FOCUS_IN = "DOMFocusIn";
+ static final String EVENT_FOCUS_OUT = "DOMFocusOut";
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - SVGT element ids
+ //--------------------------------------------------
+ static final short EL_UNDEFINED = -1;
+ static final short EL_A = 0;
+ static final short EL_ANIMATE = 1;
+ static final short EL_ANIMATECOLOR = 2;
+ static final short EL_ANIMATEMOTION = 3;
+ static final short EL_ANIMATETRANSFORM = 4;
+ static final short EL_CIRCLE = 5;
+ static final short EL_DEFS = 6;
+ static final short EL_DESC = 7;
+ static final short EL_ELLIPSE = 8;
+ static final short EL_FONT = 9;
+ static final short EL_FONTFACE = 10;
+ static final short EL_FONTFACENAME = 11;
+ static final short EL_FONTFACESRC = 12;
+ static final short EL_FOREIGNOBJECT = 13;
+ static final short EL_G = 14;
+ static final short EL_GLYPH = 15;
+ static final short EL_HKERN = 16;
+ static final short EL_IMAGE = 17;
+ static final short EL_LINE = 18;
+ static final short EL_METADATA = 19;
+ static final short EL_MISSINGGLYPH = 20;
+ static final short EL_MPATH = 21;
+ static final short EL_PATH = 22;
+ static final short EL_POLYGON = 23;
+ static final short EL_POLYLINE = 24;
+ static final short EL_RECT = 25;
+ static final short EL_SET = 26;
+ static final short EL_SVG = 27;
+ static final short EL_SWITCH = 28;
+ static final short EL_TEXT = 29;
+ static final short EL_TITLE = 30;
+ static final short EL_USE = 31;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - SVGT Attribute ids
+ //--------------------------------------------------
+ static final short AT_UNDEFINED = -1;
+ static final short AT_ACCENTHEIGHT = 50;
+ static final short AT_ACCUMULATE = 51;
+ static final short AT_ADDITIVE = 52;
+ static final short AT_ALPHABETIC = 53;
+ static final short AT_ARABICFORM = 54;
+ static final short AT_ASCENT = 55;
+ static final short AT_ATTRIBUTENAME = 56;
+ static final short AT_ATTRIBUTETYPE = 57;
+ static final short AT_BASEPROFILE = 58;
+ static final short AT_BBOX = 59;
+ static final short AT_BEGIN = 60;
+ static final short AT_BY = 61;
+ static final short AT_CALCMODE = 62;
+ static final short AT_CAPHEIGHT = 63;
+ static final short AT_COLOR = 64;
+ static final short AT_COLORRENDERING = 65;
+ // static final short AT_CONTENT = 66;
+ static final short AT_CX = 67;
+ static final short AT_CY = 68;
+ static final short AT_D = 69;
+ static final short AT_DESCENT = 70;
+ static final short AT_DISPLAY = 71;
+ static final short AT_DUR = 72;
+ static final short AT_END = 73;
+ static final short AT_FILL = 74;
+ static final short AT_FILLRULE = 75;
+ static final short AT_FONTFAMILY = 76;
+ static final short AT_FONTSIZE = 77;
+ static final short AT_FONTSTRETCH = 78;
+ static final short AT_FONTSTYLE = 79;
+ static final short AT_FONTVARIANT = 80;
+ static final short AT_FONTWEIGHT = 81;
+ static final short AT_FROM = 82;
+ static final short AT_G1 = 83;
+ static final short AT_G2 = 84;
+ static final short AT_GLYPHNAME = 85;
+ static final short AT_HANGING = 86;
+ static final short AT_HEIGHT = 87;
+ static final short AT_HORIZADVX = 88;
+ static final short AT_HORIZORIGINX = 89;
+ static final short AT_ID = 90;
+ static final short AT_IDEOGRAPHIC = 91;
+ static final short AT_K = 92;
+ static final short AT_KEYPOINTS = 93;
+ static final short AT_KEYSPLINES = 94;
+ static final short AT_KEYTIMES = 95;
+ static final short AT_LANG = 96;
+ static final short AT_MATHEMATICAL = 97;
+ static final short AT_MAX = 98;
+ static final short AT_MIN = 99;
+ static final short AT_NAME = 100;
+ static final short AT_ORIGIN = 101;
+ static final short AT_OVERLINEPOSITION = 102;
+ static final short AT_OVERLINETHICKNESS = 103;
+ static final short AT_PANOSE1 = 104;
+ static final short AT_PATH = 105;
+ static final short AT_PATHLENGTH = 106;
+ static final short AT_POINTS = 107;
+ static final short AT_PRESERVEASPECTRATIO = 108;
+ static final short AT_R = 109;
+ static final short AT_REPEATCOUNT = 110;
+ static final short AT_REPEATDUR = 111;
+ static final short AT_REQUIREDEXTENSIONS = 112;
+ static final short AT_REQUIREDFEATURES = 113;
+ static final short AT_RESTART = 114;
+ static final short AT_ROTATE = 115;
+ static final short AT_RX = 116;
+ static final short AT_RY = 117;
+ static final short AT_SLOPE = 118;
+ static final short AT_STEMH = 119;
+ static final short AT_STEMV = 120;
+ static final short AT_STRIKETHROUGHPOSITION = 121;
+ static final short AT_STRIKETHROUGHTHICKNESS = 122;
+ static final short AT_STROKE = 123;
+ static final short AT_STROKEDASHARRAY = 124;
+ static final short AT_STROKEDASHOFFSET = 125;
+ static final short AT_STROKELINECAP = 126;
+ static final short AT_STROKELINEJOIN = 127;
+ static final short AT_STROKEMITERLIMIT = 128;
+ static final short AT_STROKEWIDTH = 129;
+ static final short AT_STYLE = 130;
+ static final short AT_SYSTEMLANGUAGE = 131;
+ static final short AT_TARGET = 132;
+ static final short AT_TEXTANCHOR = 133;
+ static final short AT_TO = 134;
+ static final short AT_TRANSFORM = 135;
+ static final short AT_TYPE = 136;
+ static final short AT_U1 = 137;
+ static final short AT_U2 = 138;
+ static final short AT_UNDERLINEPOSITION = 139;
+ static final short AT_UNDERLINETHICKNESS = 140;
+ static final short AT_UNICODE = 141;
+ static final short AT_UNICODERANGE = 142;
+ static final short AT_UNITSPEREM = 143;
+ static final short AT_VALUES = 144;
+ static final short AT_VERSION = 145;
+ static final short AT_VIEWBOX = 146;
+ static final short AT_VISIBILITY = 147;
+ static final short AT_WIDTH = 148;
+ static final short AT_WIDTHS = 149;
+ static final short AT_X = 150;
+ static final short AT_XHEIGHT = 151;
+ static final short AT_X1 = 152;
+ static final short AT_X2 = 153;
+ static final short AT_XLINKACTUATE = 154;
+ static final short AT_XLINKARCROLE = 155;
+ static final short AT_XLINKHREF = 156;
+ static final short AT_XLINKROLE = 157;
+ static final short AT_XLINKSHOW = 158;
+ static final short AT_XLINKTITLE = 159;
+ static final short AT_XLINKTYPE = 160;
+ static final short AT_XMLBASE = 161;
+ static final short AT_XMLLANG = 162;
+ static final short AT_XMLSPACE = 163;
+ static final short AT_Y = 164;
+ static final short AT_Y1 = 165;
+ static final short AT_Y2 = 166;
+ static final short AT_ZOOMANDPAN = 167;
+ // not in the spec but used to correctly implement animateMotion
+ static final short AT_MOTIONTRANSFORM = 168;
+ // not actually an attribute, but needed for desc, title, and text
+ static final short AT_STRING = 169;
+ static final short AT_TEXTDECORATION = 170;
+ static final short AT_HORIZORIGINY = 171;
+ static final short AT_MOUSEEVENT = 172;
+ static final short AT_USERBBOX = 173;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Error flags
+ //--------------------------------------------------
+ static final short DEFAULT_INHERIT = -2; // = null on native engine;
+ static final short SVG_ERROR = -1;
+ static final short TEXT_NOT_SHORT = -3;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - A constant for each type of value
+ //--------------------------------------------------
+ static final short VAL_EVENT = 200;
+ static final short VAL_INTEGER = 201;
+ static final short VAL_PAINT = 202;
+ static final short VAL_POINT = 203;
+ static final short VAL_REAL = 204;
+ static final short VAL_STRING = 205;
+ static final short VAL_TIME = 206;
+ static final short VAL_TRANSFORM = 207;
+ static final short VAL_VECTOR = 208;
+ // These are used for animation purposes
+ static final short VAL_VECTOR_POINT = 215;
+ static final short VAL_VECTOR_REAL = 216;
+ static final short VAL_VECTOR_STRING = 217;
+ static final short VAL_VECTOR_PATH = 218;
+ // VAL_VECTOR_X + VECTOR_TO_VAL = VAL_X
+ static final short VECTOR_TO_VAL = -12;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Constants for "choices"
+ //--------------------------------------------------
+ // Preserve aspect ratio constants
+ static final short PAR_NONE = 310;
+ static final short PAR_XMIDYMID = 311;
+ // Zoom and pan constants
+ static final short ZPN_MAGNIFY = 320;
+ static final short ZPN_DISABLE = 321;
+ // Paint
+ static final short PAINT_NONE = 325;
+ static final short PAINT_CURRENT = 326;
+ static final short PAINT_COLOR = 327;
+ static final short PAINT_INHERIT = 328;
+ // Fonts
+ static final short FONT_ALL = 330;
+ static final short FONT_NORMAL = 331;
+ static final short FONT_STYLE_ITALIC = 332;
+ static final short FONT_STYLE_OBLIQUE = 333;
+ static final short FONT_VARIANT_SMALLCAPS = 334;
+ static final short FONT_WEIGHT_BOLD = 335;
+ static final short FONT_WEIGHT_BOLDER = 336;
+ static final short FONT_WEIGHT_LIGHTER = 337;
+ static final short FONT_WEIGHT_100 = 338;
+ static final short FONT_WEIGHT_200 = 339;
+ static final short FONT_WEIGHT_300 = 340;
+ static final short FONT_WEIGHT_400 = 341;
+ static final short FONT_WEIGHT_500 = 342;
+ static final short FONT_WEIGHT_600 = 343;
+ static final short FONT_WEIGHT_700 = 344;
+ static final short FONT_WEIGHT_800 = 345;
+ static final short FONT_WEIGHT_900 = 346;
+ static final short FONT_STRETCH_WIDER = 347;
+ static final short FONT_STRETCH_NARROWER = 348;
+ static final short FONT_STRETCH_ULTRA_COND = 349;
+ static final short FONT_STRETCH_EXTRA_COND = 350;
+ static final short FONT_STRETCH_COND = 351;
+ static final short FONT_STRETCH_SEMI_COND = 352;
+ static final short FONT_STRETCH_SEMI_EXPD = 353;
+ static final short FONT_STRETCH_EXPD = 354;
+ static final short FONT_STRETCH_EXTRA_EXPD = 355;
+ static final short FONT_STRETCH_ULTRA_EXPD = 356;
+ // Text
+ static final short TEXT_ANCHOR_START = 360;
+ static final short TEXT_ANCHOR_MIDDLE = 361;
+ static final short TEXT_ANCHOR_END = 362;
+ static final short TEXT_UNDER_LINE = 363;
+ static final short TEXT_OVER_LINE = 364;
+ static final short TEXT_LINE_THROUGH = 365;
+ // These are actual sizes in 8:8 fixed point, not "choices"
+ static final int FONT_SIZE_XXSMALL = 0x20000;
+ static final int FONT_SIZE_XSMALL = 0x40000;
+ static final int FONT_SIZE_SMALL = 0x60000;
+ static final int FONT_SIZE_MEDIUM = 0xa0000;
+ static final int FONT_SIZE_LARGE = 0x100000;
+ static final int FONT_SIZE_XLARGE = 0x140000;
+ static final int FONT_SIZE_XXLARGE = 0x180000;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Styles
+ //--------------------------------------------------
+ // Fill
+ static final short FILL_RULE_EVENODD = 375;
+ static final short FILL_RULE_NONZERO = 376;
+ // Display
+ static final short DISPLAY_NONE = 380;
+ static final short DISPLAY_OTHER = 381;
+ // Visibility
+ static final short VISIBILITY_VISIBLE = 385;
+ static final short VISIBILITY_OTHER = 386;
+ // Color-rendering
+ static final short COLOR_RENDERING_AUTO = 390;
+ static final short COLOR_RENDERING_SPEED = 391;
+ static final short COLOR_RENDERING_QUALITY = 392;
+ // Strokes
+ // MUST PRESERVE ORDER!!
+ static final short STROKE_LINECAP_BUTT = 395;
+ static final short STROKE_LINECAP_ROUND = 396;
+ static final short STROKE_LINECAP_SQUARE = 397;
+ static final short STROKE_LINEJOIN_MITER = 400;
+ static final short STROKE_LINEJOIN_ROUND = 401;
+ static final short STROKE_LINEJOIN_BEVEL = 402;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Animation
+ //--------------------------------------------------
+ static final short ANIM_INDEFINITE = 445;
+ static final short ACCUMULATE_NONE = 450;
+ static final short ACCUMULATE_SUM = 451;
+ static final short ADDITIVE_REPLACE = 455;
+ static final short ADDITIVE_SUM = 456;
+ static final short CALC_MODE_DISCRETE = 460;
+ static final short CALC_MODE_LINEAR = 461;
+ static final short CALC_MODE_PACED = 462;
+ static final short CALC_MODE_SPLINE = 463;
+ static final short FILL_REMOVE = 465;
+ static final short FILL_FREEZE = 466;
+ static final short RESTART_ALWAYS = 470;
+ static final short RESTART_NEVER = 471;
+ static final short RESTART_WHENNOTACTIVE = 472;
+ static final short TYPE_TRANSLATE = 475;
+ static final short TYPE_SCALE = 476;
+ static final short TYPE_ROTATE = 477;
+ static final short TYPE_SKEWX = 478;
+ static final short TYPE_SKEWY = 479;
+ static final short ATTR_TYPE_CSS = 485;
+ static final short ATTR_TYPE_XML = 486;
+ static final short ATTR_TYPE_AUTO = 487;
+ static final short ROTATE_AUTO = 490;
+ static final short ROTATE_AUTOREVERSE = 491;
+ static final short ANIM_FROM_TO = 500;
+ static final short ANIM_FROM_BY = 501;
+ static final short ANIM_BY = 502;
+ static final short ANIM_TO = 503;
+ static final short ANIM_VALUES = 504;
+ static final short ANIM_PATH = 505;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Path Commands
+ //--------------------------------------------------
+ static final short PATH_COMMAND_M = 600;
+ static final short PATH_COMMAND_m = 601;
+ static final short PATH_COMMAND_Z = 602;
+ static final short PATH_COMMAND_L = 603;
+ static final short PATH_COMMAND_l = 604;
+ static final short PATH_COMMAND_H = 605;
+ static final short PATH_COMMAND_h = 606;
+ static final short PATH_COMMAND_V = 607;
+ static final short PATH_COMMAND_v = 608;
+ static final short PATH_COMMAND_C = 609;
+ static final short PATH_COMMAND_c = 610;
+ static final short PATH_COMMAND_S = 611;
+ static final short PATH_COMMAND_s = 612;
+ static final short PATH_COMMAND_Q = 613;
+ static final short PATH_COMMAND_q = 614;
+ static final short PATH_COMMAND_T = 615;
+ static final short PATH_COMMAND_t = 616;
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS - Events
+ //--------------------------------------------------
+ // Indicates that the animation has started
+ static final short EVENT_BEGIN = 650;
+ // Indicates that the animation has finished
+ static final short EVENT_END = 651;
+ // Indicates that the animation has repeated
+ static final short EVENT_REPEAT = 652;
+ static final short EVENT_BEGIN_EL = 653;
+ static final short EVENT_END_EL = 654;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private static M2GSVGConstants sInstance = null;
+
+ String iEmptySvgDocument = null;
+ String iSvgBaseProfileName = null;
+ String iSvgBaseProfileVersion = null;
+ Hashtable iAllElements = null;
+ Hashtable iAllAttributes = null;
+ Vector iQualifiedElements = null;
+ Vector iAnimatableElements = null;
+ Vector iReadOnlyElements = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ */
+ private M2GSVGConstants()
+ {
+ // Profile name
+ iSvgBaseProfileName = System.getProperty("microedition.m2g.svg.baseProfile");
+ // Profile version
+ iSvgBaseProfileVersion = System.getProperty("microedition.m2g.svg.version");
+
+ // Empty svg document
+ // "<svg version=\"1.1\" baseProfile=\"tiny\" width=\"100\" height=\"100\"></svg>";
+ StringBuffer buf = new StringBuffer();
+ buf.append("<svg version=\"").append(iSvgBaseProfileVersion);
+ buf.append("\" baseProfile=\"").append(iSvgBaseProfileName);
+ buf.append("\" width=\"100\" height=\"100\"></svg>");
+ iEmptySvgDocument = buf.toString();
+
+ // Elements
+ iAllElements = new Hashtable(32);
+ iAllElements.put(new Short(EL_A), "a"); // 1
+ iAllElements.put(new Short(EL_ANIMATE), "animate"); // 2
+ iAllElements.put(new Short(EL_ANIMATECOLOR), "animateColor"); // 3
+ iAllElements.put(new Short(EL_ANIMATEMOTION), "animateMotion"); // 4
+ iAllElements.put(new Short(EL_ANIMATETRANSFORM), "animateTransform"); // 5
+ iAllElements.put(new Short(EL_CIRCLE), "circle"); // 6
+ iAllElements.put(new Short(EL_DEFS), "defs"); // 7
+ iAllElements.put(new Short(EL_DESC), "desc"); // 8
+ iAllElements.put(new Short(EL_ELLIPSE), "ellipse"); // 9
+ iAllElements.put(new Short(EL_FONT), "font"); // 10
+ iAllElements.put(new Short(EL_FONTFACE), "font-face"); // 11
+ iAllElements.put(new Short(EL_FONTFACENAME), "font-face-name"); // 12
+ iAllElements.put(new Short(EL_FONTFACESRC), "font-face-src"); // 13
+ iAllElements.put(new Short(EL_FOREIGNOBJECT), "foreignObject"); // 14
+ iAllElements.put(new Short(EL_G), "g"); // 15
+ iAllElements.put(new Short(EL_GLYPH), "glyph"); // 16
+ iAllElements.put(new Short(EL_HKERN), "hkern"); // 17
+ iAllElements.put(new Short(EL_IMAGE), "image"); // 18
+ iAllElements.put(new Short(EL_LINE), "line"); // 19
+ iAllElements.put(new Short(EL_METADATA), "metadata"); // 20
+ iAllElements.put(new Short(EL_MISSINGGLYPH), "missing-glyph"); // 21
+ iAllElements.put(new Short(EL_MPATH), "mpath"); // 22
+ iAllElements.put(new Short(EL_PATH), "path"); // 23
+ iAllElements.put(new Short(EL_POLYGON), "polygon"); // 24
+ iAllElements.put(new Short(EL_POLYLINE), "polyline"); // 25
+ iAllElements.put(new Short(EL_RECT), "rect"); // 26
+ iAllElements.put(new Short(EL_SET), "set"); // 27
+ iAllElements.put(new Short(EL_SVG), "svg"); // 28
+ iAllElements.put(new Short(EL_SWITCH), "switch"); // 29
+ iAllElements.put(new Short(EL_TEXT), "text"); // 30
+ iAllElements.put(new Short(EL_TITLE), "title"); // 31
+ iAllElements.put(new Short(EL_USE), "use"); // 32
+
+ // Attributes
+ iAllAttributes = new Hashtable(118);
+ iAllAttributes.put(new Short(AT_STRING), "#text"); // 1
+ iAllAttributes.put(new Short(AT_ACCENTHEIGHT), "accent-heigh"); // 2
+ iAllAttributes.put(new Short(AT_ACCUMULATE), "accumulate"); // 3
+ iAllAttributes.put(new Short(AT_ADDITIVE), "additive"); // 4
+ iAllAttributes.put(new Short(AT_ALPHABETIC), "alphabetic"); // 5
+ iAllAttributes.put(new Short(AT_ARABICFORM), "arabic-form"); // 6
+ iAllAttributes.put(new Short(AT_ASCENT), "ascent"); // 7
+ iAllAttributes.put(new Short(AT_ATTRIBUTENAME), "attributeName"); // 8
+ iAllAttributes.put(new Short(AT_ATTRIBUTETYPE), "attributeType"); // 9
+ iAllAttributes.put(new Short(AT_BASEPROFILE), "baseProfile"); // 10
+ iAllAttributes.put(new Short(AT_BBOX), "bbox"); // 11
+ iAllAttributes.put(new Short(AT_BEGIN), "begin"); // 12
+ iAllAttributes.put(new Short(AT_BY), "by"); // 13
+ iAllAttributes.put(new Short(AT_CALCMODE), "calcMode"); // 14
+ iAllAttributes.put(new Short(AT_CAPHEIGHT), "cap-height"); // 15
+ iAllAttributes.put(new Short(AT_COLOR), "color"); // 16
+ iAllAttributes.put(new Short(AT_COLORRENDERING), "color-rendering"); // 17
+ iAllAttributes.put(new Short(AT_CX), "cx"); // 18
+ iAllAttributes.put(new Short(AT_CY), "cy"); // 19
+ iAllAttributes.put(new Short(AT_D), "d"); // 20
+ iAllAttributes.put(new Short(AT_DESCENT), "descent"); // 21
+ iAllAttributes.put(new Short(AT_DISPLAY), "display"); // 22
+ iAllAttributes.put(new Short(AT_DUR), "dur"); // 23
+ iAllAttributes.put(new Short(AT_END), "end"); // 24
+ iAllAttributes.put(new Short(AT_FILL), "fill"); // 25
+ iAllAttributes.put(new Short(AT_FILLRULE), "fill-rule"); // 26
+ iAllAttributes.put(new Short(AT_FONTFAMILY), "font-family"); // 27
+ iAllAttributes.put(new Short(AT_FONTSIZE), "font-size"); // 28
+ iAllAttributes.put(new Short(AT_FONTSTRETCH), "font-stretch"); // 29
+ iAllAttributes.put(new Short(AT_FONTSTYLE), "font-style"); // 30
+ iAllAttributes.put(new Short(AT_FONTVARIANT), "font-variant"); // 31
+ iAllAttributes.put(new Short(AT_FONTWEIGHT), "font-weight"); // 32
+ iAllAttributes.put(new Short(AT_FROM), "from"); // 33
+ iAllAttributes.put(new Short(AT_G1), "g1"); // 34
+ iAllAttributes.put(new Short(AT_G2), "g2"); // 35
+ iAllAttributes.put(new Short(AT_GLYPHNAME), "glyph-name"); // 36
+ iAllAttributes.put(new Short(AT_HANGING), "hanging"); // 37
+ iAllAttributes.put(new Short(AT_HEIGHT), "height"); // 38
+ iAllAttributes.put(new Short(AT_HORIZADVX), "horiz-adv-x"); // 39
+ iAllAttributes.put(new Short(AT_HORIZORIGINX), "horiz-origin-x"); // 40
+ iAllAttributes.put(new Short(AT_ID), "id"); // 41
+ iAllAttributes.put(new Short(AT_IDEOGRAPHIC), "ideographic"); // 42
+ iAllAttributes.put(new Short(AT_K), "k"); // 43
+ iAllAttributes.put(new Short(AT_KEYPOINTS), "keyPoints"); // 44
+ iAllAttributes.put(new Short(AT_KEYSPLINES), "keySplines"); // 45
+ iAllAttributes.put(new Short(AT_KEYTIMES), "keyTimes"); // 46
+ iAllAttributes.put(new Short(AT_LANG), "lang"); // 47
+ iAllAttributes.put(new Short(AT_MATHEMATICAL), "mathematical"); // 48
+ iAllAttributes.put(new Short(AT_MAX), "max"); // 49
+ iAllAttributes.put(new Short(AT_MIN), "min"); // 50
+ iAllAttributes.put(new Short(AT_NAME), "name"); // 51
+ iAllAttributes.put(new Short(AT_ORIGIN), "origin"); // 52
+ iAllAttributes.put(new Short(AT_OVERLINEPOSITION), "overline-position"); // 53
+ iAllAttributes.put(new Short(AT_OVERLINETHICKNESS), "overline-thickness"); // 54
+ iAllAttributes.put(new Short(AT_PANOSE1), "panose-1"); // 55
+ iAllAttributes.put(new Short(AT_PATH), "path"); // 56
+ iAllAttributes.put(new Short(AT_PATHLENGTH), "pathLength"); // 57
+ iAllAttributes.put(new Short(AT_POINTS), "points"); // 58
+ iAllAttributes.put(new Short(AT_PRESERVEASPECTRATIO), "preserveAspectRatio"); // 59
+ iAllAttributes.put(new Short(AT_R), "r"); // 60
+ iAllAttributes.put(new Short(AT_REPEATCOUNT), "repeatCount"); // 61
+ iAllAttributes.put(new Short(AT_REPEATDUR), "repeatDur"); // 62
+ iAllAttributes.put(new Short(AT_REQUIREDEXTENSIONS), "requiredExtensions"); // 63
+ iAllAttributes.put(new Short(AT_REQUIREDFEATURES), "requiredFeatures"); // 64
+ iAllAttributes.put(new Short(AT_RESTART), "restart"); // 65
+ iAllAttributes.put(new Short(AT_ROTATE), "rotate"); // 66
+ iAllAttributes.put(new Short(AT_RX), "rx"); // 67
+ iAllAttributes.put(new Short(AT_RY), "ry"); // 68
+ iAllAttributes.put(new Short(AT_SLOPE), "slope"); // 69
+ iAllAttributes.put(new Short(AT_STEMH), "stemh"); // 70
+ iAllAttributes.put(new Short(AT_STEMV), "stemv"); // 71
+ iAllAttributes.put(new Short(AT_STRIKETHROUGHPOSITION), "strikethrough-position"); // 72
+ iAllAttributes.put(new Short(AT_STRIKETHROUGHTHICKNESS), "strikethrough-thickness"); // 73
+ iAllAttributes.put(new Short(AT_STROKE), "stroke"); // 74
+ iAllAttributes.put(new Short(AT_STROKEDASHARRAY), "stroke-dasharray"); // 75
+ iAllAttributes.put(new Short(AT_STROKEDASHOFFSET), "stroke-dashoffset"); // 76
+ iAllAttributes.put(new Short(AT_STROKELINECAP), "stroke-linecap"); // 77
+ iAllAttributes.put(new Short(AT_STROKELINEJOIN), "stroke-linejoin"); // 78
+ iAllAttributes.put(new Short(AT_STROKEMITERLIMIT), "stroke-miterlimit"); // 79
+ iAllAttributes.put(new Short(AT_STROKEWIDTH), "stroke-width"); // 80
+ iAllAttributes.put(new Short(AT_STYLE), "style"); // 81
+ iAllAttributes.put(new Short(AT_SYSTEMLANGUAGE), "systemLanguage"); // 82
+ iAllAttributes.put(new Short(AT_TARGET), "target"); // 83
+ iAllAttributes.put(new Short(AT_TEXTANCHOR), "text-anchor"); // 84
+ iAllAttributes.put(new Short(AT_TO), "to"); // 85
+ iAllAttributes.put(new Short(AT_TRANSFORM), "transform"); // 86
+ iAllAttributes.put(new Short(AT_TYPE), "type"); // 87
+ iAllAttributes.put(new Short(AT_U1), "u1"); // 88
+ iAllAttributes.put(new Short(AT_U2), "u2"); // 89
+ iAllAttributes.put(new Short(AT_UNDERLINEPOSITION), "underline-position"); // 90
+ iAllAttributes.put(new Short(AT_UNDERLINETHICKNESS), "underline-thickness"); // 91
+ iAllAttributes.put(new Short(AT_UNICODE), "unicode"); // 92
+ iAllAttributes.put(new Short(AT_UNICODERANGE), "unicode-range"); // 93
+ iAllAttributes.put(new Short(AT_UNITSPEREM), "units-per-em"); // 94
+ iAllAttributes.put(new Short(AT_VALUES), "values"); // 95
+ iAllAttributes.put(new Short(AT_VERSION), "version"); // 96
+ iAllAttributes.put(new Short(AT_VIEWBOX), "viewBox"); // 97
+ iAllAttributes.put(new Short(AT_VISIBILITY), "visibility"); // 98
+ iAllAttributes.put(new Short(AT_WIDTH), "width"); // 99
+ iAllAttributes.put(new Short(AT_WIDTHS), "widths"); // 100
+ iAllAttributes.put(new Short(AT_X), "x"); // 101
+ iAllAttributes.put(new Short(AT_XHEIGHT), "xheight"); // 102
+ iAllAttributes.put(new Short(AT_X1), "x1"); // 103
+ iAllAttributes.put(new Short(AT_X2), "x2"); // 104
+ iAllAttributes.put(new Short(AT_XLINKACTUATE), "xlink:actuate"); // 105
+ iAllAttributes.put(new Short(AT_XLINKARCROLE), "xlink:arcrole"); // 106
+ iAllAttributes.put(new Short(AT_XMLBASE), "xlink:base"); // 107
+ iAllAttributes.put(new Short(AT_XLINKHREF), "xlink:href"); // 108
+ iAllAttributes.put(new Short(AT_XLINKROLE), "xlink:role"); // 109
+ iAllAttributes.put(new Short(AT_XLINKSHOW), "xlink:show"); // 110
+ iAllAttributes.put(new Short(AT_XLINKTITLE), "xlink:title"); // 111
+ iAllAttributes.put(new Short(AT_XLINKTYPE), "xlink:type"); // 112
+ iAllAttributes.put(new Short(AT_XMLLANG), "xml:lang"); // 113
+ iAllAttributes.put(new Short(AT_XMLSPACE), "xml:space"); // 114
+ iAllAttributes.put(new Short(AT_Y), "y"); // 115
+ iAllAttributes.put(new Short(AT_Y1), "y1"); // 116
+ iAllAttributes.put(new Short(AT_Y2), "y2"); // 117
+ iAllAttributes.put(new Short(AT_ZOOMANDPAN), "zoomAndPan"); // 118
+
+ // Qualified elements
+ iQualifiedElements = new Vector(10);
+ iQualifiedElements.addElement("a"); // 1
+ iQualifiedElements.addElement("circle"); // 2
+ iQualifiedElements.addElement("ellipse"); // 3
+ iQualifiedElements.addElement("g"); // 4
+ iQualifiedElements.addElement("image"); // 5
+ iQualifiedElements.addElement("line"); // 6
+ iQualifiedElements.addElement("path"); // 7
+ iQualifiedElements.addElement("rect"); // 8
+ iQualifiedElements.addElement("text"); // 9
+ iQualifiedElements.addElement("use"); // 10
+
+ // Animatable elements
+ iAnimatableElements = new Vector(6);
+ iAnimatableElements.addElement("animate"); // 1
+ iAnimatableElements.addElement("animateColor"); // 2
+ iAnimatableElements.addElement("animateMotion"); // 3
+ iAnimatableElements.addElement("animateTransform"); // 4
+ iAnimatableElements.addElement("mpath"); // 5
+ iAnimatableElements.addElement("set"); // 6
+
+ // Read only elements
+ iReadOnlyElements = new Vector(19);
+ iReadOnlyElements.addElement("animateColor"); // 1
+ iReadOnlyElements.addElement("animateMotion"); // 2
+ iReadOnlyElements.addElement("animateTransform"); // 3
+ iReadOnlyElements.addElement("defs"); // 4
+ iReadOnlyElements.addElement("desc"); // 5
+ iReadOnlyElements.addElement("font"); // 6
+ iReadOnlyElements.addElement("font-face"); // 7
+ iReadOnlyElements.addElement("font-face-name"); // 8
+ iReadOnlyElements.addElement("font-face-src"); // 9
+ iReadOnlyElements.addElement("foreignObject"); // 10
+ iReadOnlyElements.addElement("glyph"); // 11
+ iReadOnlyElements.addElement("hkern"); // 12
+ iReadOnlyElements.addElement("metadata"); // 13
+ iReadOnlyElements.addElement("missing-glyph"); // 14
+ iReadOnlyElements.addElement("mpath"); // 15
+ iReadOnlyElements.addElement("polygon"); // 16
+ iReadOnlyElements.addElement("polyline"); // 17
+ iReadOnlyElements.addElement("set"); // 18
+ iReadOnlyElements.addElement("switch"); // 19
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /**
+ * Determines if the specified parentElement can have the specified childElement.
+ * This method works for only the element types that can be added in JSR-226.
+ */
+ static final boolean checkElementAsChild(short aParentElement, short aChildElement)
+ {
+ switch (aParentElement)
+ {
+ case EL_A:
+ switch (aChildElement)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+
+ case EL_ANIMATE:
+ case EL_ANIMATECOLOR:
+ case EL_ANIMATEMOTION:
+ case EL_ANIMATETRANSFORM:
+ case EL_CIRCLE:
+ return false;
+
+ case EL_DEFS:
+ switch (aChildElement)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+
+ case EL_DESC:
+ case EL_ELLIPSE:
+ case EL_FONT:
+ case EL_FONTFACE:
+ case EL_FONTFACENAME:
+ case EL_FONTFACESRC:
+ case EL_FOREIGNOBJECT:
+ return false;
+
+ case EL_G:
+ switch (aChildElement)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+
+ case EL_GLYPH:
+ case EL_HKERN:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_METADATA:
+ case EL_MISSINGGLYPH:
+ case EL_MPATH:
+ case EL_PATH:
+ case EL_POLYGON:
+ case EL_POLYLINE:
+ case EL_RECT:
+ case EL_SET:
+ return false;
+
+ case EL_SVG:
+ case EL_SWITCH:
+ switch (aChildElement)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+
+ case EL_TEXT:
+ switch (aChildElement)
+ {
+ case EL_A:
+ return true;
+ default:
+ return false;
+ }
+
+ case EL_TITLE:
+ case EL_USE:
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Determines if the specified attribute type can be set on the specified element type.
+ * @param aAttribute
+ * @param aElement
+ * @return true if ok
+ */
+ static final boolean checkElementAttribute(short aAttribute, short aElement)
+ {
+ switch (aElement)
+ {
+ case EL_A:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TRANSFORM:
+ case AT_TARGET:
+ case AT_XLINKHREF:
+ return true;
+ default:
+ return false;
+ }
+ case EL_CIRCLE:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_CX:
+ case AT_CY:
+ case AT_R:
+ return true;
+ default:
+ return false;
+ }
+ case EL_ELLIPSE:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_CX:
+ case AT_CY:
+ case AT_RX:
+ case AT_RY:
+ return true;
+ default:
+ return false;
+ }
+ case EL_G:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TRANSFORM:
+ return true;
+ default:
+ return false;
+ }
+ case EL_IMAGE:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_X:
+ case AT_Y:
+ case AT_WIDTH:
+ case AT_HEIGHT:
+ case AT_XLINKHREF:
+ return true;
+ default:
+ return false;
+ }
+ case EL_LINE:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_X1:
+ case AT_X2:
+ case AT_Y1:
+ case AT_Y2:
+ return true;
+ default:
+ return false;
+ }
+ case EL_PATH:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_D:
+ return true;
+ default:
+ return false;
+ }
+ case EL_RECT:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_TRANSFORM:
+ case AT_HEIGHT:
+ case AT_WIDTH:
+ case AT_X:
+ case AT_Y:
+ case AT_RX:
+ case AT_RY:
+ return true;
+ default:
+ return false;
+ }
+ case EL_SVG:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_VERSION:
+ case AT_BASEPROFILE:
+ case AT_VIEWBOX:
+ case AT_ZOOMANDPAN:
+ return true;
+ default:
+ return false;
+ }
+ case EL_TEXT:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TRANSFORM:
+ case AT_X:
+ case AT_Y:
+ case AT_STRING:
+ return true;
+ default:
+ return false;
+ }
+ case EL_USE:
+ switch (aAttribute)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TRANSFORM:
+ case AT_X:
+ case AT_Y:
+ case AT_XLINKHREF:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks if the attribute name needs prefix
+ * @param aAttributeTypeName
+ * @return Attribute name
+ */
+ static final String checkPrefixNeed(String aAttributeTypeName)
+ {
+ if (aAttributeTypeName.equals("actuate")) return "xlink:actuate";
+
+ else if (aAttributeTypeName.equals("arcrole")) return "xlink:arcrole";
+
+ else if (aAttributeTypeName.equals("href")) return "xlink:href";
+
+ else if (aAttributeTypeName.equals("role")) return "xlink:role";
+
+ else if (aAttributeTypeName.equals("show")) return "xlink:show";
+
+ else if (aAttributeTypeName.equals("title")) return "xlink:title";
+
+ else if (aAttributeTypeName.equals("type")) return "xlink:type";
+
+ else if (aAttributeTypeName.equals("base")) return "xml:base";
+
+ else if (aAttributeTypeName.equals("lang")) return "xml:lang";
+
+ else if (aAttributeTypeName.equals("space")) return "xml:space";
+
+ else return aAttributeTypeName;
+ }
+
+ /**
+ * Get internal data containers
+ * @return Data containers
+ */
+ static M2GSVGConstants getInstance()
+ {
+ if (sInstance == null)
+ {
+
+ sInstance = new M2GSVGConstants();
+ }
+ return sInstance;
+ }
+
+ /**
+ * Checks if element can be inserted.
+ * @param aElementTypeId -
+ * @return true if ok
+ */
+ static final boolean isAllowedToInsertElement(short aElementTypeId)
+ {
+ switch (aElementTypeId)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks if element can be removed.
+ * @param aElementTypeId -
+ * @return true if ok
+ */
+ static final boolean isAllowedToRemoveElement(short aElementTypeId)
+ {
+ switch (aElementTypeId)
+ {
+ case EL_A:
+ case EL_CIRCLE:
+ case EL_ELLIPSE:
+ case EL_G:
+ case EL_IMAGE:
+ case EL_LINE:
+ case EL_PATH:
+ case EL_RECT:
+ case EL_TEXT:
+ case EL_USE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks if element is animatable
+ * @param aElementTypeName
+ * @return true if element is animatable
+ */
+ static boolean isAnimatableElement(String aElementTypeName)
+ {
+ if (getInstance().iAnimatableElements.contains(
+ aElementTypeName))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks that float trait is allowed to get
+ * @param aAttributeTypeId
+ * @return true if float trait is allowed to get
+ */
+ static final boolean isGetFloatTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_FONTSIZE:
+ case AT_HEIGHT:
+ case AT_WIDTH:
+ case AT_X:
+ case AT_Y:
+ case AT_RX:
+ case AT_RY:
+ case AT_CX:
+ case AT_CY:
+ case AT_R:
+ case AT_X1:
+ case AT_X2:
+ case AT_Y1:
+ case AT_Y2:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that matrix trait is allowed to set
+ * @param aAttributeTypeId
+ * @return true if matrix trait is allowed to set
+ */
+ static final boolean isGetMatrixTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_TRANSFORM:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that path trait is allowed to get
+ * @param aAttributeTypeId
+ * @return true if path trait is allowed to get
+ */
+ static final boolean isGetPathTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_D:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that rect trait is allowed to get
+ * @param aAttributeTypeId
+ * @return true if rect trait is allowed to get
+ */
+ static final boolean isGetRectTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_VIEWBOX:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that RGB trait is allowed to get.
+ * @param aAttributeTypeId
+ * @return true if RGB trait is allowed to get.
+ */
+ static final boolean isGetRgbColorTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_COLOR:
+ case AT_FILL:
+ case AT_STROKE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that trait that can be obtained as a string is allowed to get.
+ * In SVG Tiny only certain traits can be obtained as a String value.
+ * @param aAttributeTypeId
+ * @return true if ok
+ */
+ static final boolean isGetTraitNSStringAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_DISPLAY:
+ case AT_FILLRULE:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TARGET:
+ case AT_STRING: // not an SVG aTrait, but represents the contents of <text>
+ case AT_VERSION:
+ case AT_BASEPROFILE:
+ case AT_XLINKHREF:
+ case AT_ZOOMANDPAN:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+
+ /**
+ * Check trait
+ * @param aAttributeTypeId
+ * @return
+ */
+ static final boolean isGetTraitNSAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_XLINKHREF:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that an element is locatable
+ * @param aElementTypeName
+ * @return true if the element is locatable
+ */
+ static boolean isLocatableElement(String aElementTypeName)
+ {
+ if (isRootElement(aElementTypeName))
+ {
+ return true;
+ }
+ if (getInstance().iQualifiedElements.contains(
+ aElementTypeName))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks that an element is qualified
+ * @param aElementTypeName
+ * @return true if the element is qualified
+ */
+ static boolean isQualifiedElement(String aElementTypeName)
+ {
+ if (getInstance().iQualifiedElements.contains(
+ aElementTypeName))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if element is read only
+ * @param aElementTypeName
+ * @return true if the element is read only
+ */
+ static boolean isElementReadOnly(String aElementTypeName)
+ {
+ if (aElementTypeName != null)
+ {
+ return getInstance().iReadOnlyElements.contains(
+ aElementTypeName);
+ }
+ return false;
+ }
+
+ /**
+ * Checks that an element is a root element
+ * @param aElementTypeName
+ * @return true if the element is a root element
+ */
+ static boolean isRootElement(String aElementTypeName)
+ {
+ return ROOT_SVG_ELEMENT_NAME.equals(aElementTypeName);
+ }
+
+ /**
+ * Checks that float trait is allowed to set
+ * @param aAttributeTypeId
+ * @return true if float trait is allowed to set
+ */
+ static final boolean isSetFloatTraitAllowed(short aAttributeTypeId)
+ {
+ return isGetFloatTraitAllowed(aAttributeTypeId);
+ }
+
+ /**
+ * Checks that matrix trait is allowed to set
+ * @param aAttributeTypeId
+ * @return true if matrix trait is allowed to set
+ */
+ static final boolean isSetMatrixTraitAllowed(short aAttributeTypeId)
+ {
+ return isGetMatrixTraitAllowed(aAttributeTypeId);
+ }
+
+
+ /**
+ * Checks that path trait is allowed to set
+ * @param aAttributeTypeId
+ * @return true if path trait is allowed to set
+ */
+ static final boolean isSetPathTraitAllowed(short aAttributeTypeId)
+ {
+ return isGetPathTraitAllowed(aAttributeTypeId);
+ }
+
+ /**
+ * Checks that rect trait is allowed to set
+ * @param aAttributeTypeId
+ * @return true if rect trait is allowed to set
+ */
+ static final boolean isSetRectTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_VIEWBOX:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that RGB trait is allowed to set.
+ * @param aAttributeTypeId
+ * @return true if RGB trait is allowed to set.
+ */
+ static final boolean isSetRgbColorTraitAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_COLOR:
+ case AT_FILL:
+ case AT_STROKE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks that trait that can be obtained as a string is allowed to set.
+ * In SVG Tiny only certain traits can be obtained as a String value.
+ * @param aAttributeTypeId
+ * @return true if ok
+ */
+ static final boolean isSetTraitNSStringAllowed(short aAttributeTypeId)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_COLOR:
+ case AT_DISPLAY:
+ case AT_FILL:
+ case AT_FILLRULE:
+ case AT_STROKE:
+ case AT_STROKEDASHOFFSET:
+ case AT_STROKELINECAP:
+ case AT_STROKELINEJOIN:
+ case AT_STROKEMITERLIMIT:
+ case AT_STROKEWIDTH:
+ case AT_VISIBILITY:
+ case AT_FONTFAMILY:
+ case AT_FONTSIZE:
+ case AT_FONTSTYLE:
+ case AT_FONTWEIGHT:
+ case AT_TEXTANCHOR:
+ case AT_TARGET:
+ case AT_STRING: // not an SVG trait, but represents the contents of <text>
+ case AT_XLINKHREF:
+ case AT_ZOOMANDPAN:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Check trait
+ * @param aAttributeTypeId
+ * @return
+ */
+ static final boolean isSetTraitNSAllowed(short aAttributeTypeId)
+ {
+ return isGetTraitNSAllowed(aAttributeTypeId);
+ }
+
+ /**
+ * Converts a string trait name to the appropriate short constant.
+ * This method covers all of SVGT 1.1 and not just JSR-226.
+ * @param aAttributeTypeName
+ * @return Attribute's type id
+ */
+ static final short parseAttributeTypeId(String aAttributeTypeName)
+ {
+ String name = checkPrefixNeed(aAttributeTypeName);
+ Enumeration keys = getInstance().iAllAttributes.keys();
+ while (keys.hasMoreElements())
+ {
+ Object id = keys.nextElement();
+ try
+ {
+ if (((String)getInstance().iAllAttributes.get(
+ id)).equals(name))
+ {
+ return ((Short)id).shortValue();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+
+ }
+ return SVG_ERROR;
+ }
+
+ /**
+ * Converts a short constant to the string representation of a SVGT 1.1 trait name.
+ * This method covers all of SVGT 1.1 and not just JSR-226.
+ * @param aAttributeTypeId
+ * @return Attribute's type name
+ */
+ static final String parseAttributeTypeName(short aAttributeTypeId)
+ {
+
+ Object attributeName = getInstance().iAllAttributes.get(
+ new Short(aAttributeTypeId));
+ if (attributeName != null)
+ {
+ return (String)attributeName;
+ }
+ return "";
+ }
+
+ /**
+ * Converts a string element name to the appropriate short constant.
+ * This method covers all of SVGT 1.1 and not just JSR-226.
+ * @param aElementTypeName
+ * @return Element's type id
+ */
+ static final short parseElementTypeId(String aElementTypeName)
+ {
+ Enumeration keys = getInstance().iAllElements.keys();
+ while (keys.hasMoreElements())
+ {
+ Object id = keys.nextElement();
+ try
+ {
+ if (((String)getInstance().iAllElements.get(
+ id)).equals(aElementTypeName))
+ {
+ return ((Short)id).shortValue();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ return SVG_ERROR;
+ }
+
+ /**
+ * Converts a short constant to the string representation of a SVGT 1.1 element name.
+ * This method covers all of SVGT 1.1 and not just JSR-226.
+ * @param aElementTypeId
+ * @return Element's type name
+ */
+ static final String parseElementTypeName(short aElementTypeId)
+ {
+ Object elementName = getInstance().iAllElements.get(
+ new Short(aElementTypeId));
+ if (elementName != null)
+ {
+ return (String)elementName;
+ }
+ return "";
+ }
+
+ /**
+ * Converts a string trait value to the appropriate short constant.
+ * NOTE: This method only handles traits that can be set as a string in JSR-226.
+ * @param aAttributeTypeId
+ * @param aValue
+ * @return Value's id
+ */
+ static final short parseAttributeValueNameId(short aAttributeTypeId, String aValue)
+ {
+ switch (aAttributeTypeId)
+ {
+ case AT_STRING: // element content (i.e. <text>, etc.)
+ return TEXT_NOT_SHORT;
+
+ case AT_COLOR: // inherit
+ if (aValue.equals("inherit")) return PAINT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_DISPLAY: // inline | none | inherit
+ if (aValue.equals("none")) return DISPLAY_NONE;
+ else if (aValue.equals("inline")) return DISPLAY_OTHER;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_FILL: // none | currentColor | inherit
+ if (aValue.equals("none")) return PAINT_NONE;
+ else if (aValue.equals("currentColor")) return PAINT_CURRENT;
+ else if (aValue.equals("inherit")) return PAINT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_FILLRULE: // nonzero | evenodd | inherit
+ if (aValue.equals("evenodd")) return FILL_RULE_EVENODD;
+ else if (aValue.equals("nonzero")) return FILL_RULE_NONZERO;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_FONTFAMILY: // same syntax as font-family attribute
+ if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return TEXT_NOT_SHORT;
+
+ case AT_FONTSIZE: // inherit
+ if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_FONTSTYLE: // normal | italic | oblique | inherit
+ if (aValue.equals("normal")) return FONT_NORMAL;
+ else if (aValue.equals("italic")) return FONT_STYLE_ITALIC;
+ else if (aValue.equals("oblique")) return FONT_STYLE_OBLIQUE;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_FONTWEIGHT: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
+ if (aValue.equals("normal")) return FONT_NORMAL;
+ else if (aValue.equals("bold")) return FONT_WEIGHT_BOLD;
+ else if (aValue.equals("bolder")) return FONT_WEIGHT_BOLDER;
+ else if (aValue.equals("lighter")) return FONT_WEIGHT_LIGHTER;
+ else if (aValue.equals("100")) return FONT_WEIGHT_100;
+ else if (aValue.equals("200")) return FONT_WEIGHT_200;
+ else if (aValue.equals("300")) return FONT_WEIGHT_300;
+ else if (aValue.equals("400")) return FONT_WEIGHT_400;
+ else if (aValue.equals("500")) return FONT_WEIGHT_500;
+ else if (aValue.equals("600")) return FONT_WEIGHT_600;
+ else if (aValue.equals("700")) return FONT_WEIGHT_700;
+ else if (aValue.equals("800")) return FONT_WEIGHT_800;
+ else if (aValue.equals("900")) return FONT_WEIGHT_900;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKE: // none | currentColor | inherit
+ if (aValue.equals("none")) return PAINT_NONE;
+ else if (aValue.equals("currentColor")) return PAINT_CURRENT;
+ else if (aValue.equals("inherit")) return PAINT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKEDASHOFFSET: // inherit
+ if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKELINECAP: // butt | round | square | inherit
+ if (aValue.equals("butt")) return STROKE_LINECAP_BUTT;
+ else if (aValue.equals("round")) return STROKE_LINECAP_ROUND;
+ else if (aValue.equals("square")) return STROKE_LINECAP_SQUARE;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKELINEJOIN: // miter | round | bevel | inherit
+ if (aValue.equals("miter")) return STROKE_LINEJOIN_MITER;
+ else if (aValue.equals("round")) return STROKE_LINEJOIN_ROUND;
+ else if (aValue.equals("bevel")) return STROKE_LINEJOIN_BEVEL;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKEMITERLIMIT: // inherit
+ if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_STROKEWIDTH: // inherit
+ if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_TARGET: // string
+ return TEXT_NOT_SHORT;
+
+ case AT_TEXTANCHOR: // start | middle | end | inherit
+ if (aValue.equals("start")) return TEXT_ANCHOR_START;
+ else if (aValue.equals("middle")) return TEXT_ANCHOR_MIDDLE;
+ else if (aValue.equals("end")) return TEXT_ANCHOR_END;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_VISIBILITY: // visible | hidden | inherit
+ if (aValue.equals("visible")) return VISIBILITY_VISIBLE;
+ else if (aValue.equals("hidden")) return VISIBILITY_OTHER;
+ else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
+ else return SVG_ERROR;
+
+ case AT_XLINKHREF: // URI aValue
+ return TEXT_NOT_SHORT;
+
+ case AT_ZOOMANDPAN: // disable | magnify
+ if (aValue.equals("magnify")) return ZPN_MAGNIFY;
+ else if (aValue.equals("disable")) return ZPN_DISABLE;
+ else return SVG_ERROR;
+
+ default:
+ return SVG_ERROR;
+ }
+ }
+
+ /**
+ * Parse attribute
+ * @param aValueId
+ * @return Value's name
+ */
+ static final String parseAttributeValueName(short aAttributeTypeId, short aValueId)
+ {
+ if (aValueId == 0)
+ {
+ return "";
+ }
+ if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_LIGHTER)
+ {
+ return "300";
+ }
+ else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_NORMAL)
+ {
+ return "400";
+ }
+ else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLD)
+ {
+ return "700";
+ }
+ else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLDER)
+ {
+ return "800";
+ }
+ else
+ {
+ return parseAttributeValueName(aValueId);
+ }
+ }
+
+ /**
+ * Converts a short constant to the string representation of a
+ * SVGT 1.1 attribute value literal.
+ * This method covers all of SVGT 1.1 and not just JSR-226.
+ * @param aValueId
+ * @return Value's name
+ */
+ static final String parseAttributeValueName(short aValueId)
+ {
+
+ switch (aValueId)
+ {
+ case TEXT_NOT_SHORT:
+ return "#text";
+
+ case DEFAULT_INHERIT:
+ case PAINT_INHERIT:
+ return "inherit";
+
+ case DISPLAY_NONE:
+ case PAINT_NONE:
+ return "none";
+
+ case DISPLAY_OTHER:
+ return "inline";
+
+ case PAINT_CURRENT:
+ return "currentColor";
+
+ case FILL_RULE_NONZERO:
+ return "nonzero";
+
+ case FILL_RULE_EVENODD:
+ return "evenodd";
+
+ case FONT_NORMAL:
+ return "normal";
+
+ case FONT_STYLE_ITALIC:
+ return "italic";
+
+ case FONT_STYLE_OBLIQUE:
+ return "oblique";
+
+ case FONT_WEIGHT_BOLD:
+ return "bold";
+
+ case FONT_WEIGHT_BOLDER:
+ return "bolder";
+
+ case FONT_WEIGHT_LIGHTER:
+ return "lighter";
+
+ case FONT_WEIGHT_100:
+ return "100";
+
+ case FONT_WEIGHT_200:
+ return "200";
+
+ case FONT_WEIGHT_300:
+ return "300";
+
+ case FONT_WEIGHT_400:
+ return "400";
+
+ case FONT_WEIGHT_500:
+ return "500";
+
+ case FONT_WEIGHT_600:
+ return "600";
+
+ case FONT_WEIGHT_700:
+ return "700";
+
+ case FONT_WEIGHT_800:
+ return "800";
+
+ case FONT_WEIGHT_900:
+ return "900";
+
+ case STROKE_LINECAP_BUTT:
+ return "butt";
+
+ case STROKE_LINECAP_ROUND:
+ case STROKE_LINEJOIN_ROUND:
+ return "round";
+
+ case STROKE_LINECAP_SQUARE:
+ return "square";
+
+ case STROKE_LINEJOIN_MITER:
+ return "miter";
+
+ case STROKE_LINEJOIN_BEVEL:
+ return "bevel";
+
+ case TEXT_ANCHOR_START:
+ return "start";
+
+ case TEXT_ANCHOR_MIDDLE:
+ return "middle";
+
+ case TEXT_ANCHOR_END:
+ return "end";
+
+ case VISIBILITY_VISIBLE:
+ return "visible";
+
+ case VISIBILITY_OTHER:
+ return "hidden";
+
+ case ZPN_MAGNIFY:
+ return "magnify";
+
+ case ZPN_DISABLE:
+ return "disable";
+
+ default:
+ return "";
+ }
+ }
+
+ /*
+ * Parses path command
+ * @param aPathCommandIndex
+ * @return path command
+ */
+ static short parsePathCommand(short aPathCommandIndex)
+ {
+ short command = SVG_ERROR;
+ switch (aPathCommandIndex)
+ {
+ case PATH_COMMAND_m:
+ case PATH_COMMAND_M:
+ command = SVGPath.MOVE_TO;
+ break;
+ case PATH_COMMAND_Z:
+ command = SVGPath.CLOSE;
+ break;
+ case PATH_COMMAND_h:
+ case PATH_COMMAND_v:
+ case PATH_COMMAND_l:
+ case PATH_COMMAND_H:
+ case PATH_COMMAND_V:
+ case PATH_COMMAND_L:
+ command = SVGPath.LINE_TO;
+ break;
+ case PATH_COMMAND_s:
+ case PATH_COMMAND_c:
+ case PATH_COMMAND_S:
+ case PATH_COMMAND_C:
+ command = SVGPath.CURVE_TO;
+ break;
+ case PATH_COMMAND_t:
+ case PATH_COMMAND_q:
+ case PATH_COMMAND_T:
+ case PATH_COMMAND_Q:
+ command = SVGPath.QUAD_TO;
+ break;
+ default:
+ command = SVG_ERROR;
+ break;
+ }
+ return command;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1477 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.*;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.events.*;
+//import com.nokia.mj.impl.rt.legacy.ToolkitInvoker;
+import java.io.IOException;
+import org.eclipse.swt.widgets.*;
+//import org.eclipse.swt.widgets.Display;
+import com.nokia.mj.impl.utils.Logger;
+
+public class M2GSVGElement extends M2GObject implements SVGElement
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ // Error constants
+ static final String TYPE_IS_NULL_ESTR =
+ "The type is null.";
+ static final String LISTENER_IS_NULL_ESTR =
+ "The listener is null.";
+ static final String CAPTURE_NOT_SUPPORTED_ESTR =
+ "The capture phase is not supported in SVG Tiny.";
+ //static final String ESWT_PACKAGE =
+ // "org.eclipse.swt.widgets.Display" ;
+
+ /* Optimization: static finals changed to local variables
+ static final String TRAIT_IS_NULL_ESTR =
+ "The trait is null.";
+ static final String TRAIT_NOT_SUPPORTED_ON_ELEM_ESTR =
+ "The trait is not supported on this element.";
+ static final String TRAIT_NOT_SUPPORTED_IN_NS_ESTR =
+ "The trait is not supported in this namespace.";
+ static final String GET_FLOAT_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a float.";
+ static final String SET_FLOAT_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a float.";
+ static final String GET_MATRIX_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a SVGMatrix.";
+ static final String SET_MATRIX_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a SVGMatrix.";
+ static final String GET_PATH_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a SVGPath.";
+ static final String SET_PATH_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a SVGPath.";
+ static final String GET_RECT_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a SVGRect.";
+ static final String SET_RECT_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a SVGRect.";
+ static final String GET_RGB_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a SVGRGBColor.";
+ static final String SET_RGB_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a SVGRGBColor.";
+ static final String NS_NOT_SUPPORTED_ESTR =
+ "The namespace is not supported.";
+ static final String GET_TRAIT_NS_STRING_MISMATCH_ESTR =
+ "Trait's computed value cannot be converted to a String.";
+ static final String SET_TRAIT_NS_STRING_MISMATCH_ESTR =
+ "Trait's value cannot be specified as a String.";
+ static final String ID_IS_NULL_ESTR =
+ "The id is null.";
+ static final String EXISTING_ELEM_ID_CHANGE_ESTR =
+ "Existing element id cannot be changed.";
+ static final String ELEM_ID_EXIST_IN_DOCUMENT_ESTR =
+ "Element id already exists in the document.";
+ static final String INVALID_INPUT_VALUE_ESTR =
+ "The input value is an invalid value for the given trait.";
+ static final String VALUE_IS_NULL_ESTR =
+ "Value cannot be set to null.";
+ static final String SET_READONLY_MISMATCH_ESTR =
+ "Attempt to change readonly trait.";
+ static final String INVALID_VALUE_ESTR =
+ "The value is invalid.";
+ static final String INVALID_USE_ELEMENT_ESTR =
+ "The <use> element is hooked into the document tree and the the value of xlink:href is set invalid.";
+ static final String CANNOT_REMOVE_NODE_ESTR =
+ "Cannot remove this type of node.";
+ static final String CANNOT_REMOVE_NOT_CHILD_ESTR =
+ "Not a child of this node.";
+ static final String CANNOT_REMOVE_NON_NULL_ID_ESTR =
+ "The element being removed or one of its decendants have non-null id.";
+ static final String INSERT_NODE_OF_THAT_TYPE_ESTR =
+ "Cannot insert node of that type.";
+ static final String APPEND_DOCUMENT_ESTR =
+ "Cannot append Document elements.";
+ static final String DOCUMENT_HIERARCHY_ESTR =
+ "Hierarchy request error in Document.";
+ static final String CHILD_IS_WRONG_TYPE_ESTR =
+ "Child is wrong type (Document).";
+ static final String CHILD_BELONG_TO_DIFFERENT_DOCUMENT_ESTR =
+ "Child belongs to different document.";
+ static final String CHILD_NOT_FOUND_ESTR =
+ "The child to insert before doesn't exist in this current node.";
+ static final String INVALID_ELEMENT_ID_VALUE =
+ "Invalid element id value.";
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ protected M2GDocument iDocument;
+ protected short iElementTypeId;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aHandle is native element handle
+ * @param aDocument is a reference to a document that owns this element.
+ */
+ M2GSVGElement(int aElementHandle, M2GDocument aDocument)
+ {
+ super(aElementHandle);
+ iDocument = aDocument;
+ doConstruct();
+ }
+
+
+ /**
+ * @see org.w3c.dom.events.EventTarget#addEventListener()
+ */
+ public void addEventListener(String type, EventListener listener, boolean useCapture)
+ {
+ if (type == null || type.equals(""))
+ {
+ throw new NullPointerException(TYPE_IS_NULL_ESTR);
+ }
+ if (listener == null)
+ {
+ throw new NullPointerException(LISTENER_IS_NULL_ESTR);
+ }
+ if (useCapture == true)
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ CAPTURE_NOT_SUPPORTED_ESTR);
+ }
+ iDocument.register(this, type, listener);
+ }
+
+ /**
+ * @see org.w3c.dom.Node#appendChild()
+ */
+ public Node appendChild(Node newChild)
+ {
+ // If refChild is null, newChild is inserted at the end of the list
+ return insertBefore(newChild, null); // will inform about DOM changes
+ }
+
+ /**
+ * Checks attribute validity
+ * @param aAttributeTypeName
+ * @return attribute's type id
+ * @throws DOMException
+ */
+ protected short check(String aAttributeTypeName) throws DOMException
+ {
+ short attributeTypeId = M2GSVGConstants.AT_UNDEFINED;
+ if (aAttributeTypeName == null || aAttributeTypeName.equals(""))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "check() exception: " + /*SF*/"The trait is null."/*SF*/);
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"The trait is null."/*SF*/);
+ }
+ // Converts attribute's name
+ attributeTypeId = M2GSVGConstants.parseAttributeTypeId(aAttributeTypeName);
+ // Checks that element has this attribute
+ if (!M2GSVGConstants.checkElementAttribute(attributeTypeId, iElementTypeId))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "check() exception: " + /*SF*/"The trait is not supported on this element."/*SF*/);
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"The trait is not supported on this element."/*SF*/);
+ }
+ return attributeTypeId;
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCheckValidity()
+ */
+ public boolean doCheckValidity()
+ {
+ try
+ {
+ if (super.doCheckValidity() &&
+ (iDocument != null) &&
+ (iElementTypeId != M2GSVGConstants.EL_UNDEFINED))
+ {
+ return true;
+ }
+ }
+ catch (IOException e)
+ {
+ }
+ return false;
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
+ */
+ protected void doCleanup()
+ {
+ iDocument = null;
+ iElementTypeId = M2GSVGConstants.EL_UNDEFINED;
+ resetHandles();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
+ */
+ public void doConstruct()
+ {
+ // No need to register for finalization
+ // super.doConstruct();
+ iElementTypeId = _getElementTypeId(
+ getNativeSVGProxyHandle(), getHandle());
+ }
+
+ /**
+ * Returns a document
+ */
+ public M2GDocument getDocument()
+ {
+ return iDocument;
+ }
+
+ /*
+ * Retuns element's type id
+ * @return element's type id
+ */
+ public short getElementTypeId()
+ {
+ return iElementTypeId;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getFirstElementChild()
+ */
+ public Element getFirstElementChild() throws DOMException
+ {
+ // Get child element's handle
+ int childHandle = _getFirstElementChild(
+ getNativeSVGProxyHandle(), getHandle());
+ if (M2GObject.checkHandle(childHandle))
+ {
+ return (Element)M2GSVGElement.buildElement(childHandle, iDocument);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getFloatTrait()
+ */
+ public float getFloatTrait(String name) throws DOMException
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getFloatTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short attributeTypeId = check(name);
+ if (!M2GSVGConstants.isGetFloatTraitAllowed(attributeTypeId))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's computed value cannot be converted to a float."/*SF*/);
+ }
+ return _getFloatTrait(
+ getNativeSVGProxyHandle(), getHandle(), attributeTypeId);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getId()
+ */
+ public String getId()
+ {
+ return _getStringTrait(
+ getNativeSVGProxyHandle(), getHandle(), M2GSVGConstants.AT_ID);
+ }
+
+ /**
+ * @see org.w3c.dom.Node#getLocalName()
+ */
+ public String getLocalName()
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getLocalName() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return M2GSVGConstants.parseElementTypeName(iElementTypeId);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getMatrixTrait()
+ */
+ public SVGMatrix getMatrixTrait(String name)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getMatrixTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short attributeTypeId = check(name);
+ if (!M2GSVGConstants.isGetMatrixTraitAllowed(attributeTypeId))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's computed value cannot be converted to a SVGMatrix."/*SF*/);
+ }
+ M2GSVGMatrix matrix = new M2GSVGMatrix();
+ // If an error is occurred, then no values are put in the
+ // matrix array by the native method
+ _getMatrixTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ attributeTypeId,
+ matrix.getComponents());
+ return matrix;
+ }
+
+ /**
+ * @see org.w3c.dom.Node#getNamespaceURI()
+ */
+ public String getNamespaceURI()
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getNamespaceURI() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return M2GSVGConstants.SVG_NAMESPACE_URI;
+ /*
+ return _getStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ id);
+ */
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getNextElementSibling()
+ */
+ public Element getNextElementSibling()
+ {
+ int elementHandle = _getNextElementSibling(
+ getNativeSVGProxyHandle(), getHandle());
+ if (M2GObject.checkHandle(elementHandle))
+ {
+ return M2GSVGElement.buildElement(elementHandle, iDocument);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getParentNode()
+ */
+ public Node getParentNode()
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getParentNode() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ int parentHandle = _getParent(
+ getNativeSVGProxyHandle(), getHandle());
+ if (M2GObject.checkHandle(parentHandle))
+ {
+ return M2GSVGElement.buildElement(parentHandle, iDocument);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getPathTrait()
+ */
+ public SVGPath getPathTrait(String name)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getPathTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short attributeTypeId = check(name);
+ if (!M2GSVGConstants.isGetPathTraitAllowed(attributeTypeId))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's computed value cannot be converted to a SVGPath."/*SF*/);
+ }
+ int pathHandle = _getPathTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ attributeTypeId);
+ if (pathHandle != 0)
+ {
+ // Path doesn't own the native object
+ return new M2GSVGPath(pathHandle);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getRectTrait()
+ */
+ public SVGRect getRectTrait(String name)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getRectTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short attributeTypeId = check(name);
+ if (!M2GSVGConstants.isGetRectTraitAllowed(attributeTypeId))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's computed value cannot be converted to a SVGRect."/*SF*/);
+ }
+ M2GSVGRect rect = new M2GSVGRect();
+ if (_getRectTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ attributeTypeId,
+ rect.getComponents()) == -1)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getRectTrait() - returns null!!");
+ return null;
+ }
+ else
+ {
+ return rect;
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#getRGBColorTrait()
+ */
+ public SVGRGBColor getRGBColorTrait(String name)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getRGBColorTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+
+ short attributeTypeId = check(name);
+ if (!M2GSVGConstants.isGetRgbColorTraitAllowed(attributeTypeId))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's computed value cannot be converted to a SVGRGBColor."/*SF*/);
+ }
+ M2GSVGRGBColor rgb = new M2GSVGRGBColor(0, 0, 0);
+ int result = _getColorTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ attributeTypeId,
+ rgb.getComponents());
+ if (result == -1)
+ {
+ if ((attributeTypeId == M2GSVGConstants.AT_FILL) ||
+ (attributeTypeId == M2GSVGConstants.AT_COLOR))
+ {
+ return new M2GSVGRGBColor(0, 0, 0);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if (result == 0)
+ {
+ return null;
+ }
+ return rgb;
+ }
+
+ /**
+ * Get trait
+ * @see org.w3c.dom.svg.SVGElement#getTrait()
+ */
+ public String getTrait(String name)
+ {
+ return getTraitNS(null, name);
+ }
+
+ /**
+ * Get trait
+ * @see org.w3c.dom.svg.SVGElement#getTraitNS()
+ */
+ public String getTraitNS(String namespaceURI, String name)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getTraitNS() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+
+ // Checks name validity
+ short id = check(name);
+ String value = null;
+
+ // SVG traits are in the so-called element's 'per-element type partitions namespaces'
+ // namespace must be always null
+ // except for HREF traits which are from XLINK namespace?
+
+ // XLINK_NAMESPACE
+ if (namespaceURI != null &&
+ namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI))
+ {
+ if (!M2GSVGConstants.isGetTraitNSAllowed(id))
+ {
+ Logger.ELOG(Logger.EJavaUI, "getTraitNS() XLINK eception: " +
+ "Trait's computed value cannot be converted to a String.");
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ "Trait's computed value cannot be converted to a String.");
+ }
+
+ value = _getStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ id);
+
+ if (value == null)
+ {
+ value = "";
+ }
+
+ return value;
+ }
+
+ // Checks namespace validity: namespace must be null
+ if (namespaceURI != null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "getTraitNS() - namespace IS NOT xlink but something else.");
+ Logger.ELOG(Logger.EJavaUI,
+ "getTraitNS() exception: " + /*SF*/"The namespace is not supported."/*SF*/);
+
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ "The namespace is not supported.");
+ }
+
+ // Checks that attribute is obtaineable as a string
+ if (!M2GSVGConstants.isGetTraitNSStringAllowed(id))
+ {
+ Logger.ELOG(Logger.EJavaUI, "getTraitNS() exception: " +
+ "Trait's computed value cannot be converted to a String.");
+
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ "Trait's computed value cannot be converted to a String.");
+ }
+
+ if (id == M2GSVGConstants.AT_XLINKHREF)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getTraitNS() exception: "
+ + "The trait is not supported in this namespace.");
+
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ "The trait is not supported in this namespace.");
+ }
+
+ // Checks if attribute is in string format
+ if ((id == M2GSVGConstants.AT_STRING) ||
+ (id == M2GSVGConstants.AT_VERSION) ||
+ (id == M2GSVGConstants.AT_BASEPROFILE) ||
+ (id == M2GSVGConstants.AT_TARGET) ||
+ (id == M2GSVGConstants.AT_FONTFAMILY))
+ {
+ value = _getStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ id);
+ }
+ // Reads enum attribute
+ else
+ {
+ short valueId = _getEnumTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ id);
+
+ // Convert value id to string
+ value = M2GSVGConstants.parseAttributeValueName(id, valueId);
+ }
+
+ if (value == null)
+ {
+ value = "";
+ }
+ return value;
+ }
+
+ /*
+ * Get element used from this element
+ * @return Element.
+ */
+ public SVGElement getUsedFromElement()
+ {
+ int elementHandle = _getUsedFromElement(
+ getNativeSVGProxyHandle(),
+ getHandle());
+ if (M2GObject.checkHandle(elementHandle))
+ {
+ return M2GSVGElement.buildElement(elementHandle, iDocument);
+ }
+ return null;
+ }
+
+
+ /**
+ * @see org.w3c.dom.Node#insertBefore
+ */
+ public Node insertBefore(Node newChild, Node refChild)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+
+ if (newChild == null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - new child is null");
+ throw new NullPointerException();
+ }
+ if (newChild instanceof M2GDocument)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - child is document");
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Child is wrong type (Document)."/*SF*/);
+ }
+
+ if (!M2GSVGConstants.isAllowedToInsertElement(((M2GSVGElement)newChild).iElementTypeId))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - cannot insert this node type");
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"Cannot insert node of that type."/*SF*/);
+ }
+
+ if (!M2GSVGConstants.checkElementAsChild(
+ iElementTypeId, ((M2GSVGElement)newChild).iElementTypeId))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - invalid parent-child relation");
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Cannot insert node of that type."/*SF*/);
+ }
+ // Ensure that the new child candidate wouldn't be an ancestor of this element
+ if (IsAncestor(newChild, this))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - is ancestor");
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Hierarchy request error in Document."/*SF*/);
+ }
+ // Check that the child and this element belong to the same Document
+ if (((M2GSVGElement)newChild).getDocument().getHandle() != iDocument.getHandle())
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - document is not the same");
+ throw new DOMException(
+ DOMException.WRONG_DOCUMENT_ERR,
+ /*SF*/"Child belongs to different document."/*SF*/);
+ }
+ if ((refChild != null) &&
+ (((M2GSVGElement)refChild.getParentNode()).getHandle() != getHandle()))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - ref child is not found");
+ throw new DOMException(
+ DOMException.NOT_FOUND_ERR,
+ /*SF*/"The child to insert before doesn't exist in this current node."/*SF*/);
+ }
+ // check that if <use> then xlink:href is an existing element id
+ if (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_USE)
+ {
+ String value = ((M2GSVGElement)newChild).getTraitNS(
+ M2GSVGConstants.XLINK_NAMESPACE_URI, "href");
+ if (value.length() != 0)
+ {
+ if (!value.startsWith("#") ||
+ ((M2GSVGElement)newChild).iDocument.getElementById(value.substring(1)) == null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "insertBefore() exception - \"href\" trait value="
+ + value + " is invalid");
+ throw new DOMException(
+ DOMException.INVALID_STATE_ERR,
+ /*SF*/"Invalid element id value."/*SF*/);
+ }
+ }
+ }
+ if (refChild == null)
+ {
+ _appendChild(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ ((M2GSVGElement)newChild).getHandle());
+ }
+ else
+ {
+ _insertBefore(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ ((M2GSVGElement)newChild).getHandle(),
+ ((M2GSVGElement) refChild).getHandle());
+ }
+ String href = _getStringTrait(
+ getNativeSVGProxyHandle(),
+ ((M2GSVGElement)newChild).getHandle(),
+ M2GSVGConstants.AT_XLINKHREF);
+ // Need to call resource handler if element is elementindom, image,
+ // and if it has an href attribute
+ if ((href != null) &&
+ (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_IMAGE) &&
+ iDocument.isElementInDOM(((M2GSVGElement)newChild).getHandle()))
+ {
+ // Call resource handler here
+ iDocument.invokeResourceHandler(href);
+ }
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+
+ return newChild;
+ }
+
+ /*
+ * Check if used
+ * @return True if used.
+ */
+ public boolean isUsed()
+ {
+ return (_isUsed(
+ getNativeSVGProxyHandle(),
+ getHandle()) > 0 ? true : false);
+ }
+
+ /**
+ * @see org.w3c.dom.events.EventTarget#removeEventListener()
+ */
+ public void removeEventListener(String type, EventListener listener, boolean useCapture)
+ {
+ if (type == null || type.equals("") || listener == null)
+ {
+ throw new NullPointerException();
+ }
+ if (useCapture == true)
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ CAPTURE_NOT_SUPPORTED_ESTR);
+ }
+ iDocument.unregister(this, type, listener);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setId()
+ */
+ public void setId(String id) throws DOMException
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setId() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ if (id == null)
+ {
+ throw new NullPointerException(/*SF*/"The id is null."/*SF*/);
+ }
+ if (getId() != null)
+ {
+ throw new DOMException(
+ DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ /*SF*/"Existing element id cannot be changed."/*SF*/);
+ }
+ if (iDocument.containsElement(id))
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"Element id already exists in the document."/*SF*/);
+ }
+ else
+ {
+ _setStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(), M2GSVGConstants.AT_ID, id);
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setFloatTrait()
+ */
+ public void setFloatTrait(String name, float value)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setFloatTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+
+ short id = check(name);
+ if (!M2GSVGConstants.isSetFloatTraitAllowed(id))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setFloatTrait() exception - set float (id=" + id + ") not allowed");
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a float."/*SF*/);
+ }
+ if ((Float.isNaN(value)) ||
+ // value must be >= 1
+ (value < 1 && (id == M2GSVGConstants.AT_STROKEMITERLIMIT)) ||
+ // value must be >= 0
+ (value < 0 && (id == M2GSVGConstants.AT_FONTSIZE ||
+ id == M2GSVGConstants.AT_STROKEWIDTH ||
+ id == M2GSVGConstants.AT_HEIGHT ||
+ id == M2GSVGConstants.AT_WIDTH ||
+ id == M2GSVGConstants.AT_RX ||
+ id == M2GSVGConstants.AT_RY ||
+ id == M2GSVGConstants.AT_R)))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setFloatTrait() exception - invalid value=" + value);
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
+ }
+ _setFloatTrait(getNativeSVGProxyHandle(),
+ getHandle(), id, value);
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setMatrixTrait()
+ */
+ public void setMatrixTrait(String name, SVGMatrix matrix)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setMatrixTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short id = check(name);
+ if (!M2GSVGConstants.isSetMatrixTraitAllowed(id))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a SVGMatrix."/*SF*/);
+ }
+ if ((matrix == null) ||
+ !(matrix instanceof M2GSVGMatrix))
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
+ }
+
+ _setMatrixTrait(getNativeSVGProxyHandle(),
+ getHandle(), id,
+ ((M2GSVGMatrix)matrix).getComponents());
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setPathTrait()
+ */
+ public void setPathTrait(String name, SVGPath path)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setPathTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short id = check(name);
+ if (!M2GSVGConstants.isSetPathTraitAllowed(id))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a SVGPath."/*SF*/);
+ }
+ if ((path == null) ||
+ !(path instanceof M2GSVGPath) ||
+ !((M2GSVGPath)path).doCheckValidity())
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setPathTrait() - exception M2GSVGPath not valid");
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
+ }
+
+ _setPathTrait( getNativeSVGProxyHandle(),
+ getHandle(), id, ((M2GSVGPath)path).getHandle());
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setPathTrait()
+ */
+ public void setRectTrait(String name, SVGRect rect)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setRectTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short id = check(name);
+ if (!M2GSVGConstants.isSetRectTraitAllowed(id))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a SVGRect."/*SF*/);
+ }
+ if ((rect == null) ||
+ (rect.getWidth() < 0 || rect.getHeight() < 0))
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
+ }
+
+ _setRectTrait(
+ getNativeSVGProxyHandle(), getHandle(), id,
+ rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setRGBColorTrait()
+ */
+ public void setRGBColorTrait(String name, SVGRGBColor color)
+ {
+
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setRGBColorTrait() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ short id = check(name);
+ if (!M2GSVGConstants.isSetRgbColorTraitAllowed(id))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setRGBColorTrait() - exception: " + DOMException.TYPE_MISMATCH_ERR);
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a SVGRGBColor."/*SF*/);
+ }
+ if (color == null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setRGBColorTrait() - exception: " + DOMException.INVALID_ACCESS_ERR);
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The trait is null."/*SF*/);
+ }
+
+ _setColorTrait(
+ getNativeSVGProxyHandle(), getHandle(), id,
+ color.getRed(), color.getGreen(), color.getBlue());
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setTrait()
+ */
+ public void setTrait(String name, String value)
+ {
+ setTraitNS(null, name, value);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGElement#setTraitNS()
+ */
+ public void setTraitNS(String namespaceURI, String name, String value)
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setTraitNS() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ if (value == null)
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"Value cannot be set to null."/*SF*/);
+ }
+
+ short id = check(name);
+
+ // SVG traits are in the so-called element's 'per-element type partitions namespaces'
+ // namespace must be always null
+ // except for HREF traits which are from XLINK namespace?
+
+ if (namespaceURI != null &&
+ namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI))
+ {
+ if (!M2GSVGConstants.isGetTraitNSAllowed(id))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ "Trait's value cannot be specified as a String.");
+ }
+
+ // check that if <use> then xlink:href is an existing element id
+ if ((iElementTypeId == M2GSVGConstants.EL_USE) &&
+ (iDocument.isElementInDOM(getHandle())))
+ {
+ if ((value.length() <= 1) ||
+ !value.startsWith("#") ||
+ (iDocument.getElementById(value.substring(1)) == null))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setTraitNS() - DOMException");
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The <use> element is hooked into the document tree and the the value of xlink:href is set invalid."/*SF*/);
+ }
+ }
+
+ _setStringTrait(
+ getNativeSVGProxyHandle(), getHandle(), id, value);
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+
+ // Check if element is in DOM and in that case invokes
+ // resource handler
+ if ((iElementTypeId == M2GSVGConstants.EL_IMAGE) &&
+ (id == M2GSVGConstants.AT_XLINKHREF) &&
+ (iDocument.isElementInDOM(getHandle())))
+ {
+ if (!iDocument.containsExternalResourceURI(value))
+ {
+ iDocument.invokeResourceHandler(value);
+ }
+ }
+
+ return;
+ } // namespaceURI != null && namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI)
+
+ // all traits except HREF must have no namespace
+ if (namespaceURI != null)
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ "The namespace is not supported.");
+ }
+
+ if ((id == M2GSVGConstants.AT_VERSION) ||
+ (id == M2GSVGConstants.AT_BASEPROFILE))
+ {
+ throw new DOMException(
+ DOMException.NO_MODIFICATION_ALLOWED_ERR,
+ /*SF*/"Attempt to change readonly trait."/*SF*/);
+ }
+
+ if (id == M2GSVGConstants.AT_XLINKHREF)
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"The trait is not supported in this namespace."/*SF*/);
+ }
+
+ if (!M2GSVGConstants.isSetTraitNSStringAllowed(id))
+ {
+ throw new DOMException(
+ DOMException.TYPE_MISMATCH_ERR,
+ /*SF*/"Trait's value cannot be specified as a String."/*SF*/);
+ }
+
+ short valueId = M2GSVGConstants.parseAttributeValueNameId(id, value);
+
+ if (valueId == M2GSVGConstants.SVG_ERROR)
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The value is invalid."/*SF*/);
+ }
+ else if (valueId == M2GSVGConstants.TEXT_NOT_SHORT)
+ {
+ _setStringTrait(
+ getNativeSVGProxyHandle(), getHandle(), id, value);
+ }
+ else
+ {
+ _setEnumTrait(
+ getNativeSVGProxyHandle(), getHandle(), id, valueId);
+ }
+
+ // inform observer about changes in DOM only if element is in DOM
+ iDocument.notifyDOMChangeObserver(iNativeHandle);
+ }
+
+ /**
+ * @see org.w3c.dom.Node#removeChild
+ */
+ public Node removeChild(Node oldChild) throws DOMException
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "removeChild() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ if (oldChild == null)
+ {
+ throw new NullPointerException();
+ }
+ if (oldChild instanceof M2GDocument)
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"Cannot remove this type of node."/*SF*/);
+ }
+
+ M2GSVGElement removableChild = (M2GSVGElement)oldChild;
+
+ if (!M2GSVGConstants.isAllowedToRemoveElement(
+ removableChild.iElementTypeId))
+ {
+ throw new DOMException(
+ DOMException.NOT_SUPPORTED_ERR,
+ /*SF*/"Cannot remove this type of node."/*SF*/);
+ }
+ M2GSVGElement parent = (M2GSVGElement)removableChild.getParentNode();
+ if ((parent == null) ||
+ (parent.getHandle() != getHandle()))
+ {
+ throw new DOMException(
+ DOMException.NOT_FOUND_ERR,
+ /*SF*/"Not a child of this node."/*SF*/);
+ }
+ // Check if removable
+ int result = _checkRemoveable(
+ getNativeSVGProxyHandle(),
+ removableChild.getHandle());
+ if (result <= 0)
+ {
+ throw new DOMException(
+ DOMException.INVALID_ACCESS_ERR,
+ /*SF*/"The element being removed or one of its decendants have non-null id."/*SF*/);
+ }
+ // The removedChildHandle handle should be same as the removableChild handle
+ int removedChildHandle = removedChildHandle = _removeChild(
+ getNativeSVGProxyHandle(),
+ getHandle(), removableChild.getHandle());
+ // Remove the element from the live elements
+ removableChild.getDocument().unregisterLiveElement(
+ new Integer(removableChild.getHandle()));
+
+ iDocument.notifyDOMChangeObserver(getHandle());
+
+ return removableChild;
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+
+ /**
+ * Creates SVGElement instance according to the element type.
+ * Possible element types are: SVGElement, SVGLocatableElement,
+ * SVGSVGElement, SVGAnimationElement
+ */
+ public static SVGElement buildElement(int aElementHandle, M2GDocument aDocument)
+ {
+ // Check native handle
+ if (!M2GObject.checkHandle(aElementHandle) || (aDocument == null))
+ {
+ return null;
+ }
+
+ // Check if the element already exists
+ SVGElement svgElement = aDocument.findLiveElement(new Integer(aElementHandle));
+ if (svgElement != null)
+ {
+ return svgElement;
+ }
+
+ String typeName = M2GSVGElement.getElementTypeName(aElementHandle, aDocument);
+
+ if (M2GSVGConstants.isRootElement(typeName))
+ {
+ svgElement = M2GSVGSVGElement.buildRootElement(aDocument);
+ }
+ else if (M2GSVGConstants.isLocatableElement(typeName))
+ {
+ svgElement = new M2GSVGLocatableElement(aElementHandle, aDocument);
+ }
+ else if (M2GSVGConstants.isAnimatableElement(typeName))
+ {
+ svgElement = new M2GSVGAnimationElement(aElementHandle, aDocument);
+ }
+ else
+ {
+
+ String id = M2GSVGElement._getStringTrait(
+ M2GManager.getInstance().getSVGProxyHandle(),
+ aElementHandle,
+ M2GSVGConstants.AT_ID );
+ if ((id != null) && id.equals("text_use_svg_default_font"))
+ {
+ return buildElement(
+ M2GSVGElement._getNextElementSibling(
+ aDocument.getNativeSVGProxyHandle(), aElementHandle),
+ aDocument);
+ }
+ else
+ {
+ svgElement = new M2GSVGElement(aElementHandle, aDocument);
+ }
+ }
+ aDocument.registerLiveElement(svgElement, new Integer(aElementHandle));
+ return svgElement;
+ }
+
+ /**
+ * Helper function for appendChild and insertBefore
+ * returns true if "ancestor" is the same node as "child" or
+ * if "ancestor" is parent/ancestor of "child" else returns false
+ */
+ private static final boolean IsAncestor(Node aAncestor, Node aChild) throws DOMException
+ {
+ boolean result = false;
+ if (aAncestor != null && aChild != null)
+ {
+ if (aChild instanceof M2GDocument)
+ {
+ throw new DOMException(
+ DOMException.HIERARCHY_REQUEST_ERR,
+ /*SF*/"Cannot append Document elements."/*SF*/);
+ }
+ if ((aChild instanceof M2GSVGElement) && (aAncestor instanceof M2GSVGElement))
+ {
+ // Should check all types or just parent type???
+ if (((M2GSVGElement)aAncestor).getHandle() == ((M2GSVGElement)aChild).getHandle())
+ {
+ result = true;
+ }
+ else
+ {
+ result = IsAncestor(aAncestor, aChild.getParentNode());
+ }
+ }
+ }
+ return result;
+ }
+
+
+ /**
+ * Helper function for removeChild.
+ * @returns false if the node "child" and all its children have non-null ids
+ * else returns true
+ */
+ private static final boolean IsReadOnly(Node aChild)
+ {
+ if (aChild != null)
+ {
+ // Should check all types or just parent type???
+ if ((aChild instanceof M2GSVGElement) ||
+ (aChild instanceof SVGLocatableElement) ||
+ (aChild instanceof SVGSVGElement))
+ {
+ if (M2GSVGConstants.isElementReadOnly(((M2GSVGElement)aChild).getLocalName()))
+ {
+ return true;
+ }
+ return IsReadOnly(aChild.getParentNode());
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get element's type name
+ * @param aElementHandle
+ * @param aDocument
+ * @return element's type name
+ */
+ public static String getElementTypeName(int aElementHandle, M2GDocument aDocument)
+ {
+ short elemenTypeId = M2GSVGConstants.EL_UNDEFINED;
+ if (aDocument != null)
+ {
+ elemenTypeId = M2GSVGElement._getElementTypeId(
+ aDocument.getNativeSVGProxyHandle(),
+ aElementHandle);
+ }
+ else
+ {
+ elemenTypeId = M2GSVGElement._getElementTypeId(
+ M2GManager.getInstance().getSVGProxyHandle(),
+ aElementHandle);
+ }
+
+ return M2GSVGConstants.parseElementTypeName(elemenTypeId);
+ }
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private static native void _appendChild(
+ int aSvgProxyHandle, int aElementHandle, int aNewChild);
+
+ private static native int _checkRemoveable(
+ int aSvgProxyHandle, int aElementHandle);
+
+ static native int _getBBox(
+ int aSvgProxyHandle, int aElementHandle,
+ short aAttributeTypeId, float[] aComponents);
+
+ private static native int _getColorTrait(
+ int aSvgProxyHandle, int aElementHandle,
+ short aAttributeTypeId, int[] aColorComponents);
+
+ private static native short _getElementTypeId(
+ int aSvgProxyHandle, int aElementHandle);
+
+ static native short _getEnumTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
+
+ private static native int _getFirstElementChild(
+ int aSvgProxyHandle, int aElementHandle);
+
+ private static native float _getFloatTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
+
+ static native int _getMatrixTrait(
+ int aSvgProxyHandle, int aElementHandle,
+ short aAttributeTypeId, float[] aComponents);
+
+ private static native int _getNextElementSibling(
+ int aSvgProxyHandle, int aElementHandle);
+
+ private static native int _getParent(
+ int aSvgProxyHandle, int aElementHandle);
+
+ private static native int _getPathTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
+
+ static native int _getRectTrait(
+ int aSvgProxyHandle, int aElementHandle,
+ short aAttributeTypeId, float[] aComponents);
+
+ native static int _getRootElement(
+ int aSvgProxyHandle, int aDocumentHandle);
+
+ static native void _getScreenBBox(
+ int aSvgProxyHandle, int aElementHandle, float[] aComponents);
+
+ protected static native String _getStringTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
+
+ private static native int _getUsedFromElement(
+ int aSvgProxyHandle, int aElementHandle);
+
+ private static native void _insertBefore(
+ int aSvgProxyHandle, int aElementHandle,
+ int aChildElementHandle, int aReferenceElementHandle);
+
+ private static native int _isUsed(
+ int aSvgProxyHandle, int aElementHandle);
+
+ private static native int _removeChild(
+ int aSvgProxyHandle, int aElementHandle, int aChildElementHandle);
+
+ private static native void _setColorTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
+ int aRed, int aGreen, int aBlue);
+
+ private static native void _setEnumTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
+ short aValue);
+
+ private static native void _setFloatTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, float aValue);
+
+ static native void _setMatrixTrait(
+ int aSvgProxyHandle, int aElementHandle,
+ short aAttributeTypeId, float[] aComponents);
+
+ private static native void _setPathTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, int aPathHandle);
+
+ private static native void _setRectTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
+ float aX, float aY, float aWidth, float aHeight);
+
+ private static native void _setStringTrait(
+ int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, String aValue);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGElementWrapper.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.events.*;
+import org.w3c.dom.DOMException;
+import com.nokia.mj.impl.utils.Logger;
+
+public class M2GSVGElementWrapper extends M2GObject implements EventTarget
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GSVGElement iElement;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aElement Element to be wrapped
+ */
+ M2GSVGElementWrapper(M2GSVGElement aElement)
+ {
+ super();
+ iElement = aElement;
+ }
+
+ /**
+ * Cleanup operations.
+ */
+ void doCleanup()
+ {
+ }
+
+ /**
+ * Construct operations.
+ */
+ void doConstruct()
+ {
+ if (iElement != null)
+ {
+ setHandle(iElement.getHandle());
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.events.EventTarget#addEventListener()
+ */
+ public void addEventListener(String type, EventListener listener, boolean useCapture)
+ {
+ if (type == null || type.equals(""))
+ {
+ throw new NullPointerException(M2GSVGElement.TYPE_IS_NULL_ESTR);
+ }
+ if (listener == null)
+ {
+ throw new NullPointerException(M2GSVGElement.LISTENER_IS_NULL_ESTR);
+ }
+ if (useCapture == true)
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
+ M2GSVGElement.CAPTURE_NOT_SUPPORTED_ESTR);
+ }
+ try
+ {
+ iElement.getDocument().register(iElement, type, listener);
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaUI, "addEventListener() exception:" + e.toString());
+ }
+ }
+
+ /**
+ * Get wrapped target element
+ * @return Event target
+ */
+ public EventTarget getWrappedTarget()
+ {
+ return iElement;
+ }
+
+ /**
+ * @see org.w3c.dom.events.EventTarget#removeEventListener()
+ */
+ public void removeEventListener(String type, EventListener listener, boolean useCapture)
+ {
+ if (type == null || type.equals(""))
+ {
+ throw new NullPointerException(M2GSVGElement.TYPE_IS_NULL_ESTR);
+ }
+ if (listener == null)
+ {
+ throw new NullPointerException(M2GSVGElement.LISTENER_IS_NULL_ESTR);
+ }
+ if (useCapture == true)
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
+ M2GSVGElement.CAPTURE_NOT_SUPPORTED_ESTR);
+ }
+ try
+ {
+ iElement.getDocument().unregister(iElement, type, listener);
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaUI, "removeEventListener() exception:" + e.toString());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGImage.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,475 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.microedition.m2g.ExternalResourceHandler;
+import javax.microedition.m2g.SVGImage;
+import org.w3c.dom.Document;
+import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.DOMException;
+import com.nokia.microedition.m2g.connection.*;
+import com.nokia.mj.impl.utils.Logger;
+import com.nokia.mj.impl.utils.StreamUtils;
+
+
+/*
+ * Image implementation
+ */
+public class M2GSVGImage
+ extends SVGImage
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ /* Optimization: static finals changed to local variables
+ private static final String NULL_TYPE_ESTR =
+ "The type is null.";
+ private static final String ILLEGAL_VALUS_ESTR =
+ "The x or y values are negative.";
+ private static final String EVENT_TYPE_NOT_SUPPORTED_ESTR =
+ "The event type is not supported.";
+ private static final String INVALID_ELEMENT_ESTR =
+ "Invalid element.";
+ public static final String URI_IS_NULL_ESTR =
+ "The URI is null.";
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ M2GDocument iDocument = null;
+ private SVGElement iFocusedNode = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ */
+ M2GSVGImage()
+ {
+ super();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGImage#activate()
+ */
+ public void activate()
+ {
+ SVGElement node = iFocusedNode;
+ while (node != null)
+ {
+ ((M2GDocument)getDocument()).handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_ACTIVATE,
+ node,
+ M2GEvent.EVENT_TARGET));
+ node = (SVGElement)node.getParentNode();
+ }
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGImage#dispatchMouseEvent()
+ */
+ public void dispatchMouseEvent(String type, int x, int y)
+ {
+ if (type == null || type.equals(""))
+ {
+ Logger.ELOG(Logger.EJavaUI, "dispatchMouseEvent() NullPointerException");
+ throw new NullPointerException(/*SF*/"The type is null."/*SF*/);
+ }
+ if (x < 0 || y < 0)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "dispatchMouseEvent() IllegalArgumentException");
+ throw new IllegalArgumentException(/*SF*/"The x or y values are negative."/*SF*/);
+ }
+ if (!type.equals(M2GSVGConstants.EVENT_CLICK))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "dispatchMouseEvent() DOMException - only click event is supported");
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, /*SF*/"The event type is not supported."/*SF*/);
+ }
+ int elementHandle = _dispatchMouseEvent(
+ iDocument.getNativeSVGProxyHandle(),
+ iDocument.getHandle(), x, y);
+
+ SVGElement targetElement = M2GSVGElement.buildElement(elementHandle, iDocument);
+ SVGElement usedFromElement = null;
+ if ((targetElement != null) && ((M2GSVGElement)targetElement).isUsed())
+ {
+ usedFromElement = ((M2GSVGElement)((M2GSVGElement)targetElement).getUsedFromElement());
+ }
+ if (targetElement instanceof M2GSVGElement)
+ {
+ iFocusedNode = targetElement;
+ }
+ while (targetElement != null)
+ {
+ // click event
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_CLICK, targetElement, M2GEvent.EVENT_TARGET));
+ // DOMActivate event
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_ACTIVATE, targetElement, M2GEvent.EVENT_TARGET));
+ // Gets parent node
+ targetElement = (SVGElement)targetElement.getParentNode();
+ }
+ // The "target element" is only a clone. The "used from element" is the actual element.
+ if (usedFromElement != null)
+ {
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_CLICK, usedFromElement, M2GEvent.WRAPPED_EVENT_TARGET));
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_ACTIVATE, usedFromElement, M2GEvent.WRAPPED_EVENT_TARGET));
+ }
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGImage#focusOn()
+ */
+ public void focusOn(SVGElement element)
+ {
+ SVGElement tempNode = element;
+ // If focusOn is called on the same element, do not focus out.
+ boolean callFocusOut =
+ (((iFocusedNode != null) && (iFocusedNode == element ? false : true)) || ((iFocusedNode != null) && (element == null)));
+ //Checking to see if the element is hooked into the tree.
+ if (element != null)
+ {
+ tempNode = element;
+ while (tempNode != null)
+ {
+ if ((tempNode.getLocalName()).equals(M2GSVGConstants.ROOT_SVG_ELEMENT_NAME))
+ {
+ // Breaks if tempNode is root svg
+ break;
+ }
+ tempNode = (SVGElement)tempNode.getParentNode();
+ }
+ // This indicates that the element does not contain a root element,
+ // therefore does not belong to the document.
+ if (tempNode == null)
+ {
+ Logger.ELOG(Logger.EJavaUI, "focusOn() - DOMException invalid element");
+ throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, /*SF*/"Invalid element."/*SF*/);
+ }
+ }
+ // Focus out from the current focused node and its parents
+ if (callFocusOut)
+ {
+ if (iFocusedNode instanceof M2GSVGElement)
+ {
+ _focusOut(
+ ((M2GSVGElement)iFocusedNode).getNativeSVGProxyHandle(),
+ ((M2GSVGElement)iFocusedNode).getDocument().getHandle(),
+ ((M2GSVGElement)iFocusedNode).getHandle());
+ }
+
+ // Focus out the current focused node and its parents
+ tempNode = iFocusedNode;
+ while (tempNode != null)
+ {
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_FOCUS_OUT, tempNode, M2GEvent.EVENT_TARGET));
+ tempNode = (SVGElement)tempNode.getParentNode();
+ }
+ }
+ //focus in for element and its parents
+ if ((element != null) && (element instanceof M2GSVGElement))
+ {
+ _focusOn(
+ ((M2GSVGElement)element).getNativeSVGProxyHandle(),
+ ((M2GSVGElement)element).getDocument().getHandle(),
+ ((M2GSVGElement)element).getHandle() );
+ }
+ tempNode = element;
+ while (tempNode != null)
+ {
+ iDocument.handleEvent(new M2GEvent(
+ M2GSVGConstants.EVENT_FOCUS_IN, tempNode, M2GEvent.EVENT_TARGET));
+ tempNode = (SVGElement)tempNode.getParentNode();
+ }
+ // Sets the new focus
+ iFocusedNode = element;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGImage#getDocument()
+ */
+ public Document getDocument()
+ {
+ return iDocument;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#getViewportHeight()
+ */
+ public synchronized int getViewportHeight()
+ {
+ return iDocument.getViewportHeight();
+ }
+
+
+ /*
+ * @see javax.microedition.m2g.ScalableImage#getViewportWidth()
+ */
+ public synchronized int getViewportWidth()
+ {
+ return iDocument.getViewportWidth();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGImage#incrementTime()
+ */
+ public void incrementTime(float seconds)
+ {
+ ((M2GSVGSVGElement)iDocument.getDocumentElement()).incrementTime(seconds);
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#requestCompleted()
+ */
+ public void requestCompleted(String uri, InputStream resourceData) throws IOException
+ {
+ if (uri == null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "requestCompleted() throw NullPointerException");
+ throw new NullPointerException(/*SF*/"The URI is null."/*SF*/);
+ }
+
+ if (resourceData != null)
+ {
+ byte receiveData[] = StreamUtils.readBytesFromStream(resourceData, -1);
+ iDocument.requestCompleted(uri, receiveData);
+ }
+ else
+ {
+ // Indicates that the requested resource could not be
+ // fetched by the ResourceHandler or application,
+ // and in this event the SVG engine will not make further attempts
+ // to load this resource.
+ // Pass the null to the native side so it can delete the image
+ iDocument.requestCompleted(uri, null);
+ }
+ }
+
+ /**
+ * Set document
+ * @param aDocument -
+ */
+ public void setDocument(M2GDocument aDocument)
+ {
+ iDocument = aDocument;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#setViewportHeight()
+ */
+ public synchronized void setViewportHeight(int height)
+ {
+ iDocument.setViewportHeight(height);
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#setViewportWidth()
+ */
+ public synchronized void setViewportWidth(int width)
+ {
+ iDocument.setViewportWidth(width);
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /*
+ * @see javax.microedition.m2g.SVGImage#createEmptyImage()
+ */
+ public static M2GSVGImage buildEmptyImage(ExternalResourceHandler handler)
+ {
+ try
+ {
+ return M2GSVGImage.buildImage(
+ new ByteArrayInputStream(
+ M2GSVGConstants.getInstance().iEmptySvgDocument.getBytes()),
+ handler, null, null);
+ }
+ catch (IOException e)
+ {
+ Logger.ELOG(Logger.EJavaUI, "M2GSVGImage: buildEmptyImage - IOEception: " + e.toString());
+ }
+ return null;
+ }
+
+ /**
+ * Build svg image
+ * @see javax.microedition.m2g.ScalableImage#createImage()
+ * @param stream Plain text stream that contains svg data
+ * @param handler External resource handler. If null then default
+ * external resource handler is used.
+ * @param baseUrl A base url from where a document is downloaded.
+ * @param suffixUrl The suffix url according to the DRM opening mode of the SVG file
+ * Null if it's not known.
+ */
+ public static M2GSVGImage buildImage(
+ InputStream stream,
+ ExternalResourceHandler handler,
+ String baseUrl,
+ String suffixUrl) throws IOException
+ {
+ if (stream == null)
+ {
+ throw new NullPointerException();
+ }
+ System.out.println("P-M2GSVGImage");
+
+ String strData = new String(StreamUtils.readBytesFromStream(stream, -1));
+
+ // Default handler is used if the specified handler is null
+ if (handler == null)
+ {
+ handler = M2GConnectionFactory.getExternalResourceHandler(null);
+ }
+
+ // Creates and setups svg image
+ M2GSVGImage image = new M2GSVGImage();
+ System.out.println("P-M2GSVGImage call to buildDocument");
+ M2GDocument document = M2GDocument.buildDocument(
+ image,
+ baseUrl,
+ suffixUrl,
+ strData,
+ handler);
+ // Checks document validity
+ System.out.println("P-M2GSVGImage call to buildDocument Completed Setting documents");
+ image.setDocument(document);
+ if (handler != null)
+ {
+ // Gets size of external resources
+ int itemCount = _getExternalListSize(
+ document.getNativeSVGProxyHandle(),
+ document.getHandle());
+
+ // Loops through external items
+ for (int index = 0; index < itemCount; index++)
+ {
+ String url = _getExternalListItem(
+ document.getNativeSVGProxyHandle(),
+ document.getHandle(),
+ index);
+ // Calls an external implementation of the resource handler
+ if ((url != null) && !(url.equals("")))
+ {
+ document.invokeResourceHandler(url);
+ }
+ }
+ }
+
+ // initialise the viewport
+ _initViewport(document.getNativeSVGProxyHandle(),
+ document.getHandle());
+
+ return image;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage#createImage()
+ */
+ public static M2GSVGImage buildImage(
+ String url, ExternalResourceHandler handler) throws IOException
+ {
+ // Checks passed parameters
+ if (url == null)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "M2GSVGImage: 2 buildImage() - url is null");
+ throw new NullPointerException();
+ }
+ if (url.length() == 0)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "M2GSVGImage: 2 buildImage() - url is empty");
+ throw new IllegalArgumentException();
+ }
+ // Default handler is used if the specified handler is null
+ if (handler == null)
+ {
+ handler = M2GConnectionFactory.getExternalResourceHandler(url);
+ }
+
+ // Open the url and get input stream
+ M2GSVGImage image = null;
+ M2GConnectionProxy connectionProxy = null;
+ try
+ {
+ connectionProxy = M2GConnectionFactory.create(url);
+ image = M2GSVGImage.buildImage(
+ connectionProxy.getInputStream(),
+ handler,
+ connectionProxy.getBaseUrl(),
+ connectionProxy.getSuffixUrl());
+ // Set connection policy
+ if (image != null)
+ {
+ Document doc = image.getDocument();
+ if (doc != null)
+ {
+ ((M2GDocument)doc).setConnectionPolicy(
+ connectionProxy.getConnectionPolicy());
+ }
+ }
+ return image;
+ }
+ finally
+ {
+ if (connectionProxy != null)
+ {
+ connectionProxy.close();
+ connectionProxy = null;
+ }
+ }
+ }
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private native static int _dispatchMouseEvent(
+ int aSvgProxyHandle,int aDocumentHandle,
+ int aX, int aY);
+
+ private native static void _focusOn(
+ int aSvgProxyHandle,int aDocumentHandle,
+ int aSvgElementHandle);
+
+ private native static void _focusOut(
+ int aSvgProxyHandle,int aDocumentHandle,
+ int aSvgElementHandle);
+
+ native static int _getExternalListSize(
+ int aSvgProxyHandle, int aDocumentHandle);
+
+ native static String _getExternalListItem(
+ int aSvgProxyHandle, int aDocumentHandle,
+ int aIndex);
+
+ private native static void _initViewport(
+ int aSvgProxyHandle, int aDocumentHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGLocatableElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+
+public class M2GSVGLocatableElement
+ extends M2GSVGElement
+ implements SVGLocatableElement
+{
+ //------------------------------------------------------------------
+ // METHODS
+ //------------------------------------------------------------------
+
+ /**
+ * Constructor
+ * @param aHandle -
+ * @param aDocument -
+ */
+ public M2GSVGLocatableElement(int aHandle, M2GDocument aDocument)
+ {
+ super(aHandle, aDocument);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGLocatableElement#getBBox()
+ */
+ public SVGRect getBBox()
+ {
+ M2GSVGRect bbox = new M2GSVGRect();
+ M2GSVGElement._getBBox(getNativeSVGProxyHandle(), getHandle(),
+ M2GSVGConstants.AT_BBOX, bbox.getComponents());
+ // Checks element's type
+ if ((iElementTypeId == M2GSVGConstants.EL_G) ||
+ (iElementTypeId == M2GSVGConstants.EL_PATH) ||
+ (iElementTypeId == M2GSVGConstants.EL_SVG))
+ {
+ if (bbox.isZero())
+ {
+ bbox = null;
+ }
+ }
+ else if (iElementTypeId == M2GSVGConstants.EL_TEXT)
+ {
+ if ((bbox.getHeight()) == 0 && (bbox.getWidth() == 0))
+ {
+ bbox = null;
+ }
+ }
+ return bbox;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGLocatableElement#getScreenBBox()
+ */
+ public SVGRect getScreenBBox()
+ {
+ // Checks if this element is in DOM
+ if (getDocument().isElementInDOM(getHandle()))
+ {
+ M2GSVGRect bbox = new M2GSVGRect();
+ // Initializes M2GSVGRect components
+ M2GSVGElement._getScreenBBox(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ bbox.getComponents());
+ return bbox;
+ }
+ return null;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGLocatableElement#getScreenCTM()
+ */
+ public SVGMatrix getScreenCTM()
+ {
+ if (getDocument().isElementInDOM(getHandle()))
+ {
+ M2GSVGMatrix matrix = new M2GSVGMatrix();
+ _getMatrixTrait(getNativeSVGProxyHandle(),
+ getHandle(),
+ M2GSVGConstants.EL_SVG, matrix.getComponents());
+ return matrix;
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGMatrix.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,342 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+import org.w3c.dom.DOMException;
+
+/**
+ * This interface represents an "SVGMatrix" datatype, identified by an affine transform.
+ * It can be used to read and modify the values of transform attribute as per SVG specification.
+ *
+ * The transformation can be represented using matrix math on a 3x3 array.
+ * Given (x,y), the transformation (x',y') can be found by:
+ * [ x'] [ m00 m01 m02 ] [ x ] [ m00*x + m01*y + m02 ]
+ * [ y'] = [ m10 m11 m12 ] [ y ] = [ m10*x + m11*y + m12 ]
+ * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
+ *
+ * The bottom row of the matrix is constant, so a transform can be uniquely
+ * represented by "[[m00, m01, m02], [m10, m11, m12]]".
+ */
+public class M2GSVGMatrix implements SVGMatrix
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ /* Optimization: static finals changed to local variables
+ static private final String INVALID_INDEX_ESTR =
+ "The index is invalid.";
+ static private final String DET_IS_ZERO_ESTR =
+ "The determinant of this matrix is zero.";
+ */
+ static final int ARRAY_SIZE = 6;
+ // Array index
+ static private final int M00 = 0;
+ static private final int M10 = 1;
+ static private final int M01 = 2;
+ static private final int M11 = 3;
+ static private final int M02 = 4;
+ static private final int M12 = 5;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private float iComponents[];
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Construct a matrix with the following components:
+ * <pre>
+ * [1 0 0]
+ * [0 1 0]
+ * </pre>
+ */
+ protected M2GSVGMatrix()
+ {
+ iComponents = new float[ARRAY_SIZE];
+ iComponents[M00] = iComponents[M11] = 1;
+ }
+
+ /**
+ /**
+ * Construct a matrix with the following components:
+ * <pre>
+ * [aM00 aM01 aM02]
+ * [aM10 aM11 aM12]
+ * </pre>
+ * @param aM00 the x scaling component
+ * @param aM10 the y shearing component
+ * @param aM01 the x shearing component
+ * @param aM11 the y scaling component
+ * @param aM02 the x translation component
+ * @param aM12 the y translation component
+ */
+ protected M2GSVGMatrix(float aM00, float aM10, float aM01,
+ float aM11, float aM02, float aM12)
+ {
+ iComponents = new float[ARRAY_SIZE];
+ iComponents[M00] = aM00;
+ iComponents[M01] = aM01;
+ iComponents[M02] = aM02;
+ iComponents[M10] = aM10;
+ iComponents[M11] = aM11;
+ iComponents[M12] = aM12;
+ }
+
+ /**
+ * Constructor
+ * Create a new matrix by coping the given one.
+ * @param aMatrix the matrix to copy
+ * @throws NullPointerException if aMatrix is null
+ * @throws DOMException if index sizes are not same
+ */
+ protected M2GSVGMatrix(M2GSVGMatrix aMatrix)
+ {
+ if (aMatrix == null)
+ {
+ throw new NullPointerException();
+ }
+ iComponents = new float[aMatrix.iComponents.length];
+ for (int index = 0; index < iComponents.length; index++)
+ {
+ iComponents[index] = aMatrix.iComponents[index];
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGMatrix#getComponent()
+ */
+ public float getComponent(int index) throws DOMException
+ {
+ if ((index < 0) || (index >= iComponents.length))
+ {
+ throw new DOMException(
+ DOMException.INDEX_SIZE_ERR,
+ /*SF*/"The index is invalid."/*SF*/);
+ }
+ return iComponents[index];
+ }
+
+ /**
+ * Return the matrix of components used in this transform. The resulting
+ * values are:
+ * <pre>
+ * [array[0] array[2] array[4]]
+ * [array[1] array[3] array[5]]
+ * </pre>
+ * @return array that contains the matrix components.
+ */
+ float[] getComponents()
+ {
+ return iComponents;
+ }
+
+ /**
+ * Get the matrix of components used in this transform. The resulting
+ * values are:
+ * <pre>
+ * [aComponents[0] aComponents[2] aComponents[4]]
+ * [aComponents[1] aComponents[3] aComponents[5]]
+ * </pre>
+ * @param aComponents Float array for matrix components
+ */
+ void getComponentsToArray(float[] aComponents)
+ {
+ if (aComponents == null)
+ {
+ return;
+ }
+ for (int index = 0; index < aComponents.length; index++)
+ {
+ aComponents[index] = iComponents[index];
+ }
+ }
+
+ /**
+ * Return the determinant of this transform matrix. If the determinant is
+ * non-zero, the transform is invertible.
+ * The determinant is calculated as:
+ * <pre>
+ * [m00 m01 m02]
+ * [m10 m11 m12] = m00 * m11 - m01 * m10
+ * [ 0 0 1 ]
+ * </pre>
+ * @return the determinant
+ */
+ public float getDeterminant()
+ {
+ return ((iComponents[M00] * iComponents[M11]) -
+ (iComponents[M01] * iComponents[M10]));
+ }
+
+ /**
+ * The inverse is calculated as:
+ * <pre>
+ * [m00 m01 m02]
+ * M= [m10 m11 m12]
+ * [ 0 0 1 ]
+ *
+ * 1 [ m11/det -m01/det (m01*m12-m02*m11)/det]
+ * inverse(M)= --- x adjoint(M) = [-m10/det m00/det (m10*m02-m00*m12)/det]
+ * det [ 0 0 1 ]
+ * </pre>
+ * @see org.w3c.dom.svg.SVGMatrix#inverse()
+ */
+ public SVGMatrix inverse() throws SVGException
+ {
+ // The inversion is useful for undoing transformations.
+ float det = getDeterminant();
+ if (det == 0)
+ {
+ throw new SVGException(
+ SVGException.SVG_MATRIX_NOT_INVERTABLE,
+ /*SF*/"The determinant of this matrix is zero."/*SF*/);
+ }
+ return new M2GSVGMatrix(
+ iComponents[M11] / det, // iMtx[M00]
+ (-iComponents[M10]) / det, // iMtx[M10]
+ (-iComponents[M01]) / det, // iMtx[M01]
+ iComponents[M00] / det, // iMtx[M11]
+ ((iComponents[M01] * iComponents[M12]) - (iComponents[M02] * iComponents[M11])) / det, // iMtx[M02]
+ ((iComponents[M10] * iComponents[M02]) - (iComponents[M00] * iComponents[M12])) / det); // iMtx[M12]
+ }
+
+ /**
+ * The multiply is calculated as:
+ * <pre>
+ * [a00 a01 a02] [b00 b01 b02]
+ * this=[a10 a11 a12] B=[b10 b11 b12]
+ * [ 0 0 1 ] [ 0 0 1 ]
+ *
+ * [(a00*b00+a01*b10) (a00*b01+a01*b11) (a00*b02+a01*b12+a02)]
+ * [this] = [this]x[B] = [(a10*b00+a11*b10) (a10*b01+a11*b11) (a10*b02+a11*b12+a12)]
+ * [ 0 0 1 ]
+ * </pre>
+ * @see org.w3c.dom.svg.SVGMatrix#mMultiply()
+ */
+ public SVGMatrix mMultiply(SVGMatrix secondMatrix)
+ {
+ if (secondMatrix == null)
+ {
+ throw new NullPointerException();
+ }
+ M2GSVGMatrix b = (M2GSVGMatrix)secondMatrix;
+ float a00 = iComponents[M00]; // a
+ float a10 = iComponents[M10]; // b
+ float a01 = iComponents[M01]; // c
+ float a11 = iComponents[M11]; // d
+ float a02 = iComponents[M02]; // e
+ float a12 = iComponents[M12]; // f
+ iComponents[M00] = (a00 * b.iComponents[M00]) + (a01 * b.iComponents[M10]); // a
+ iComponents[M10] = (a10 * b.iComponents[M00]) + (a11 * b.iComponents[M10]); // b
+ iComponents[M01] = (a00 * b.iComponents[M01]) + (a01 * b.iComponents[M11]); // c
+ iComponents[M11] = (a10 * b.iComponents[M01]) + (a11 * b.iComponents[M11]); // d
+ iComponents[M02] = (a00 * b.iComponents[M02]) + (a01 * b.iComponents[M12]) + a02; // e
+ iComponents[M12] = (a10 * b.iComponents[M02]) + (a11 * b.iComponents[M12]) + a12; // f
+ return this;
+ }
+
+ /**
+ * The rotation is calculated as:
+ * <pre>
+ * [ cos(angle) -sin(angle) 0 ]
+ * [this] x [ sin(angle) cos(angle) 0 ]
+ * [ 0 0 1 ]
+ * </pre>
+ * @see org.w3c.dom.svg.SVGMatrix#mRotate()
+ */
+ public SVGMatrix mRotate(float angle)
+ {
+ if (angle % 360 == 0)
+ {
+ return this;
+ }
+ // must convert degrees to radians since java.lang.Math expects radians
+ angle = angle * (float)Math.PI / 180.0f;
+ float c = (float)Math.cos(angle);
+ float s = (float)Math.sin(angle);
+ float m00 = iComponents[M00];
+ float m10 = iComponents[M10];
+ float m01 = iComponents[M01];
+ float m11 = iComponents[M11];
+ iComponents[M00] = m00 * c + m01 * s;
+ iComponents[M10] = m10 * c + m11 * s;
+ iComponents[M01] = m01 * c - m00 * s;
+ iComponents[M11] = m11 * c - m10 * s;
+ return this;
+ }
+
+ /**
+ * The multiply is calculated as:
+ * <pre>
+ * [m00 m01 m02] [scaleFactor 0 0]
+ * this=[m10 m11 m12] B=[ 0 scaleFactor 0]
+ * [ 0 0 1 ] [ 0 0 1]
+ *
+ * [(a00*scaleFactor) (a01*scaleFactor) a02]
+ * [this] = [this]x[B] = [(a10*scaleFactor) (a11*scaleFactor) a12]
+ * [ 0 0 1 ]
+ * </pre>
+ * @see org.w3c.dom.svg.SVGMatrix#mScale()
+ */
+ public SVGMatrix mScale(float scaleFactor)
+ {
+ if (scaleFactor == 1)
+ {
+ return this;
+ }
+ iComponents[M00] *= scaleFactor;
+ iComponents[M01] *= scaleFactor;
+ iComponents[M10] *= scaleFactor;
+ iComponents[M11] *= scaleFactor;
+ return this;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGMatrix#mTranslate()
+ */
+ public SVGMatrix mTranslate(float x, float y)
+ {
+ if (x == 0 && y == 0)
+ {
+ return this;
+ }
+ iComponents[M02] += (iComponents[M00] * x) + (iComponents[M01] * y);
+ iComponents[M12] += (iComponents[M10] * x) + (iComponents[M11] * y);
+ return this;
+ }
+
+ /**
+ * To string
+ */
+ static String toString(float aComponents[])
+ {
+ if ((aComponents == null) || (M2GSVGMatrix.ARRAY_SIZE != aComponents.length))
+ {
+ return "";
+ }
+ StringBuffer buf = new StringBuffer();
+ buf.append("[00]:").append(aComponents[M00]).append(", [10]:").append(aComponents[M10]);
+ buf.append(", [01]:").append(aComponents[M01]).append(", [11]:").append(aComponents[M11]);
+ buf.append(", [02]:").append(aComponents[M02]).append(", [12]:").append(aComponents[M12]);
+ return buf.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGPath.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+import org.w3c.dom.DOMException;
+import java.io.IOException;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * This interface represents an "SVGPath" datatype used to define the path geometry.
+ * Corresponds to SVG path specification or the "d" attribute.
+ */
+public class M2GSVGPath extends M2GObject implements SVGPath
+{
+ //--------------------------------------------------
+ // STATIC CONTANTS
+ //--------------------------------------------------
+ /* Optimization: static finals changed to local variables
+ private static final String SEGMENT_INDEX_SIZE_ESTR =
+ "The segment index is out of bounds.";
+ private static final String PARAMETER_INDEX_SIZE_ESTR =
+ "The parameter index is out of bounds for this segment's type.";
+ */
+ private static final int CLOSE_PARAMETER_COUNT = 0;
+ private static final int MOVE_TO_PARAMETER_COUNT = 2;
+ private static final int LINE_TO_PARAMETER_COUNT = 2;
+ private static final int CURVE_TO_PARAMETER_COUNT = 6;
+ private static final int QUAD_TO_PARAMETER_COUNT = 4;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * Constructor
+ * @param aHandle - native path object handle
+ * @param aDoCleanup - true if the native object needed to be deleted
+ */
+ protected M2GSVGPath(int aHandle)
+ {
+ super();
+ setHandle(aHandle);
+ doConstruct();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCheckValidity()
+ */
+ public boolean doCheckValidity()
+ {
+ // SVGPath is invalid if it begins with any segment other
+ // than MOVE_TO segment. Note that an empty SVGPath is still a valid value.
+ try
+ {
+ if (!super.doCheckValidity() ||
+ ((getNumberOfSegments() != 0) && (getSegment(0) != MOVE_TO)))
+ {
+ return false;
+ }
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
+ */
+ protected void doCleanup()
+ {
+ _destroyPath(getNativeSVGProxyHandle(),
+ getHandle());
+ resetHandles();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
+ */
+ protected void doConstruct()
+ {
+ super.doConstruct();
+ register(this);
+ }
+
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#getNumberOfSegments()
+ */
+ public int getNumberOfSegments()
+ {
+ return _getNumberOfSegments(getNativeSVGProxyHandle(),
+ getHandle() );
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#getSegment()
+ */
+ public short getSegment(int index) throws DOMException
+ {
+ if ((index < 0) ||
+ (index >= getNumberOfSegments()))
+ {
+ Logger.ELOG(Logger.EJavaUI, "getSegment() - exception:"
+ + /*SF*/"The segment index is out of bounds."/*SF*/);
+ throw new DOMException(
+ DOMException.INDEX_SIZE_ERR,
+ /*SF*/"The segment index is out of bounds."/*SF*/);
+ }
+ return M2GSVGConstants.parsePathCommand(
+ _getSegmentType(getNativeSVGProxyHandle(),
+ getHandle(),
+ index)
+ );
+ }
+
+ /**
+ * Checks that parameter index is valid
+ * @param aCommand -
+ * @param aParameterIndex -
+ */
+ protected void checkParameterIndex(int aCommand, int aParameterIndex) throws DOMException
+ {
+ if ((aCommand == CLOSE && aParameterIndex >= CLOSE_PARAMETER_COUNT) ||
+ (aCommand == MOVE_TO && aParameterIndex >= MOVE_TO_PARAMETER_COUNT)
+ || (aCommand == LINE_TO && aParameterIndex >= LINE_TO_PARAMETER_COUNT)
+ || (aCommand == CURVE_TO && aParameterIndex >= CURVE_TO_PARAMETER_COUNT)
+ || (aCommand == QUAD_TO && aParameterIndex >= QUAD_TO_PARAMETER_COUNT))
+ {
+ throw new DOMException(
+ DOMException.INDEX_SIZE_ERR,
+ /*SF*/"The parameter index is out of bounds for this segment's type."/*SF*/);
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#close()
+ */
+ public void close()
+ {
+ _addClose(getNativeSVGProxyHandle(), getHandle());
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#curveTo()
+ */
+ public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
+ {
+ _addCurveTo(getNativeSVGProxyHandle(),
+ getHandle(), x1, y1, x2, y2, x3, y3);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#getSegmentParam()
+ */
+ public float getSegmentParam(int cmdIndex, int paramIndex)
+ {
+ if ((cmdIndex >= getNumberOfSegments()) ||
+ (cmdIndex < 0) ||
+ (paramIndex < 0))
+ {
+ Logger.ELOG(Logger.EJavaUI, "getSegmentParam() - end, exception:"
+ + /*SF*/"The segment index is out of bounds."/*SF*/);
+ throw new DOMException(
+ DOMException.INDEX_SIZE_ERR,
+ /*SF*/"The segment index is out of bounds."/*SF*/);
+ }
+ short command = getSegment(cmdIndex);
+ // Checks the validity of the parameter index.
+ checkParameterIndex(command, paramIndex);
+ return _getSegmentParameter(getNativeSVGProxyHandle(),
+ getHandle(),
+ cmdIndex,
+ paramIndex
+ );
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#lineTo()
+ */
+ public void lineTo(float x, float y)
+ {
+ _addLineTo(getNativeSVGProxyHandle(), getHandle(), x, y);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#moveTo()
+ */
+ public void moveTo(float x, float y)
+ {
+ _addMoveTo(getNativeSVGProxyHandle(), getHandle(), x, y );
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#quadTo()
+ */
+ public void quadTo(float x1, float y1, float x2, float y2)
+ {
+ _addQuadTo(getNativeSVGProxyHandle(),
+ getHandle(),
+ x1,
+ y1,
+ x2,
+ y2 );
+ }
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private static native void _addClose(
+ int aSVGProxyHandle, int aPathHandle);
+
+ private static native void _addCurveTo(
+ int aSVGProxyHandle, int aPathHandle,
+ float aX1, float aY1, float aX2, float aY2, float aX3, float aY3);
+
+ private static native void _addLineTo(
+ int aSVGProxyHandle, int aPathHandle, float aX, float aY);
+
+ private static native void _addMoveTo(
+ int aSVGProxyHandle, int aPathHandle, float aX, float aY);
+
+ private static native void _addQuadTo(
+ int aSVGProxyHandle, int aPathHandle,
+ float aX1, float aY1, float aX2, float aY2);
+
+ static native int _createPath(
+ int aSVGProxyHandle);
+
+ private static native void _destroyPath(
+ int aSVGProxyHandle, int aPathHandle);
+
+ private static native int _getNumberOfSegments(
+ int aSVGProxyHandle, int aPathHandle);
+
+ private static native float _getSegmentParameter(
+ int aSVGProxyHandle, int aPathHandle, int aCmdIndex, int aParamIndex);
+
+ private static native short _getSegmentType(
+ int aSVGProxyHandle, int aPathHandle, int aIndex);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGPoint.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+
+/**
+ * This interface represents an "SVGPoint" datatype,
+ * identified by its x and y components.
+ */
+public class M2GSVGPoint implements SVGPoint
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GSVGSVGElement iElement;
+ private float iX;
+ private float iY;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aRootElement
+ */
+ protected M2GSVGPoint(M2GSVGSVGElement aElement)
+ {
+ iElement = aElement;
+ iX = 0;
+ iY = 0;
+ }
+
+ /**
+ * Check set validity
+ * @param aValue Value
+ * @return true if setting can be done
+ */
+ protected boolean check(float aValue)
+ {
+ if (Float.isNaN(aValue))
+ {
+ // throw IllegalArgumentException();
+ return false;
+ }
+ if (iElement != null)
+ {
+ String zoomAndPan = iElement.getTrait("zoomAndPan");
+ if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#getX()
+ */
+ public float getX()
+ {
+ synchronized (this)
+ {
+ return iX;
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#getX()
+ */
+ public float getY()
+ {
+ synchronized (this)
+ {
+ return iY;
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#setX()
+ */
+ public void setX(float value)
+ {
+ synchronized (this)
+ {
+ if (check(value))
+ {
+ iX = value;
+ if (iElement != null)
+ {
+ iElement.updateTransformMatrix();
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGPath#setY()
+ */
+ public void setY(float value)
+ {
+ synchronized (this)
+ {
+ if (check(value))
+ {
+ iY = value;
+ if (iElement != null)
+ {
+ iElement.updateTransformMatrix();
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGRGBColor.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+
+public class M2GSVGRGBColor implements SVGRGBColor
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ private static final int R = 0;
+ private static final int G = 1;
+ private static final int B = 2;
+ // Exception text
+ private static final String OUT_OF_RANGE_ESTR =
+ "Color values out of range.";
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private int[] iComponents;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * Constructor. Defualt color is black.
+ v */
+ public M2GSVGRGBColor()
+ {
+ iComponents = new int[3];
+ iComponents[R] = 0;
+ iComponents[G] = 0;
+ iComponents[B] = 0;
+ }
+
+ /**
+ * Constructor
+ * @param aR -
+ v * @param aG -
+ v * @param aB -
+ v */
+ public M2GSVGRGBColor(int aR, int aG, int aB) throws SVGException
+ {
+ checkValues(aR, aG, aB);
+ iComponents = new int[3];
+ iComponents[R] = aR;
+ iComponents[G] = aG;
+ iComponents[B] = aB;
+ }
+
+ /**
+ * Checks value range
+ * @param aR
+ * @param aG
+ * @param aB
+ */
+ protected void checkValues(int aR, int aG, int aB) throws SVGException
+ {
+ if (((aR > 255) || (aR < 0)) ||
+ ((aG > 255) || (aG < 0)) ||
+ ((aB > 255) || (aB < 0)))
+ {
+ throw new SVGException(
+ SVGException.SVG_INVALID_VALUE_ERR, OUT_OF_RANGE_ESTR);
+ }
+ }
+
+ /**
+ * Gets components
+ * @return components
+ */
+ int[] getComponents()
+ {
+ return iComponents;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRGBColor#getRed()
+ */
+ public int getRed()
+ {
+ return iComponents[R];
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRGBColor#getGreen()
+ */
+ public int getGreen()
+ {
+ return iComponents[G];
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRGBColor#getBlue()
+ */
+ public int getBlue()
+ {
+ return iComponents[B];
+ }
+
+ public String toString()
+ {
+ return "SVGRGBColor( r = " + iComponents[R] + ", g = " +
+ iComponents[G] + ", b = " + iComponents[B] + " )";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGRect.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.svg.*;
+
+/**
+ * This interface represents an "SVGRect" datatype, consisting of a minimum X, minimum Y, width
+ * and height values.
+ */
+public class M2GSVGRect implements SVGRect
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ private static final int X = 0;
+ private static final int Y = 1;
+ private static final int W = 2;
+ private static final int H = 3;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private float[] iComponents;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Contructor
+ */
+ protected M2GSVGRect()
+ {
+ iComponents = new float[4];
+ iComponents[X] = 0;
+ iComponents[Y] = 0;
+ iComponents[W] = 0;
+ iComponents[H] = 0;
+ }
+
+ /**
+ * Contructor
+ * @param aX -
+ * @param aY -
+ * @param aWidth -
+ * @param aHeight -
+ */
+ protected M2GSVGRect(float aX, float aY, float aWidth, float aHeight)
+ {
+ iComponents = new float[4];
+ iComponents[X] = aX;
+ iComponents[Y] = aY;
+ iComponents[W] = aWidth;
+ iComponents[H] = aHeight;
+ }
+
+ /**
+ * Returns reference to a components
+ * @return components
+ */
+ float[] getComponents()
+ {
+ return iComponents;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#getX()
+ */
+ public float getX()
+ {
+ return iComponents[X];
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#getY()
+ */
+ public float getY()
+ {
+ return iComponents[Y];
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#getWidth()
+ */
+ public float getWidth()
+ {
+ return iComponents[W];
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#getHeight()
+ */
+ public float getHeight()
+ {
+ return iComponents[H];
+ }
+
+ /**
+ * Checks if all components are zero
+ * @returns true is every component is zero
+ */
+ public boolean isZero()
+ {
+ for (int index = 0; index < iComponents.length; index++)
+ {
+ if (iComponents[index] != 0)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#setX()
+ */
+ public void setX(float value)
+ {
+ iComponents[X] = value;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#setY()
+ */
+ public void setY(float value)
+ {
+ iComponents[Y] = value;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#setWidth()
+ */
+ public void setWidth(float value)
+ {
+ iComponents[W] = value;
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGRect#setHeight()
+ */
+ public void setHeight(float value)
+ {
+ iComponents[H] = value;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGSVGElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,406 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import org.w3c.dom.*;
+import org.w3c.dom.svg.*;
+import java.io.IOException;
+import com.nokia.mj.impl.utils.Logger;
+
+public class M2GSVGSVGElement extends M2GSVGLocatableElement implements SVGSVGElement
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ /* Optimization: static finals changed to local variables
+ public static final String INVALID_SVG_VERSION_ESTR =
+ "Invalid version.";
+ public static final String INVALID_SVG_BASE_PROFILE_ESTR =
+ "Invalid base profile.";
+ */
+
+ //------------------------------------------------------------------
+ // VARIABLES
+ //------------------------------------------------------------------
+ // Exception text
+ public static final String SCALE_BY_ZERO =
+ "Cannot scale by 0.";
+
+ //------------------------------------------------------------------
+ // VARIABLES
+ //------------------------------------------------------------------
+ private Object iTimeGuard;
+ private M2GSVGMatrix iMatrix;
+ private M2GSVGPoint iCurrentTranslatePoint;
+ private float iCurrentRotate;
+ private float iCurrentScale;
+ private float iCurrentTimeInSeconds;
+
+ //------------------------------------------------------------------
+ // METHODS
+ //------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param aHandle -
+ * @param aDocument -
+ */
+ protected M2GSVGSVGElement(int aHandle, M2GDocument aDocument)
+ {
+ super(aHandle, aDocument);
+ iTimeGuard = new Object();
+ iMatrix = (M2GSVGMatrix)createSVGMatrixComponents(1f, 0f, 0f, 1f, 0f, 0f);
+ iCurrentTranslatePoint = new M2GSVGPoint(this);
+ iCurrentRotate = 0.0f;
+ iCurrentScale = 1.0f;
+ iCurrentTimeInSeconds = 0.0f;
+ refreshMatrix();
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGSVGElement#createSVGMatrixComponents()
+ */
+ public SVGMatrix createSVGMatrixComponents(
+ float a, float b, float c, float d, float e, float f)
+ {
+ return new M2GSVGMatrix(a, b, c, d, e, f);
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGSVGElement#createSVGMatrixComponents()
+ */
+ public SVGPath createSVGPath()
+ {
+ return new M2GSVGPath(
+ M2GSVGPath._createPath(getNativeSVGProxyHandle()));
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGSVGElement#createSVGRect()
+ */
+ public SVGRect createSVGRect()
+ {
+ return new M2GSVGRect();
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGSVGElement#SVGRGBColor()
+ */
+ public SVGRGBColor createSVGRGBColor(int red, int green, int blue)
+ {
+ return new M2GSVGRGBColor(red, green, blue);
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
+ */
+ protected void doCleanup()
+ {
+ // Note this method is not automatically called if
+ // doConstruct() method is not first called
+ super.doCleanup();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#getCurrentRotate()
+ */
+ public float getCurrentRotate()
+ {
+ synchronized (this)
+ {
+ return iCurrentRotate;
+ }
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#getCurrentScale()
+ */
+ public float getCurrentScale()
+ {
+ synchronized (this)
+ {
+ return iCurrentScale;
+ }
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#getCurrentTime()
+ */
+ public float getCurrentTime()
+ {
+ synchronized (iTimeGuard)
+ {
+ return iCurrentTimeInSeconds;
+ }
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#getCurrentTranslate()
+ */
+ public SVGPoint getCurrentTranslate()
+ {
+ return iCurrentTranslatePoint;
+ }
+
+ /**
+ * @org.w3c.dom.Node#getParentNode()
+ */
+ public Node getParentNode()
+ {
+ // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
+ if (!iDocument.iConnectionRight)
+ {
+ Logger.ELOG(Logger.EJavaUI, "getParentNode() - access rights failure");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ return null;
+ }
+
+ /**
+ * Check svg version and base profile
+ * @throws IOException If version or profile is invalid
+ */
+ public void checkVersionAndProfile() throws IOException
+ {
+ // Check version
+ String trait = _getStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ M2GSVGConstants.AT_VERSION);
+ if (trait != null && (!trait.equals(
+ M2GSVGConstants.getInstance().iSvgBaseProfileVersion)))
+ {
+ Logger.ELOG(Logger.EJavaUI, "doCheckValidity() - excption: svg version");
+ throw new IOException(/*SF*/"Invalid version."/*SF*/);
+ }
+ // Check profile
+ trait = _getStringTrait(
+ getNativeSVGProxyHandle(),
+ getHandle(),
+ M2GSVGConstants.AT_BASEPROFILE);
+ if (trait != null && (!trait.equals(
+ M2GSVGConstants.getInstance().iSvgBaseProfileName)))
+ {
+ Logger.ELOG(Logger.EJavaUI, "doCheckValidity() - excption: svg base profile");
+ throw new IOException(/*SF*/"Invalid base profile."/*SF*/);
+ }
+ }
+
+ /**
+ * @javax.microedition.m2g.SVGImage#incrementTime()
+ */
+ public void incrementTime(float seconds)
+ {
+ incrementTimeNoUpdate(seconds);
+ // update the media time to SVG engine
+ updateTime();
+ }
+
+ /**
+ * Increments the animation or media timeline for this SVGImage (in seconds)
+ * but it does not update it to the SVG engine
+ *
+ * @note the time is updated to the engine during M2GScalableGraphics.RenderFrame()
+ * @param seconds the value of time to increment in seconds
+ *
+ * @since S60 3.1
+ */
+ public void incrementTimeNoUpdate(float seconds)
+ {
+ if (seconds < 0)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (Float.isNaN(iCurrentTimeInSeconds + seconds))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ synchronized (iTimeGuard)
+ {
+ iCurrentTimeInSeconds += seconds;
+ }
+ }
+
+ /**
+ * Sets matrix trait
+ */
+ protected void refreshMatrix()
+ {
+ float matrixComponents[] = new float[M2GSVGMatrix.ARRAY_SIZE];
+
+ synchronized (this)
+ {
+ iMatrix.getComponentsToArray(matrixComponents);
+ }
+
+ M2GSVGElement._setMatrixTrait(
+ getNativeSVGProxyHandle(), getHandle(),
+ M2GSVGConstants.AT_TRANSFORM, matrixComponents);
+
+ // inform observer about changes in DOM
+ iDocument.notifyDOMChangeObserver();
+ }
+
+ /**
+ * Updates the time to engine
+ */
+ private void updateTime()
+ {
+ float currentTimeInSeconds = 0.0f;
+
+ synchronized (iTimeGuard)
+ {
+ currentTimeInSeconds = iCurrentTimeInSeconds;
+ }
+
+ _setMediaTime(getNativeSVGProxyHandle(),
+ getDocument().getHandle(), currentTimeInSeconds);
+
+ // inform observer about changes in DOM
+ iDocument.notifyDOMChangeObserver();
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#setCurrentRotate()
+ */
+ public void setCurrentRotate(float value)
+ {
+ String zoomAndPan = getTrait("zoomAndPan");
+ if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setCurrentRotate() - zoomAndPan:" + zoomAndPan + ", fail");
+ return;
+ }
+ synchronized (this)
+ {
+ iCurrentRotate = value;
+ updateTransformMatrix();
+ }
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#setCurrentScale()
+ */
+ public void setCurrentScale(float value)
+ {
+ String zoomAndPan = getTrait("zoomAndPan");
+ if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "setCurrentScale() - zoomAndPan:" + zoomAndPan + ", fail");
+ return;
+ }
+ if (value == 0)
+ {
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, SCALE_BY_ZERO);
+ }
+ synchronized (this)
+ {
+ iCurrentScale = value;
+ updateTransformMatrix();
+ }
+ }
+
+ /**
+ * @see org.w3c.dom.svg.SVGSVGElement#setCurrentTime()
+ * @note no support for setting the time backwards except for setting it to zero
+ * @note engine resets the animation if current time is zero
+ */
+ public void setCurrentTime(float newSeconds)
+ {
+ synchronized (iTimeGuard)
+ {
+ if (newSeconds <= iCurrentTimeInSeconds && newSeconds != 0)
+ {
+ // only forward time or zero time is accepted
+ return;
+ }
+
+ iCurrentTimeInSeconds = newSeconds;
+ }
+
+ updateTime();
+ }
+
+ /**
+ * <pre>
+ * [currentScale 0 currentTranslate.x] [cos(currentRotate) -sin(currentRotate 0]
+ * [ 0 currentScale currentTranslate.y] x [sin(currentRotate) cos(currentRotate) 0]
+ * [ 0 0 1 ] [ 0 0 1]
+ * </pre>
+ */
+ public void updateTransformMatrix()
+ {
+ synchronized (this)
+ {
+ M2GSVGMatrix a = new M2GSVGMatrix(
+ iCurrentScale, 0f, 0f, iCurrentScale,
+ iCurrentTranslatePoint.getX(), iCurrentTranslatePoint.getY());
+ M2GSVGMatrix b = new M2GSVGMatrix(
+ (float)Math.cos(iCurrentRotate *(float)Math.PI / 180.0f),
+ (float)Math.sin(iCurrentRotate *(float)Math.PI / 180.0f),
+ -(float)Math.sin(iCurrentRotate *(float)Math.PI / 180.0f),
+ (float)Math.cos(iCurrentRotate *(float)Math.PI / 180.0f),
+ 0f, 0f);
+ iMatrix = (M2GSVGMatrix)(a.mMultiply(b));
+ refreshMatrix();
+ }
+ }
+
+ //------------------------------------------------------------------
+ // STATIC METHODS
+ //------------------------------------------------------------------
+ /**
+ * Builds root element according to a document
+ * @param aDocument
+ * @return root element
+ */
+ public static M2GSVGSVGElement buildRootElement(M2GDocument aDocument)
+ {
+ // Get native handle
+ int elementHandle = M2GSVGElement._getRootElement(
+ aDocument.getNativeSVGProxyHandle(),
+ aDocument.getHandle());
+ // Check native handle
+ if (!M2GObject.checkHandle(elementHandle))
+ {
+ return null;
+ }
+ // Create object
+ M2GSVGSVGElement rootElement =
+ new M2GSVGSVGElement(elementHandle, aDocument);
+ if (rootElement != null)
+ {
+ // Register element
+ aDocument.registerLiveElement(rootElement, new Integer(elementHandle));
+ }
+ return rootElement;
+ }
+
+ //------------------------------------------------------------------
+ // NATIVE METHODS
+ //------------------------------------------------------------------
+ protected native static float _getMediaTime(
+ int aSvgProxyHandle, int aDocumentHandle);
+ private native static void _setMediaTime(
+ int aSvgProxyHandle, int aDocumentHandle,
+ float aSeconds );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGeSWTAnimator.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,261 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g;
+
+import javax.microedition.m2g.*;
+import org.eclipse.swt.widgets.SVGAnimatorControl;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.utils.Logger;
+
+public class M2GSVGeSWTAnimator extends SVGAnimator
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ private static final String ANIMATOR_CONTROL_BASE_CLASS =
+ "org.eclipse.swt.widgets.Canvas";
+
+ // Exception text
+ /* Optimization: static finals changed to local variables
+ private static final String COMPONENT_BASE_CLASS_NOT_SUPPORTED_ESTR =
+ "The requested componentBaseClass is not supported by the implementation.";
+ private static final String ILLEGAL_TIME_INCREMENT_ESTR =
+ "The timeIncrement is less than or equal to zero.";
+ private static final String ANIMATOR_PLAY_ESTR =
+ "The animator is not currently in the stopped or paused state.";
+ private static final String ANIMATOR_PAUSE_ESTR =
+ "The animator is not in the playing state.";
+ private static final String ANIMATOR_STOP_ESTR =
+ "The animator is not in the playing or paused state.";
+ private static final String INVALID_RUNNABLE_ESTR =
+ "The runnable is null.";
+ private static final String ANIMATOR_IS_STOPPED_ESTR =
+ "The animator is in the stopped state.";
+ private static final String RUNNABLE_IS_NULL_ESTR =
+ "The runnable is null.";
+ private static final String ANIMATOR_INVOKE_ESTR =
+ "The animator is in the stopped state.";
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private SVGAnimatorControl iAnimatorControl;
+
+ private Finalizer mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ * @param aImage
+ */
+ protected M2GSVGeSWTAnimator(SVGImage aImage)
+ {
+ iAnimatorControl = new SVGAnimatorControl(/*false,*/ aImage);
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTargetComponent()
+ */
+ public Object getTargetComponent()
+ {
+ return iAnimatorControl;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
+ */
+ public float getTimeIncrement()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getTimeIncrement() " + iAnimatorControl.getTimeIncrement());
+ return iAnimatorControl.getTimeIncrement();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#invokeAndWait()
+ */
+ public void invokeAndWait(java.lang.Runnable runnable)
+ {
+ if (runnable == null)
+ {
+ throw new NullPointerException(
+ /*SF*/"The runnable is null."/*SF*/);
+ }
+ if (iAnimatorControl.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is in the stopped state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeAndWait()");
+
+ runnable.run();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#invokeLater()
+ */
+ public void invokeLater(java.lang.Runnable runnable)
+ {
+ if (runnable == null)
+ {
+ throw new NullPointerException(
+ /*SF*/"The runnable is null."/*SF*/);
+ }
+ if (iAnimatorControl.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is in the stopped state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeLater()");
+ Thread thread = new Thread(runnable);
+ thread.start();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#pause()
+ */
+ public void pause()
+ {
+ if (!iAnimatorControl.isPlaying())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not in the playing or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
+ iAnimatorControl.pause();
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#play()
+ */
+ public void play()
+ {
+ if (iAnimatorControl.isPlaying())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not currently in the stopped or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
+ iAnimatorControl.play();
+ }
+
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ /**
+ * Finalize
+ */
+ synchronized void registeredFinalize()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "registeredFinalize()");
+ iAnimatorControl = null;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
+ */
+ public void setSVGEventListener(SVGEventListener svgEventListener)
+ {
+ iAnimatorControl.setEventListener(svgEventListener);
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
+ */
+ public void setTimeIncrement(float timeIncrement)
+ {
+ if (timeIncrement <= 0)
+ {
+ throw new IllegalArgumentException(
+ /*SF*/"The time increment is less than or equal to zero."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - " + timeIncrement);
+ iAnimatorControl.setTimeIncrement(timeIncrement);
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#stop()
+ */
+ public void stop()
+ {
+ if (iAnimatorControl.isStopped())
+ {
+ throw new IllegalStateException(
+ /*SF*/"The animator is not in the playing or paused state."/*SF*/);
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
+ iAnimatorControl.stop();
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /**
+ * Builds animator
+ * @param svgImage -
+ * @return SVGAnimator
+ * @see javax.microedition.m2g.SVGAnimator#createAnimator()
+ */
+ public static SVGAnimator buildAnimator(SVGImage svgImage)
+ {
+ if (svgImage == null)
+ {
+ throw new NullPointerException();
+ }
+ return new M2GSVGeSWTAnimator(svgImage);
+ }
+
+ /**
+ * Builds animator
+ * @param svgImage -
+ * @param componentBaseClass -
+ * @return SVGAnimator
+ * @see javax.microedition.m2g.SVGAnimator#createAnimator()
+ */
+ public static SVGAnimator buildAnimator(
+ SVGImage svgImage, String componentBaseClass)
+ {
+ if (svgImage == null)
+ {
+ throw new NullPointerException();
+ }
+ if ((componentBaseClass != null) &&
+ (!componentBaseClass.equals(ANIMATOR_CONTROL_BASE_CLASS)))
+ {
+ throw new IllegalArgumentException(
+ /*SF*/"The requested componentBaseClass is not supported by the implementation."/*SF*/);
+ }
+
+ return buildAnimator(svgImage);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import com.nokia.microedition.m2g.M2GRunnableQt;
+import javax.microedition.m2g.*;
+import javax.microedition.m2g.ScalableGraphics;
+import javax.microedition.lcdui.Graphics;
+import java.lang.StringBuffer;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import com.nokia.mj.impl.utils.Logger;
+import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
+import org.eclipse.swt.internal.qt.GCData;
+import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
+
+
+/*
+ * ScalableGraphics
+ */
+public class M2GScalableGraphics
+ extends M2GObject
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ // Exception text
+ /* Optimization: static finals changed to local variables
+ private static final String ALPHA_OUT_OF_RANGE_ESTR =
+ "The alpha is out of range";
+ private static final String INVALID_TARGET_ESTR =
+ "The target is invalid";
+ private static final String MODE_INVALID_ESTR =
+ "The mode is invalid";
+ private static final String NULL_IMAGE_ESTR =
+ "The image is null";
+ private static final String NULL_TARGET_ESTR =
+ "The target is null";
+ private static final String TARGET_ALREADY_BOUND_ESTR =
+ "Target is already bound";
+ private static final String TARGET_NOT_BOUND_ESTR =
+ "Target is not bound";
+ */
+ // Transparency alpha max and min limits
+ private static final float MAX_TRANSPARENCY_ALPHA = 1.0f;
+ private static final float MIN_TRANSPARENCY_ALPHA = 0.0f;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private GC iTargetGC = null;
+ private int iUseNativeClear = 0;
+ private Graphics iTargetGraphics;
+
+ int iSurfaceHandle;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Constructor
+ */
+ public M2GScalableGraphics()
+ {
+ super();
+ System.out.println("P-Constructor M2GScalableGraphics() called");
+ doConstruct();
+ }
+ /**
+ * @see javax.microedition.m2g.ScalableGraphics#bindTarget()
+ */
+ public synchronized void bindTarget(Object target)
+ {
+ System.out.println("P-Bind Target called");
+ if (target instanceof org.eclipse.swt.graphics.GC)
+ {
+ final Object finalTarget = target;
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ System.out.println("P-Bind Target Thread called");
+ // Get GCData from GC
+ GCData gcData = ((org.eclipse.swt.graphics.GC)finalTarget).getGCData();
+ System.out.println("P-Bind GCData Create");
+ // Get internalGC (Graphicscontext), WindowSurface and the WindowSurface handle for native access
+ iSurfaceHandle = gcData.internalGc.getWindowSurface().getHandle();
+ System.out.println("P-Bind isurfacehandle Created " );
+ _bind(getHandle(), iSurfaceHandle);
+ }
+ });
+ // currentTarget = target;
+ //We are mentaining seperate current Target as iTargetGC and iTargetGraphics
+ iTargetGC = (GC)finalTarget;
+ // Handling for LCDUI Graphics
+ //
+ }
+//Change accordingly to M3G not as site content.
+ else if (target instanceof javax.microedition.lcdui.Graphics)
+ {
+ Graphics g = (Graphics)target;
+
+ final Graphics finalG = g;
+
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ System.out.println("P-Bind Graphics Case" );
+ LCDUIInvoker.startExternalRendering( finalG );
+ System.out.println("P-Bind Invoker External rengdering Set Case" );
+ iSurfaceHandle = LCDUIInvoker.getWindowSurface(finalG).getHandle();
+ System.out.println("P-Bind Invoker External rengdering Set Bind called. Case" );
+ _bind(getHandle(), iSurfaceHandle);
+
+ }
+ });
+
+ iTargetGraphics = (Graphics)finalG;
+ }
+
+ else {
+ throw new IllegalArgumentException();
+ }
+
+ }
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
+ */
+ public void doConstruct()
+ {
+ super.doConstruct();
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ setHandle(_createRenderContext(
+ getNativeSVGProxyHandle() ));
+ // Add object to the live objects container
+ }
+ });
+ register(this);
+ }
+
+ /**
+ * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
+ */
+ public synchronized void doCleanup()
+ {
+
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _deleteRenderContext(
+ getHandle() );
+ }
+ }
+ );
+ resetHandles();
+ iTargetGC = null;
+ iTargetGraphics = null;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableGraphics#releaseTarget()
+ */
+ public synchronized void releaseTarget()
+ {
+ System.out.println("P-In Release Target" );
+ if (iTargetGC != null)
+ {
+ System.out.println("P-In Release Target graphics.GC" );
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _release(iSurfaceHandle, getHandle());
+ }
+ });
+ iTargetGC = null;
+ }
+ else if (iTargetGraphics != null )
+ {
+
+ System.out.println("P-In Release Target M2GScalableGraphics.. everything is fine... thread complete...." );
+ final Graphics finalG = iTargetGraphics;
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _release(iSurfaceHandle, getHandle());
+ LCDUIInvoker.endExternalRendering( finalG );
+ }
+ });
+ System.out.println("P-In Release Target Thread Completed..." );
+ iTargetGraphics = null;
+ }
+ else
+ {
+ System.out.println("P-In Release Target else case.." );
+ // check for invalid Graphics TODO this exception is getting trough when we trying to bind.s
+
+ // throw new IllegalStateException(/*SF*/"Target is not bound"/*SF*/);
+ }
+
+ }
+ public synchronized void render(
+ int x, int y, ScalableImage image, boolean aUseNativeClear)
+ {
+ System.out.println("P-In Render M2GScalableGraphics.. erender(int x, int y, ScalableImage image, boolean aUseNativeClear)" );
+
+ iUseNativeClear = aUseNativeClear ? 1 : 0;
+ render(x, y, image);
+ iUseNativeClear = 0;
+
+ System.out.println("P-Out Render M2GScalableGraphics.. erender(int x, int y, ScalableImage image, boolean aUseNativeClear)" );
+
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableGraphics#render()
+ */
+ public synchronized void render(int x, int y, ScalableImage image)
+ {
+ System.out.println("P-In Render M2GScalableGraphics.." );
+ if (image == null)
+ {
+ Logger.ELOG(Logger.EJavaUI, "render() - exception: "
+ + /*SF*/"The target is null"/*SF*/);
+ throw new NullPointerException(/*SF*/"The target is null"/*SF*/);
+ }
+ if (iTargetGC != null)
+ {
+ final M2GDocument finalDoc = (M2GDocument)((SVGImage)image).getDocument();
+ // Get synchronized svg image data
+ final int finalSvgW = image.getViewportWidth();
+ final int finalSvgH = image.getViewportHeight();
+ if ((finalSvgW == 0) || (finalSvgW == 0))
+ {
+ return;
+ }
+ // Calculate clip dimensions
+ Rectangle clipRect = iTargetGC.getClipping();
+ final int finalClipX = clipRect.x;
+ final int finalClipY = clipRect.y;
+ final int finalClipW = clipRect.width;
+ final int finalClipH = clipRect.height;
+
+ // if none of the svg image is visible due to clipping then don't
+ // bother to call render
+ if ((x >= (finalClipX + finalClipW)) || (y >= (finalClipY + finalClipH)))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "render() - svg image isn't visible due to clipping");
+ return;
+ }
+ if (((x + finalSvgW) < finalClipX) || ((y + finalSvgW) < finalClipY))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "render() - svg image isn't visible due to clipping");
+ return;
+ }
+
+
+ final int finalX = x;
+ final int finalY = y;
+
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ final int[] finalData = _renderESWT(getHandle(),
+ finalDoc.getHandle(), finalX, finalY,
+ finalClipX, finalClipY, finalClipW, finalClipH, finalSvgW, finalSvgW,
+ finalDoc.getRootElement().getCurrentTime(),
+ iUseNativeClear);
+
+ int[] bitmapHandles;
+ bitmapHandles = new int[4];
+ for (int i = 0; i < 4; i++)
+ {
+ bitmapHandles[i] = finalData[i];
+ }
+ int[] renderData;
+ renderData = new int[6];
+ for (int i = 0; i < 6; i++)
+ {
+ renderData[i] = finalData[i+4];
+ }
+ //iTargetGC.internal_drawM2GImage(bitmapHandles, renderData, iUseNativeClear);
+
+ }});
+
+ }//if(true)
+ else if (iTargetGraphics != null)
+ {
+
+ System.out.println("P-In Render M2GScalableGraphics.. else case..." );
+ final M2GDocument finalDoc = (M2GDocument)((SVGImage)image).getDocument();
+ // Get synchronized svg image data
+ final int finalSvgW = image.getViewportWidth();
+ final int finalSvgH = image.getViewportHeight();
+ if ((finalSvgW == 0) || (finalSvgH == 0))
+ {
+ return;
+ }
+ // Calculate clip dimensions
+ final int finalClipX = iTargetGraphics.getClipX() + iTargetGraphics.getTranslateX();
+ final int finalClipY = iTargetGraphics.getClipY() + iTargetGraphics.getTranslateY();
+ final int finalClipW = iTargetGraphics.getClipWidth();
+ final int finalClipH = iTargetGraphics.getClipHeight();
+ // if none of the svg image is visible due to clipping then don't
+ // bother to call render
+ if ((x >= (finalClipX + finalClipW)) || (y >= (finalClipY + finalClipH)))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "render() - svg image isn't visible due to clipping");
+ return;
+ }
+ if (((x + finalSvgW) < finalClipX) || ((y + finalSvgH) < finalClipY))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "render() - svg image isn't visible due to clipping");
+ return;
+ }
+
+ final int finalX = x;
+ final int finalY = y;
+
+ System.out.println("P-In Render M2GScalableGraphics.. everything is fine... going in thread.." );
+
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _renderLCDUI(getHandle(), finalDoc.getHandle(), finalX, finalY,
+ finalClipX, finalClipY, finalClipW, finalClipH, finalSvgW, finalSvgH,
+ finalDoc.getRootElement().getCurrentTime());
+ }});
+
+ System.out.println("P-In Render M2GScalableGraphics.. everything is fine... thread complete...." );
+ }
+
+ else
+ {
+ Logger.ELOG(Logger.EJavaUI, "render() - exception: "
+ + /*SF*/"Target is not bound"/*SF*/);//TODO for time being commented.s
+ //throw new IllegalStateException(/*SF*/"Target is not bound"/*SF*/);
+ }
+ System.out.println("P-In Render M2GScalableGraphics.. Render Completed.." );
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableGraphics#setRenderingQuality(int)
+ */
+ public synchronized void setRenderingQuality(int mode)
+ {
+ if ((mode == ScalableGraphics.RENDERING_QUALITY_LOW) ||
+ (mode == ScalableGraphics.RENDERING_QUALITY_HIGH))
+ {
+ final int finalMode = mode;
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _setRenderingQuality(getHandle(), finalMode);
+ }
+ });
+ }
+ else
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setRenderingQuality() - exception: " + /*SF*/"The mode is invalid"/*SF*/);
+ throw new IllegalArgumentException(/*SF*/"The mode is invalid"/*SF*/);
+ }
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableGraphics#setTransparency(float)
+ */
+ public synchronized void setTransparency(float alpha)
+ {
+ if (alpha >= MIN_TRANSPARENCY_ALPHA && alpha <= MAX_TRANSPARENCY_ALPHA)
+ {
+ final float finalAlpha = alpha;
+ // Execute in UI thread
+ Platform.executeInUIThread(
+ new M2GRunnableQt() {
+ public void doRun() {
+ _setTransparency(getHandle(), finalAlpha);
+ }
+ }
+ );
+ }
+ else
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "setTransparency() - exception: " + /*SF*/"The alpha is out of range"/*SF*/);
+ throw new IllegalArgumentException(/*SF*/"The alpha is out of range"/*SF*/);
+ }
+ }
+
+
+ //--------------------------------------------------
+ // NATIVE METHODS
+ //--------------------------------------------------
+ private native int _bind(
+ int aRenderContextHandle, int aTargetHandle);
+ private native int _createRenderContext(
+ int aSVGProxyHandle);
+ private native void _deleteRenderContext(
+ int aRenderContextHandle);
+ private native int _release(
+ int aSurfaceHandle ,int aRenderContextHandle);
+ private native int _renderLCDUI(
+ int aRenderContextHandle, int aDocumentHandle,
+ int aX, int aY, int aClipX, int aClipY, int aClipW, int aClipH,
+ int aSvgW, int aSvgH, float aCurrentTime);
+ private native int[] _renderESWT(
+ int aRenderContextHandle, int aDocumentHandle,
+ int aX, int aY, int aClipX, int aClipY, int aClipW, int aClipH,
+ int aSvgW, int aSvgH, float aCurrentTime, int iUseNativeClear);
+ private native void _setRenderingQuality(
+ int aRenderContextHandle, int aMode);
+ private native void _setTransparency(
+ int aRenderContextHandle, float aAlpha);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/NativeError.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Native Error Descriptions for M2G Component.
+*
+*/
+
+
+package com.nokia.microedition.m2g;
+
+import java.io.IOException;
+
+/**
+ * A utility class for declaring and handling native SymbianOS error codes.
+ * All error codes that are used in Java from native code should be
+ * declared here and referenced from this class. Also if a new error code
+ * is added, it should be added to the list of compile-time asserts in
+ * NativeError.cpp.
+ */
+public final class NativeError
+{
+ public static final String NATIVE_ERROR_MESSAGE = "SymbianOS error = ";
+ private static final int BUFFER_SIZE = 256;
+
+ // SymbianOS error codes
+ public static final int KErrNone = 0;
+ public static final int KErrNotFound = -1;
+ public static final int KErrGeneral = -2;
+ public static final int KErrCancel = -3;
+ public static final int KErrNoMemory = -4;
+ public static final int KErrNotSupported = -5;
+ public static final int KErrArgument = -6;
+ public static final int KErrOverflow = -9;
+ public static final int KErrAlreadyExists = -11;
+ public static final int KErrPathNotFound = -12;
+ public static final int KErrDied = -13;
+ public static final int KErrNotReady = -18;
+ public static final int KErrCorrupt = -20;
+ public static final int KErrAccessDenied = -21;
+ public static final int KErrWrite = -23;
+ public static final int KErrEof = -25;
+ public static final int KErrDiskFull = -26;
+ public static final int KErrBadName = -28;
+ public static final int KErrCommsLineFail = -29;
+ public static final int KErrTimedOut = -33;
+ public static final int KErrDisconnected = -36;
+ public static final int KErrTooBig = -40;
+ public static final int KErrDivideByZero = -41;
+ public static final int KErrHardwareNotAvailable = -44;
+
+
+ // Not intended to be constructed
+ private NativeError()
+ {
+ }
+
+
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise just returns the error.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an error.
+ * @throws OutOfMemoryError If aError equals KErrNoMemory.
+ * @throws IllegalArgumentException If aError equals KErrArgument
+ * @throws ArithmeticException If aError equals KErrDivideByZero
+ */
+ public static int checkExplicitOnly(int aError)
+ {
+ if (aError < KErrNone)
+ {
+ switch (aError)
+ {
+ case KErrNoMemory:
+ throw new OutOfMemoryError();
+ // KErrArgument must throw IllegalArgumentException
+ // otherwise lcdui will break, so don't change this.
+ case KErrArgument:
+ throw new IllegalArgumentException();
+ case KErrDivideByZero:
+ throw new ArithmeticException();
+ default:
+ // Do nothing
+ }
+ }
+ return aError;
+ }
+
+
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise throws basic Error class.
+ *
+ * @param aError Possible error code.
+ * @param aThrowAlways Determines whether a default exception is thrown
+ * if the error code is not recognised.
+ * @return Value passed in is returned if not an error.
+ * @throws Error If the error code does not match any exception thrown
+ * in checkExplicitOnly, a default exception is thrown here.
+ */
+ public static int check(int aError)
+ {
+ if (aError < KErrNone)
+ {
+ checkExplicitOnly(aError);
+ throw new Error(errorMessage(aError));
+ }
+ return aError;
+ }
+
+
+
+ /**
+ * Version of check that uses a long rather than an int.
+ */
+ public static long check(long aError)
+ {
+ check((int)aError);
+ return aError;
+ }
+
+
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise throws an IOException.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an error.
+ */
+ public static int checkIO(int aError)
+ throws IOException
+ {
+ if (aError < KErrNone)
+ {
+ checkExplicitOnly(aError);
+ throw new IOException(errorMessage(aError));
+ }
+ return aError;
+ }
+
+
+
+ /**
+ * Checks if the error code represents out of memory, and throws Java Error
+ * if true. Otherwise throws basic Error class.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an error.
+ */
+ public static int checkOOM(int aError)
+ {
+ if (aError < KErrNone)
+ {
+ if (aError == KErrNoMemory)
+ {
+ throw new OutOfMemoryError();
+ }
+ throw new Error(errorMessage(aError));
+ }
+ return aError;
+ }
+
+
+
+ /**
+ * Checks if the object is a null reference, and throws OutOfMemoryError
+ * if this is the case. Useful for checking for OOM when Java objects
+ * returned from a native method.
+ *
+ * @param aObject Object that may be null.
+ * @return Value passed in is returned if not an error.
+ */
+ public static Object checkOOM(Object aObject)
+ {
+ if (aObject == null)
+ {
+ throw new OutOfMemoryError();
+ }
+ return aObject;
+ }
+
+
+
+ /**
+ * Checks if the error code represents out of memory, and throws Java Error
+ * if true. Does not throw anything otherwise.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an out of memory error.
+ */
+ public static int checkOOMOnly(int aError)
+ {
+ if (aError == KErrNoMemory)
+ {
+ throw new OutOfMemoryError();
+ }
+ return aError;
+ }
+
+
+
+ /**
+ * Returns a string formatted with generic text to indicate where the error
+ * code comes from and the error code given.
+ *
+ * @param A native error code.
+ * @return A string containing the error code and explanatory text.
+ */
+ public static String errorMessage(int aError)
+ {
+ final String message = _getNativeErrorMessage(aError);
+ String result = NATIVE_ERROR_MESSAGE.concat(Integer.toString(aError));
+ if (message != null && message.length() > 0)
+ result = result.concat(" : ").concat(message);
+ return result;
+ }
+
+ /**
+ * Returns a string formatted with generic text to indicate where the error
+ * code comes from and the error code given.
+ *
+ * @param A native error code.
+ * @param An extra text message for more information.
+ * @return A string containing the error code and explanatory text.
+ */
+ public static String errorMessage(int aError, String aExtraText)
+ {
+ final StringBuffer messageBuf = new StringBuffer(BUFFER_SIZE); // use native max as base
+ messageBuf.append(aExtraText);
+ messageBuf.append(", ");
+ messageBuf.append(errorMessage(aError));
+ return messageBuf.toString();
+ }
+
+
+ private static native String _getNativeErrorMessage(int aError);
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/Platform.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+/**
+ * \file
+ * \brief Target platform dependent Java module for Symbian.
+ *
+ */
+
+package com.nokia.microedition.m2g;
+import javax.microedition.lcdui.Graphics;
+import javax.microedition.lcdui.Image;
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
+import org.eclipse.swt.internal.extension.DisplayExtension;
+
+/**
+ * Implements platform-dependent functionality. At the moment, this
+ * includes native finalization and some helper methods for
+ * synchronizing 2D and 3D rendering.
+ */
+class Platform
+{
+ /**
+ * eSWT display for ui thread access
+ */
+ private static Display display = null;
+ private static boolean libraryLoaded = false;
+
+ //------------------------------------------------------------------
+ // Package private methods
+ //------------------------------------------------------------------
+
+ /**
+ * Executes given runnable in UI thread if caller thread is not UI thread
+ */
+ static void executeInUIThread(M2GRunnableQt obj)
+ {
+ if (display == null)
+ {
+ if (!uiThreadAvailable())
+ {
+ throw new Error("Ui thread not available");
+ }
+ }
+ if (display.isDisposed())
+ {
+ throw new Error("Display already disposed");
+ }
+
+ if (obj != null)
+ {
+ // If we are not in UI thread use display
+ if (Thread.currentThread() != display.getThread())
+ {
+ display.syncExec(obj);
+ }
+ else
+ {
+ // In this case we are in UI thread so just execute directly
+ obj.run();
+ }
+ // Check if any exceptions occured in execution
+ // and throw forward in caller thread
+ obj.checkAndThrow();
+ }
+ }
+
+ /**
+ * Check the UI thread / toolkit init status and store display if it is available
+ * @return true if either lcdui or eswt toolkit is initialized and ui thread is accessible
+ * otherwise false
+ */
+ static boolean uiThreadAvailable()
+ {
+ if (display != null)
+ {
+ return true;
+ }
+ else
+ {
+ display = DisplayExtension.getDisplayInstance();
+ System.out.println("P-UI Thread not available Case" );
+ if (display == null)
+ {
+ return false;
+ }
+ else
+ {
+ System.out.println("P-UI Thread available Case" );
+ // UI thread is available, so load native library if not already loaded
+ if (!libraryLoaded)
+ {
+ System.out.println("P-UI Thread not available Case Javam2g loaded" );
+ com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g");
+ libraryLoaded = true;
+ }
+ return true;
+ }
+ }
+ }
+
+ /**
+ * Registers an Object3D in the global handle-to-object map. The
+ * handle of the object must already be set at this point!
+ */
+// static final void registerFinalizer(Object3D obj)
+// {
+// //heuristicGC();
+// }
+//
+// /**
+// * Registers a Graphics3D object (not derived from Object3D) for
+// * finalization.
+// */
+// static final void registerFinalizer(Graphics3D g3d)
+// {
+// //heuristicGC();
+// }
+//
+// /**
+// * Registers an Interface object for finalization
+// */
+// static final void registerFinalizer(Interface m2G)
+// {
+// }
+//
+// /**
+// * Registers a Loader object for finalization
+// */
+// static final void registerFinalizer(Loader loader)
+// {
+// }
+//
+// /**
+// * Flushes all pending rendering to a Graphics context and blocks
+// * until finished
+// */
+// static final void sync(Graphics g)
+// {
+// //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
+// //invoker.toolkitSync(invoker.getToolkit());
+// }
+//
+// /**
+// * Flushes all pending rendering to an Image object
+// */
+// static final void sync(Image img)
+// {
+// //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
+// //invoker.toolkitSync(invoker.getToolkit());
+// }
+//
+// /**
+// * Finalizes the native peer of an interface
+// */
+// static final native void finalizeInterface(int handle);
+//
+// /**
+// * Finalizes the native peer of an object
+// * JCF: added this wrapper method so we could pass the toolkit handle to the native method.
+// */
+ static final void finalizeObject(int handle)
+ {
+ try
+ {
+ final int finalHandle = handle;
+ executeInUIThread(
+ new M2GRunnableQt()
+ {
+ void doRun()
+ {
+ _finalizeObject(finalHandle);
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ // do nothing
+ }
+ }
+
+ /**
+ * Finalizes the native peer of an object associated with
+ * given Interface instance
+ */
+// static final void finalizeObject(int handle, Interface aInterface)
+// {
+// try
+// {
+// final int finalHandle = handle;
+// executeInUIThread(
+// new M2GRunnable()
+// {
+// public void doRun()
+// {
+// _finalizeObject(finalHandle);
+// }
+// });
+// }
+// catch (Exception e)
+// {
+// // do nothing
+// }
+// }
+
+
+ //------------------------------------------------------------------
+ // Private methods
+ //------------------------------------------------------------------
+
+ /**
+ * Trigger GC if minimum free memory limit has been exceeded in the native side
+ */
+ static final void heuristicGC()
+ {
+ }
+ private static final native void _finalizeObject(int handle);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionFactory.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+import java.io.IOException;
+import javax.microedition.m2g.ExternalResourceHandler;
+import com.nokia.microedition.m2g.connection.common.M2GConnectionPolicyImpl;
+
+/**
+ * Connection factory
+ */
+public class M2GConnectionFactory
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final String COMMON_PROTOCOL =
+ "common";
+ public static final String FILE_PROTOCOL =
+ "file";
+ public static final String CONNECTION_BASE_PACKAGE =
+ "com.nokia.microedition.m2g.connection.";
+ public static final String CONNECTION_PROXY_CLASS_NAME =
+ ".M2GConnectionProxyImpl";
+
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor
+ */
+ private M2GConnectionFactory()
+ {
+ }
+
+ /**
+ * Create a connection proxy.
+ * If a url is not absolute or if it's beginig with
+ * the slash mark then a resource is considered to be opened from a jar file.
+ * @param aUrl Locator
+ * @return Connection proxy
+ * @throws IOException if an io error occurs
+ * @throws NullPointerException if the locator is null.
+ * @throws IllegalArgumentException if the locator is of unsupported type.
+ */
+ public static M2GConnectionProxy create(String aUrl) throws IOException
+ {
+ try
+ {
+ M2GConnectionProxy proxy = null;
+ M2GUrlTokenizer tokenizer = new M2GUrlTokenizer(aUrl);
+
+ // If a url begins with the slash mark then
+ // a resource is tryed to open from a jar file.
+ if (!M2GUrlTokenizer.isAbsolutURL(aUrl) ||
+ tokenizer.beginWithSlash())
+ {
+ proxy = new M2GConnectionProxy();
+ }
+ else
+ {
+ Class proxyClass =
+ Class.forName(parseClassName(tokenizer.getProtocol()));
+ proxy = (M2GConnectionProxy)proxyClass.newInstance();
+ }
+ proxy.open(tokenizer);
+ return proxy;
+ }
+ catch (InstantiationException e)
+ {
+ throw new IllegalArgumentException("Internal error: " + e.getMessage());
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalArgumentException("Internal error: " + e.getMessage());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Internal error: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Get default external resource handler
+ * @param aUrl URL
+ * @return external resource handler
+ */
+ public static ExternalResourceHandler getExternalResourceHandler(String aUrl)
+ {
+ return new M2GDefaultExternalResourceHandler(aUrl);
+ }
+
+ /**
+ * Resolve external resource URL
+ * @param aTokenizer Tokenizer
+ * @param aUrl URL
+ * @return connection proxy
+ * @throws IOException
+ */
+ public static M2GConnectionProxy resolveExternalResourceUrl(
+ M2GUrlTokenizer aTokenizer, String aUrl) throws IOException
+ {
+ // Check if the URL is relative.
+ if (!M2GUrlTokenizer.isAbsolutURL(aUrl))
+ {
+ if (aTokenizer.getBaseUrl() != null)
+ {
+ aUrl = aTokenizer.resolveUrl(aUrl);
+ }
+ }
+
+ return M2GConnectionFactory.create(aUrl);
+ }
+
+ /**
+ * Get default policy
+ * @return Connection policy
+ */
+ public static M2GConnectionPolicy getDefaultPolicy()
+ {
+ return new M2GConnectionPolicyImpl();
+ }
+
+ /**
+ * Parses a connection proxy class name.
+ * @param aProtocol Protocol
+ * @return Connection proxy class name
+ */
+ private static String parseClassName(String aProtocol)
+ {
+ if (aProtocol.equals(FILE_PROTOCOL))
+ {
+ return
+ CONNECTION_BASE_PACKAGE + FILE_PROTOCOL + CONNECTION_PROXY_CLASS_NAME;
+ }
+ else
+ {
+ return
+ CONNECTION_BASE_PACKAGE + COMMON_PROTOCOL + CONNECTION_PROXY_CLASS_NAME;
+
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionPolicy.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+/**
+ * Connection policy
+ */
+public interface M2GConnectionPolicy
+{
+ /**
+ * Get access right
+ * @return Rights
+ */
+ public boolean getAccessRight();
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionPolicyHandler.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+/**
+ * Interface for connection policy handler
+ */
+public interface M2GConnectionPolicyHandler
+{
+ /**
+ * Get connection policy
+ * @return Policy
+ */
+ public M2GConnectionPolicy getConnectionPolicy();
+
+ /**
+ * Set connection policy
+ * @param aConnectionPolicy Policy
+ */
+ public void setConnectionPolicy(M2GConnectionPolicy aConnectionPolicy);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionProxy.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.microedition.io.StreamConnection;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * Base connection proxy class
+ */
+public class M2GConnectionProxy
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ // Error constants
+ static final String RESOURCE_NOT_FOUND_ESTR =
+ "Given resource is not found.";
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ protected String iBaseUrl = null;
+ protected String iSuffixUrl = null;
+ protected InputStream iInputStream = null;
+ protected StreamConnection iConnection = null;
+ protected M2GConnectionPolicy iConnectionPolicy = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * Ctor.
+ */
+ public M2GConnectionProxy()
+ {
+ }
+
+
+ /**
+ * Close the connection.
+ * When a connection has been closed, access to any of its
+ * methods that involve an I/O operation will cause an
+ * IOException to be thrown.
+ * Closing an already closed connection has no effect.
+ */
+ public void close() throws IOException
+ {
+ if (iInputStream != null)
+ {
+ iInputStream.close();
+ iInputStream = null;
+ }
+ if (iConnection != null)
+ {
+ iConnection.close();
+ iConnection = null;
+ }
+ iConnectionPolicy = null;
+ }
+
+ /**
+ * Get base url
+ * @return Base url
+ */
+ public String getBaseUrl()
+ {
+ return iBaseUrl;
+ }
+
+ /**
+ * Get the suffix url
+ * @note The suffix is calculated in m2g.connection.file.M2GConnectionProxyImpl.open()
+ * @return Suffix url including '?' if there is a suffix, and null otherwise
+ */
+ public String getSuffixUrl()
+ {
+ return iSuffixUrl;
+ }
+
+ /**
+ * Get an input stream for a connection.
+ * @return An input stream
+ * @throws IOException If the input stream is null.
+ */
+ public InputStream getInputStream() throws IOException
+ {
+ if (iInputStream == null)
+ {
+ throw new IOException();
+ }
+ return iInputStream;
+ }
+
+ /**
+ * Get a connection policy.
+ * @return A connection policy
+ * @throws IOException If the connection policy is null.
+ */
+ public M2GConnectionPolicy getConnectionPolicy() throws IOException
+ {
+ if (iConnectionPolicy == null)
+ {
+ throw new IOException();
+ }
+ return iConnectionPolicy;
+ }
+
+
+ /**
+ * Open a connection to a file located in a jar file..
+ * @param aTokenizer Url tokenizer
+ * @throws IOException If an error occurs while loading a content.
+ * @throws IllegalArgumentException If no resource is found according to an URL.
+ */
+ public void open(M2GUrlTokenizer aTokenizer) throws IOException
+ {
+ iBaseUrl = aTokenizer.getBaseUrl();
+ iSuffixUrl = null; // can't have DRM mode within a JAR
+
+ iInputStream =
+ Runtime.getRuntime().getClass().getResourceAsStream(aTokenizer.getUrl());
+
+ if (iInputStream == null)
+ {
+ Logger.ELOG(Logger.EJavaUI, RESOURCE_NOT_FOUND_ESTR);
+ throw new IllegalArgumentException(RESOURCE_NOT_FOUND_ESTR);
+ }
+ iConnectionPolicy = M2GConnectionFactory.getDefaultPolicy();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GDefaultExternalResourceHandler.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+
+import java.io.*;
+import javax.microedition.io.*;
+import javax.microedition.m2g.ExternalResourceHandler;
+import javax.microedition.m2g.*;
+
+
+/**
+* <p>This private class is the default resource handler
+* used to load external resources that are referenced
+* within a ScalableImage, namely within a SVG document in the case of SVG.
+* The default resource handler will be used by the platform in the following cases:
+* - if the MIDlet has not explicitly set its own handler to load external resources
+* - if the resource handler specified by the MIDlet is not able to load the
+* external resources (i.e. the MIDlet's SVGResourceHandle.getExternalResource()
+* returns null).</p>
+* @see javax.microedition.m2g.ExternalResourceHandler
+*/
+public class M2GDefaultExternalResourceHandler implements ExternalResourceHandler
+{
+
+ /*
+ * According to RFC 2396, the rules for determening the base URI can be summarized
+ * as follows (highest priority to lowest):
+ * 1.The base URI is embedded in the document's content.
+ * 2.The base URI is that of the encapsulating document.
+ * 3.The base URI is the URI used to retrieve the entity.
+ * 4.The base URI is defined by the context of the application
+ *
+ * Note that in the case of the M2GDefaultExternalResourceHandler 4. is not
+ * applicable.
+ */
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GUrlTokenizer iTokenizer = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * This constructor is used to create a default resource handler that can
+ * load resources from absolute URLs and from URLs that are relative
+ * to the aUrl.
+ * NOTE: This handler will not be allowed to load resources from the application's
+ * jar file.
+ *
+ * @param aUrl The already validated url used to load the svg document
+ */
+ M2GDefaultExternalResourceHandler(String aUrl)
+ {
+ if (aUrl == null || aUrl.equals(""))
+ {
+ iTokenizer = new M2GUrlTokenizer();
+ }
+ else
+ {
+ iTokenizer = new M2GUrlTokenizer(aUrl);
+ }
+ }
+
+ /**
+ * This constructor is used to create a default resource handler that can
+ * load external resources from fully qualified URLs ONLY. Any relative URL
+ * will be considered to be a link to a resource within the application's jar file.
+ */
+ M2GDefaultExternalResourceHandler()
+ {
+ this(null);
+ }
+
+ /**
+ * This method is invoked when an external resource is required by the underlying implementation.
+ * When the request is completed by the implementation of this handler, a notification
+ * must be sent to the SVG engine through the requestCompleted() method of <code>ScalableImage</code>.
+ * To get a synchronous behaviour, requestCompleted() can be called in the implementation
+ * of requestResource. If called later, rendering the document before
+ * completing all the requests will just display the currently available content.
+ * Once the request is completed, the image will have to be redrawn to reflect the newly
+ * available data.
+ * For more details on required resources, please refer to the <code>externalResourcesRequired</code>
+ * attribute description in the SVG specification.
+ *
+ * @param image image that originated the external data request
+ * @param URL the an absolute or a relative URL for the external resource + drm mode
+ */
+ public void requestResource(ScalableImage aImage, String aUrl)
+ {
+ M2GConnectionProxy proxy = null;
+
+ /* IMPLEMENTATION NOTE:
+ * The default resource handler assumes that if there is an embedded base URL within the
+ * document then is upon the svg engine to provide the absolute URL.
+ * If the given URL is a relative URL then this handler will attempt to use as a base URL
+ * to retrieve the containing svg document. However, if the document's base
+ * URL is null then this handler will assume the given relative URL to be a file name
+ * within the application's jar file.
+ */
+ try
+ {
+ // NOTE: if exception is thrown during the resolveExternalResourceUrl() call then
+ // the requestCompleted should be called again with a null input stream.
+ proxy = M2GConnectionFactory.resolveExternalResourceUrl(iTokenizer, aUrl);
+ aImage.requestCompleted(aUrl, proxy.getInputStream());
+ }
+ catch (Exception e)
+ {
+ // e.printStackTrace();
+ // The requestCompleted() failed
+ try
+ {
+ aImage.requestCompleted(aUrl, null);
+ }
+ catch (Exception ee)
+ {
+ // ee.printStackTrace();
+ }
+ }
+ // Close streams
+ finally
+ {
+ try
+ {
+ if (proxy != null)
+ {
+ proxy.close();
+ }
+ }
+ catch (Exception e)
+ {
+ // e.printStackTrace();
+ }
+ }
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GUrlTokenizer.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection;
+
+import java.io.IOException;
+import java.lang.NullPointerException;
+import java.lang.IllegalArgumentException;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * Connection policy
+ */
+public class M2GUrlTokenizer
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final String PROTOCOL_SEPARATOR =
+ "://";
+ public static final char PARAMETER_SEPARATOR =
+ '?';
+ public static final char SEPARATOR =
+ '/';
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private String iUrl = null;
+ private String iBaseUrl = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor
+ */
+ public M2GUrlTokenizer()
+ {
+ }
+
+ /**
+ * Ctor
+ * @param aUrl Locator
+ * @throws NullPointerException if the locator is null.
+ * @throws IllegalArgumentException if the locator is of unsupported type.
+ */
+ public M2GUrlTokenizer(String aUrl)
+ {
+ setUrl(aUrl);
+ }
+
+ /**
+ * Check if the url begin with slash ('/')
+ * @return true is the url begin with slash
+ */
+ public boolean beginWithSlash()
+ {
+ if ((iUrl != null) &&
+ (iUrl.indexOf(SEPARATOR) == 0))
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * Parses the base part of the locator
+ * @return parsed base part
+ */
+ public String getBasePart()
+ {
+ if (iUrl == null)
+ {
+ return null;
+ }
+ int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
+ if (pos == -1)
+ {
+ pos = iUrl.length();
+ }
+ return iUrl.substring(0, pos);
+ }
+
+ /**
+ * Parses the base url
+ * @return parsed base url
+ */
+ public String getBaseUrl()
+ {
+ return iBaseUrl;
+ }
+
+ /**
+ * Parses the end part of the locator
+ * @return parsed end part
+ * @throws IllegalArgumentException if base part cannot
+ * be parsed from the locator
+ */
+ public String getEndPart()
+ {
+ if (iUrl == null)
+ {
+ return null;
+ }
+ int pos = iUrl.lastIndexOf(SEPARATOR);
+ if (pos == -1)
+ {
+ return iUrl;
+ }
+ return iUrl.substring(pos, iUrl.length());
+ }
+
+ /**
+ * Parses the middle part of the locator
+ * @return parsed middle part
+ * @throws IllegalArgumentException if middle part cannot
+ * be parsed from the locator
+ */
+ public String getMiddlePart()
+ {
+ if (iUrl == null)
+ {
+ return null;
+ }
+ int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
+ if (pos == -1)
+ {
+ pos = iUrl.length();
+ }
+ return iUrl.substring(
+ getProtocol().length() + PROTOCOL_SEPARATOR.length(), pos);
+ }
+
+ /**
+ * Parses possible parameters of the locator
+ * @return Parsed parameters or null if there are not parameters
+ */
+ public String getParameters()
+ {
+ if (iUrl == null)
+ {
+ return null;
+ }
+ int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
+ String parameters = null;
+ if (pos != -1)
+ {
+ parameters = iUrl.substring(pos + 1);
+ }
+ return parameters;
+ }
+
+ /**
+ * Parses the protocol part of the locator.
+ * @see M2GUrlTokenizer#isAbsolutURL()
+ * @return Protocol
+ * @throws IllegalArgumentException If the locator is of
+ * unsupported type.
+ */
+ public String getProtocol()
+ {
+ int pos = -1;
+ if ((iUrl == null) || ((pos = iUrl.indexOf(PROTOCOL_SEPARATOR)) == -1))
+ {
+ throw new IllegalArgumentException("Unable to parse protocol");
+ }
+ return iUrl.substring(0, pos);
+ }
+
+ /**
+ * Returns a whole locator string
+ * @return Locator used to create this instance
+ */
+ public String getUrl()
+ {
+ return iUrl;
+ }
+
+ /**
+ * Resolve URL according to existing base url and
+ * the given relative url
+ * TODO: Should be resolved by using RFC 2396
+ * @aRelativeUrl Relative URL.
+ * @return Resolved URL
+ */
+ public String resolveUrl(String aRelativeUrl)
+ {
+ check(aRelativeUrl);
+ if (iBaseUrl != null)
+ {
+ return (iBaseUrl + aRelativeUrl);
+ }
+ else
+ {
+ return aRelativeUrl;
+ }
+ }
+
+
+ /**
+ * Set a locator string
+ * @param aUrl Locator
+ * @throws NullPointerException if the locator is null.
+ * @throws IllegalArgumentException if the locator is of unsupported type.
+ */
+ public void setUrl(String aUrl)
+ {
+ check(aUrl);
+ iUrl = aUrl;
+ int pos = iUrl.lastIndexOf(SEPARATOR);
+ if (pos == -1)
+ {
+ iBaseUrl = null;
+ }
+ else
+ {
+ iBaseUrl = iUrl.substring(0, (pos + 1));
+ }
+ }
+
+ /**
+ * Check url
+ * @param aUrl Locator
+ * @throws NullPointerException if the locator is null.
+ * @throws IllegalArgumentException if the locator is of unsupported type.
+ */
+ private void check(String aUrl)
+ {
+ if (aUrl == null)
+ {
+ Logger.ELOG(Logger.EJavaUI, "setUrl() - url is null");
+ throw new NullPointerException();
+ }
+ if (aUrl.length() == 0)
+ {
+ Logger.ELOG(Logger.EJavaUI, "setUrl() - url is illegal");
+ throw new IllegalArgumentException();
+ }
+ }
+
+ //--------------------------------------------------
+ // STATIC METHODS
+ //--------------------------------------------------
+ /**
+ * Check if contains protocol.
+ * An absolute URL contains the name of the scheme being used (<scheme>)
+ * followed by a colon (":") and then a string (the <scheme-specific-
+ * // part>) whose interpretation depends on the scheme.
+ * Also if the URL begins with a slash character "/" then the URL is treated
+ * as absolute.
+ * @param aUrl URL
+ * @return true if URL contains a protocol
+ */
+ static public boolean isAbsolutURL(String aUrl)
+ {
+ if ((aUrl == null) ||
+ ((aUrl.indexOf(PROTOCOL_SEPARATOR) == -1) &&
+ (aUrl.indexOf(SEPARATOR) != 0)))
+ {
+ return false;
+ }
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/common/M2GConnectionPolicyImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection.common;
+
+import com.nokia.microedition.m2g.connection.M2GConnectionPolicy;
+
+/**
+ * Connection policy
+ */
+public class M2GConnectionPolicyImpl implements M2GConnectionPolicy
+{
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor
+ */
+ public M2GConnectionPolicyImpl()
+ {
+ }
+
+ /**
+ * Get access rights
+ * @see M2GConnectionPolicy#getAccessRight()
+ */
+ public boolean getAccessRight()
+ {
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/common/M2GConnectionProxyImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection.common;
+
+import javax.microedition.io.Connector;
+import javax.microedition.io.StreamConnection;
+import javax.microedition.io.ConnectionNotFoundException;
+import java.io.IOException;
+import java.lang.IllegalArgumentException;
+import com.nokia.microedition.m2g.connection.*;
+
+/**
+ * Connection proxy class
+ */
+public class M2GConnectionProxyImpl extends M2GConnectionProxy
+
+{
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor.
+ */
+ public M2GConnectionProxyImpl()
+ {
+ }
+
+ /**
+ * Open a connection.
+ * @see M2GConnectionProxy#open()
+ */
+ public void open(M2GUrlTokenizer aTokenizer) throws IOException
+ {
+ iBaseUrl = aTokenizer.getBaseUrl();
+ iSuffixUrl = null; // can't have DRM suffix when opening from stream
+ iConnectionPolicy = new M2GConnectionPolicyImpl();
+ try
+ {
+ iConnection = (StreamConnection)Connector.open(
+ aTokenizer.getUrl());
+ iInputStream = iConnection.openInputStream();
+ }
+ catch (ConnectionNotFoundException e)
+ {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/file/M2GConnectionPolicyImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection.file;
+
+import java.io.IOException;
+import java.lang.NullPointerException;
+import java.lang.IllegalArgumentException;
+import java.lang.SecurityException;
+import com.nokia.microedition.m2g.connection.*;
+import com.nokia.microedition.m2g.M2GSVGConstants;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * Connection policy
+ * <b>DRM - DECRYPTED MODE</b>
+ * <p>
+ * <b>Description</b>
+ * <br>
+ * When a MIDlet tries to open a file using a URL that starts with file:// and
+ * ends either with ?drm=dec+display or with ?drm=dec+display+preview,
+ * this is interpreted as a request to open the file for reading of the
+ * content in the plaintext form.
+ * Example URLs:
+ * file:///E:/foo.svg?drm=dec+display
+ * file:///E:/foo.svg?drm=dec+display+preview
+ * <br>
+ * Supported only if the midlet belongs to MANUFACTURER DOMAIN otherwise
+ * java.lang.SecurityException is thrown.
+ * </p>
+ * <br>
+ * <br>
+ * <b>DRM - ENCRYPTED MODE</b>
+ * <p>
+ * <b>Description</b>
+ * <br>
+ * When a MIDlet tries to open a file using a URL that starts with file:// and
+ * ends with ?drm=enc, this is interpreted as a request to open the
+ * file for reading of the content in the encrypted form.
+ * Example URLs:
+ * file:///E:/foo.svg?drm=enc
+ * <br>
+ * Not supported, java.lang.IllegalArgumentException is thrown always.
+ * </p>
+ * <br>
+ * <br>
+ * <b>DRM - DEFAULT MODE</b>
+ * <p>
+ * <b>Description</b>
+ * <br>
+ * When a MIDlet tries to open a file using either a normal file URL or a
+ * file URL that ends with ?drm=preview, this is interpreted as a request to open the
+ * file for reading of the content in the decrypted form.
+ * NOTE: Preview mechanism is not available to MIDlets that don't
+ * belong to MANUFACTURER DOMAIN.
+ * Example URLs:
+ * file:///E:/foo.svg
+ * file:///E:/foo.svg?drm=preview
+ * <br>
+ * Access to SVG document via DOM API is NOT allowed, i.e. only rendering of the
+ * content is allowed if a MIDlet uses a default mode URL.
+ * If it's tryed to access to SVG document via DOM API then
+ * java.lang.SecurityException is thrown.
+ * </p>
+ */
+public class M2GConnectionPolicyImpl implements M2GConnectionPolicy
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final String ENC_NOT_SUPPORTED_ESTR =
+ "A URL with an encrypted mode is not supported.";
+ public static final String DRM_PARAMETER =
+ "drm";
+ public static final String DECRYPTED_MODE =
+ "dec";
+ public static final String ENCRYPTED_MODE =
+ "enc";
+ public static final String DEFAULT_MODE =
+ "def";
+ public static final String DEFAULT_PREVIEW_MODE =
+ "def_preview";
+ public static final String DRM_PREVIEW_ATTRIBUTE =
+ "preview";
+ public static final String DRM_DEFAULT_VALUES =
+ "?drm=dec+display";
+ public static final String DRM_DEFAULT_VALUES_AND_PREVIEW =
+ "?drm=dec+display+preview";
+ public static final String DRM_FILE_SUFFIX =
+ "dcf";
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GUrlTokenizer iTokenizer;
+ private boolean iAccessRight = true;
+ private String iMode = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor
+ */
+ public M2GConnectionPolicyImpl(M2GUrlTokenizer aTokenizer)
+ {
+ iTokenizer = aTokenizer;
+ }
+
+ /**
+ * Check domain
+ * @throws SecurityException if not access rights
+ */
+ public void checkDomain(boolean isManufacturerDomain) throws SecurityException
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "checkDomain(): manufacturer domain=" + isManufacturerDomain
+ + ", mode=" + iMode + ", access right=" + iAccessRight + " - begin");
+
+ // If drm mode then
+ if (iMode != null)
+ {
+ // If dec mode and not manufacturer domain
+ if (iMode.equals(DECRYPTED_MODE))
+ {
+ if (!isManufacturerDomain)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "checkDomain() - Not manufacturer and dec: SecurityException");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ }
+ // If default + preview mode
+ else if (iMode.equals(DEFAULT_PREVIEW_MODE))
+ {
+ if (!isManufacturerDomain)
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "checkDomain() - Not manufacturer and def+preview: SecurityException");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ }
+ // If not default mode
+ else if (!iMode.equals(DEFAULT_MODE))
+ {
+ Logger.ELOG(Logger.EJavaUI,
+ "checkDomain() - Not def nor dec: SecurityException");
+ throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
+ }
+ }
+ }
+
+ /**
+ * Check protection type
+ * @param aType If type is null then file is not drm protected.
+ */
+ public void checkProtectionType(String aType)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "checkProtectionType() type=" + aType + ", mode=" + iMode +
+ ", access right=" + iAccessRight + " - begin");
+
+ if ((aType != null) && (!aType.equals("")))
+ {
+ if (iMode == null)
+ {
+ iMode = DEFAULT_MODE;
+ iAccessRight = false;
+ }
+ }
+
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "checkProtectionType() mode=" + iMode + ", access right=" +
+ iAccessRight + " - end");
+ }
+
+ /**
+ * Get access rights
+ * @see M2GConnectionPolicy#getAccessRight()
+ */
+ public boolean getAccessRight()
+ {
+ return iAccessRight;
+ }
+
+ /**
+ * Initialize
+ * @param aTokenizer Tokenizer
+ * @throws IllegalArgumentException if drm with encrypted mode
+ */
+ public void initialize(M2GUrlTokenizer aTokenizer)
+ {
+ iAccessRight = true;
+ iMode = null; // no DRM at all
+ iTokenizer = aTokenizer;
+ String parameters = iTokenizer.getParameters();
+ int pos = -1;
+ // Check if a url is something more than just a normal url.
+ // Is the drm parameter within the parameters?
+ if ((parameters != null) && (pos = parameters.indexOf(DRM_PARAMETER)) != 1)
+ {
+ pos += DRM_PARAMETER.length();
+ // Encrypted mode?
+ if (parameters.indexOf(ENCRYPTED_MODE, pos) != -1)
+ {
+ Logger.ELOG(Logger.EJavaUI, "initialize(): drm - encrypted mode");
+ iAccessRight = false;
+ iMode = ENCRYPTED_MODE;
+ throw new IllegalArgumentException(ENC_NOT_SUPPORTED_ESTR);
+ }
+ // Decrypted mode?
+ else if (parameters.indexOf(DECRYPTED_MODE, pos) != -1)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "initialize(): drm - decrypted mode");
+ iAccessRight = true;
+ iMode = DECRYPTED_MODE;
+ }
+ // Default + preview mode?
+ else if (parameters.indexOf(DRM_PREVIEW_ATTRIBUTE, pos) != -1)
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "initialize(): drm - decrypted mode");
+ iAccessRight = false;
+ iMode = DEFAULT_PREVIEW_MODE;
+ }
+ // Default mode
+ else
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "initialize(): drm - default mode");
+ iAccessRight = false;
+ iMode = DEFAULT_MODE;
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "initialize() mode=" + iMode + ", access right="
+ + iAccessRight + " - end");
+ }
+
+ /**
+ * Get drm mode
+ * @return mode. Null if no drm
+ */
+ public String getMode()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getMode(): " + iMode + "- begin");
+ return iMode;
+ }
+
+ /**
+ * Get url
+ * @return File url
+ */
+ public String getUrl()
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getUrl() mode=" + iMode + ", access right=" + iAccessRight + " - begin");
+
+ String url = iTokenizer.getUrl();
+ String parameters = iTokenizer.getParameters();
+ // If normal url or default drm url
+ if ((iMode == null) ||
+ (iMode.equals(DEFAULT_MODE)) ||
+ (iMode.equals(DEFAULT_PREVIEW_MODE)))
+ {
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getUrl() parse default url");
+ // Url with preview attribute?
+ if ((parameters != null) &&
+ (parameters.indexOf(DRM_PREVIEW_ATTRIBUTE) != -1))
+ {
+ url = (iTokenizer.getBasePart() + DRM_DEFAULT_VALUES_AND_PREVIEW);
+ }
+ // Normal file url?
+ else
+ {
+ // File API is able to open normal file without drm protection even
+ // when the url contains the drm parameter
+ url = (iTokenizer.getBasePart() + DRM_DEFAULT_VALUES);
+ }
+ }
+ Logger.LOG(Logger.EJavaUI, Logger.EInfo,
+ "getUrl(): " + url + " - end");
+ return url;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/file/M2GConnectionProxyImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.m2g.connection.file;
+
+import javax.microedition.io.file.FileConnection;
+import javax.microedition.io.Connector;
+import java.io.IOException;
+import com.nokia.microedition.m2g.connection.*;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * File connection proxy class
+ */
+public class M2GConnectionProxyImpl extends M2GConnectionProxy
+{
+
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final String READ_PERMISSION =
+ "javax.microedition.io.Connector.file.read";
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+ /**
+ * Ctor.
+ */
+ public M2GConnectionProxyImpl()
+ {
+ super();
+ }
+
+ /**
+ * Open a connection.
+ * @see connection.common.M2GConnectionProxy#open()
+ */
+ public void open(M2GUrlTokenizer aTokenizer) throws IOException
+ {
+ boolean openingStream = false;
+ FileConnection connection = null;
+ try
+ {
+ iBaseUrl = aTokenizer.getBaseUrl();
+
+ // extract the suffix url from the initial url used to open the
+ // file, and not the constructed (altered in default mode) url by
+ // M2GConnectionPolicyImpl.
+ // This suffix is passed to the external resource handler later
+ iSuffixUrl = aTokenizer.getParameters();
+ if (iSuffixUrl != null)
+ {
+ iSuffixUrl = M2GUrlTokenizer.PARAMETER_SEPARATOR + iSuffixUrl;
+ }
+
+ Logger.LOG(
+ Logger.EJavaUI,
+ Logger.EInfo,
+ "file open(), suffix URI: "
+ + (iSuffixUrl != null ? iSuffixUrl.toString() : "null")
+ + ", create file connection - 0");
+
+ M2GConnectionPolicyImpl connectionPolicy =
+ new M2GConnectionPolicyImpl(aTokenizer);
+
+ String uri = aTokenizer.getUrl();
+
+ Logger.LOG(
+ Logger.EJavaUI,
+ Logger.EInfo,
+ "file open(), URI: " + uri
+ + ", create file connection - 2");
+
+ connection = (FileConnection) Connector.open(uri,
+ Connector.READ);
+ openingStream = true;
+ iInputStream = connection.openInputStream();
+ openingStream = false;
+ iConnection = connection;
+ iConnectionPolicy = connectionPolicy;
+ }
+ finally
+ {
+ if ((true == openingStream) && (null != connection))
+ {
+ connection.close();
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/eclipse/swt/widgets/SVGAnimatorControl.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,438 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.eclipse.swt.widgets;
+
+// this package is removed from Qt import org.eclipse.swt.internal.symbian.
+/*import org.eclipse.swt.internal.symbian.*;*/
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.widgets.Control;
+import javax.microedition.m2g.*;
+import com.nokia.microedition.m2g.*;
+import java.util.*;
+import java.lang.ref.WeakReference;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.events.*;
+import com.nokia.mj.impl.utils.Logger;
+import org.eclipse.swt.widgets.Internal_PackageSupport;
+import org.eclipse.swt.graphics.Internal_GfxPackageSupport;
+
+
+
+/**
+ * Control
+ */
+public class SVGAnimatorControl extends Canvas
+ implements ControlListener,
+ KeyListener,
+ MouseListener,
+ DisposeListener,
+ ShellListener,
+ PaintListener
+{
+ //--------------------------------------------------
+ // STATIC CONSTANTS
+ //--------------------------------------------------
+ public static final int STATE_STOPPED = 1;
+ public static final int STATE_PLAYING = 2;
+ public static final int STATE_PAUSED = 3;
+ public static final float DEFAULT_DELTA_TIME = 0.1f;
+
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private int iState;
+ private SVGImage iSVGImage;
+ private M2GScalableGraphics iSg;
+ private float iDeltaTime;
+ private SVGAnimatorRunnable iTask = null;
+ private SVGEventListener iEventListener = null;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ /**
+ * @see
+ */
+ public SVGAnimatorControl(SVGImage aSVGImage)
+ {
+ iSVGImage = aSVGImage;
+ iState = STATE_STOPPED;
+ // Create render context, use M2GScalableGraphics
+ // directly to get access to render method with native
+ // side clearing parameter
+ iSg = new M2GScalableGraphics();
+ iSg.setRenderingQuality(ScalableGraphics.RENDERING_QUALITY_HIGH);
+ iDeltaTime = DEFAULT_DELTA_TIME;
+ iTask = new SVGAnimatorRunnable(this);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#setParent()
+ */
+ public boolean setParent(Composite aParent)
+ {
+ parent = aParent;
+ display = aParent.display;
+
+ // Init widget after parent and display are known
+ //Have to create Widget.
+//Workaround for Qt changes this method is now in with one int argument.L:\sf\app\jrt\javauis\eswt_qt\org.eclipse.swt\Eclipse SWT\qt\org\eclipse\swt\widgets\Control.java
+// int i =10;
+// createWidget(i);
+// internal_createWidget();
+
+ // Add this to necessary listeners
+ addControlListener(this);
+ addKeyListener(this);
+ addMouseListener(this);
+ addDisposeListener(this);
+ parent.getShell().addShellListener(this);
+ addPaintListener(this);
+
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#paint()
+ */
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+
+ // Render image
+ try
+ {
+ iSg.bindTarget(gc);
+ // Parameter true to use native side clearing
+ // -> animator background is always white
+ iSg.render(0, 0, iSVGImage, true);
+ }
+ finally
+ {
+ iSg.releaseTarget();
+ }
+ }
+
+ /**
+ * Returns event listener
+ * @return event listener
+ */
+ public synchronized SVGEventListener getEventListener()
+ {
+ return iEventListener;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
+ */
+ public synchronized float getTimeIncrement()
+ {
+ return iDeltaTime;
+ }
+
+ /**
+ * Increases the increment time of the SVGImage.
+ * Increment is done only if the playing state is active.
+ * @see javax.microedition.m2g.SVGImage#incrementTime()
+ */
+ public synchronized void increaseCurrentTime()
+ {
+ if (iState == STATE_PLAYING)
+ {
+ iSVGImage.incrementTime(iDeltaTime);
+ }
+ }
+
+ /**
+ * Checks if playing
+ * @return true if playing
+ */
+ public synchronized boolean isPlaying()
+ {
+ return iState == STATE_PLAYING;
+ }
+
+ /**
+ * Checks if paused
+ * @return true if paused
+ */
+ public synchronized boolean isPaused()
+ {
+ return iState == STATE_PAUSED;
+ }
+
+ /**
+ * Checks if stopped
+ * @return true if stopped
+ */
+ public synchronized boolean isStopped()
+ {
+ return iState == STATE_STOPPED;
+ }
+
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed()
+ * @see javax.microedition.m2g.SVGEventListener#hideNotify()
+ */
+ public synchronized void widgetDisposed(DisposeEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.hideNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellActivated()
+ * @see javax.microedition.m2g.SVGEventListener#showNotify()
+ */
+ public synchronized void shellActivated(ShellEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.showNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellClosed()
+ * @see javax.microedition.m2g.SVGEventListener#hideNotify()
+ */
+ public synchronized void shellClosed(ShellEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.hideNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellDeactivated()
+ * @see javax.microedition.m2g.SVGEventListener#hideNotify()
+ */
+ public synchronized void shellDeactivated(ShellEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.hideNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellDeiconified()
+ * @see javax.microedition.m2g.SVGEventListener#hideNotify()
+ */
+ public synchronized void shellDeiconified(ShellEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.hideNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellIconified()
+ * @see javax.microedition.m2g.SVGEventListener#showNotify()
+ */
+ public synchronized void shellIconified(ShellEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.showNotify();
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.KeyListener#keyPressed()
+ * @see javax.microedition.m2g.SVGEventListener#keyPressed()
+ */
+ public synchronized void keyPressed(KeyEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.keyPressed(e.keyCode);
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.KeyListener#keyReleased()
+ * @see javax.microedition.m2g.SVGEventListener#keyPReleased()
+ */
+ public synchronized void keyReleased(KeyEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.keyReleased(e.keyCode);
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.MouseListener#mouseDown()
+ * @see javax.microedition.m2g.SVGEventListener#pointerPressed()
+ */
+ public synchronized void mouseDown(MouseEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.pointerPressed(e.x, e.y);
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.MouseListener#mouseUp()
+ * @see javax.microedition.m2g.SVGEventListener#pointerReleased()
+ */
+ public synchronized void mouseUp(MouseEvent e)
+ {
+ if (iEventListener != null)
+ {
+ iEventListener.pointerReleased(e.x, e.y);
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick()
+ */
+ public synchronized void mouseDoubleClick(MouseEvent e)
+ {
+ // No implementation needed
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ControlListener#controlResized()
+ * @see javax.microedition.m2g.SVGEventListener#sizeChanged()
+ */
+ public synchronized void controlResized(ControlEvent e)
+ {
+ Rectangle bounds = getBounds();
+ if (iEventListener != null)
+ {
+ iEventListener.sizeChanged(bounds.width, bounds.height);
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ControlListener#controlMoved()
+ */
+ public synchronized void controlMoved(ControlEvent e)
+ {
+ // No implementation needed
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#pause()
+ */
+ public synchronized void pause()
+ {
+ iState = STATE_PAUSED;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#play()
+ */
+ public synchronized void play()
+ {
+ if (iState == STATE_STOPPED)
+ {
+ // Set runnable to be run in UI thread
+ display.asyncExec(iTask);
+ }
+ iState = STATE_PLAYING;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
+ */
+ public synchronized void setEventListener(SVGEventListener eventListener)
+ {
+ iEventListener = eventListener;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
+ */
+ public synchronized void setTimeIncrement(float aDeltaTime)
+ {
+ iDeltaTime = aDeltaTime;
+ }
+
+ /**
+ * @see javax.microedition.m2g.SVGAnimator#stop()
+ */
+ public synchronized void stop()
+ {
+ iState = STATE_STOPPED;
+ }
+}
+
+/**
+ * SVGAnimatorRunnable
+ * Runnable class to perform control redrawing.
+ */
+class SVGAnimatorRunnable implements Runnable
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+
+ private WeakReference iWeakControl;
+
+ //--------------------------------------------------
+ // METHODS
+ //--------------------------------------------------
+
+ public SVGAnimatorRunnable(SVGAnimatorControl aControl)
+ {
+ iWeakControl = new WeakReference(aControl);
+ }
+ /*
+ * @see java.lang.Runnable#run()
+ */
+ public void run()
+ {
+ SVGAnimatorControl control = (SVGAnimatorControl)iWeakControl.get();
+ if (control != null && !control.isDisposed())
+ {
+ try
+ {
+ synchronized (control)
+ {
+ if (control.isPlaying())
+ {
+ // Playing: increase time
+ control.increaseCurrentTime();
+ }
+ if (!control.isStopped())
+ {
+ // Playing or paused: request repainting and new run
+ // If animator has been stopped no new run is requested
+ control.redraw();
+ control.getDisplay().timerExec(
+ (int)(control.getTimeIncrement() * 1000),
+ this);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaUI, "SVGAnimatorRunnable: run() - exception: "
+ + e.toString());
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/ExternalResourceHandler.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+
+/**
+* <p>This interface is used to load external resources that are referenced
+* within a ScalableImage, namely within an SVG document in the case of SVG.
+* In SVGT 1.1, these resources are not required for displaying the SVG document.
+* If no ExternalResourceHandler is registered when creating the image,
+* the engine will retrieve these resources using its own implementation
+* of the requestResource method.</p>
+*<p>
+* The default engine behaviour can be overwritten by passing to {@link javax.microedition.m2g.ScalableImage#createImage createImage}
+* an implementation of this interface as paramater when the default implementation
+* is insufficient. For example, if the SVGImage is loaded from within a
+* Jar file, the implementation will not be able to load images that
+* have relative URIs (e.g., <image xlink:href="myImage.png" />).
+* All the external resources are requested by the engine at the time of
+* the <code>createImage</code> call. Note that SVGT 1.1 does
+* not contain external references to SVG files, therefore an external
+* resource can not contain subsequent external resources. </p>
+*
+* @see javax.microedition.m2g.ScalableImage
+*/
+public interface ExternalResourceHandler
+{
+
+ /**
+ * This method is invoked when an external resource is required by the underlying implementation.
+ * When the request is completed by the implementation of this handler, a notification
+ * must be sent to the SVG engine through the requestCompleted() method of <code>ScalableImage</code>.
+ * To get a synchronous behaviour, requestCompleted() can be called in the implementation
+ * of requestResource. If called later, rendering the document before
+ * completing all the requests will just display the currently available content.
+ * Once the request is completed, the image will have to be redrawn to reflect the newly
+ * available data.
+ * For more details on required resources, please refer to the <code>externalResourcesRequired</code>
+ * attribute description in the SVG specification.
+ *
+ * @param image image that originated the external data request
+ * @param URI the URI for the external resource.
+ */
+ public void requestResource(ScalableImage image, String URI);
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGAnimator.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+import com.nokia.microedition.m2g.M2GSVGAnimator;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Display;
+import com.nokia.microedition.m2g.M2GSVGeSWTAnimator;
+/**
+ * The <code>SVGAnimator</code> class handles automatic rendering of updates and
+ * animations in an <code>SVGImage</code> to a target user interface (UI) component.
+ *
+ * The target component type depends on the Java profile this specification is
+ * implemented on, as described in the <code>createAnimator</code> and
+ * <code>getTargetComponent</code> methods documentation.
+ *
+ * There are two types of rendering updates the <code>SVGAnimator</code> handles:
+ *
+ * <ul>
+ * <li><b>Animation Updates.</b> The <code>SVGAnimator</code> can run animations
+ * and automatically and periodically refreshes its rendering to
+ * reflect the effect of animations.</li>
+ * <li><b>SVGImage Updates.</b> The <code>SVGAnimator</code> updates its rendering
+ * following alterations of the associated <code>SVGImage</code>,
+ * for example if the position of one of the graphical elements is
+ * modified by an API call.</li>
+ * </ul>
+ *
+ * An <code>SVGAnimator</code> instance can be in one of the following states:
+ * <ul>
+ * <li><b>Stopped</b>. This is the initial state. The <code>SVGAnimator</code>
+ * performs no rendering updates. <br/>
+ * Possible transitions:
+ * <ul>
+ * <li>To the <i>playing</i> state, with the <code>play</code> method.</li>
+ * </ul>
+ * </li>
+ *
+ * <li><b>Playing</b>. This is the typical state for an
+ * <code>SVGAnimator</code>. In that state, the <code>SVGAnimator</code>
+ * performs both Animation and SVGImage updates.
+ *
+ * While there are active animations,
+ * the animator updates the rendering at a rate not faster than the one
+ * defined by the <code>setTimeIncrement</code> method. If SVGImage updates are made
+ * (e.g., with calls to the <code>SVGElement</code>
+ * <code>setTrait</code> method, see examples), the rendering is updated at the time of
+ * the next animation rendering.<br />
+ *
+ * When there are no active animations, the animator will update the rendering
+ * after each <code>Runnable</code> passed to the <code>invokeLater</code> or
+ * <code>invokeAndWait</code> methods has finished executing.
+ * <br/>
+ * Possible transitions:
+ * <ul>
+ * <li>To the <i>stopped</i> state, with the <code>stop</code> method.</li>
+ * <li>To the <i>paused</i> state, with the <code>pause</code> method.</li>
+ * </ul>
+ * </li>
+ *
+ * <li><b>Paused</b>. When in that state, the <code>SVGAnimator</code> only
+ * performs SVGImage updates rendering. The animator no longer automatically
+ * advances the SVG document's current time, so rendering reflects the animation
+ * at the document's current time. Note that a change to the document's current
+ * time while in the <i>paused</i> state will trigger a new rendering for the
+ * new current time.
+ * <br/>
+ * Possible transitions:
+ * <ul>
+ * <li>To the <i>stopped</i> state, with the <code>stop</code> method.</li>
+ * <li>To the <i>playing</i> state, with the <code>play</code> method.</li>
+ * </ul>
+ * </li>
+ * </ul>
+ *
+ * <b>Code example:</b><br />
+ * <pre>
+ * // Create an SVGAnimator
+ * SVGImage map = ...; // See the SVGImage documentation.
+ *
+ * SVGAnimator svgAnimator = SVGAnimator.createAnimator(map);
+ *
+ * // Display the associated SVGAnimator component.
+ * // Depends on the platform.
+ *
+ * // =============== AWT Example ===============
+ * Panel panel = ....;
+ * panel.add((Component) svgAnimator.getTargetComponent());
+ * ...
+ *
+ * // =============== MIDP Example ===============
+ * Canvas svgCanvas = (Canvas) svgAnimator.getTargetComponent());
+ * ...
+ *
+ * // Start rendering animations.
+ * svgAnimator.play();
+ * ....
+ * class MapRunnable implements Runnable {
+ * public void run() {
+ * // Perform map updates based on current
+ * // traffic information.
+ * SVGElement statusRect
+ * = map.getDocument().getElementById("statusRect");
+ *
+ * // Reflect that traffic status.
+ * statusRect.setRGBTrait(...); // See setRGBTrait documentation.
+ * }
+ * }
+ *
+ * Runnable mapUpdates = new MapRunnable();
+ * ....
+ *
+ * while (someLoopCondition) {
+ * if(hasMapUpdate) {
+ * svgAnimator.invokeAndWait(mapUpdates);
+ * }
+ * }
+ * </pre>
+ */
+public abstract class SVGAnimator
+{
+ /**
+ * This method creates a new <code>SVGAnimator</code> for the specified SVGImage.
+ *
+ * @param svgImage the <code>SVGImage</code> this animator should render.
+ * @return a new <code>SVGAnimator</code> instance.
+ * @throws NullPointerException if <code>svgImage</code> is null.
+ */
+ public static SVGAnimator createAnimator(SVGImage svgImage)
+ {
+ SVGAnimator tempAnimator = null;
+
+ System.out.println("P-Do In CreateAnimator if.");
+
+ tempAnimator=M2GSVGeSWTAnimator.buildAnimator(svgImage);
+
+ System.out.println("P-Do In CreateAnimator tempAnimator Creif.");
+
+ //tempAnimator=M2GSVGAnimator.buildAnimator(svgImage);
+
+ return tempAnimator;
+ }
+
+ /**
+ * This method creates a new <code>SVGAnimator</code> for the specified SVGImage.
+ *
+ * The following components types must be supported:
+ *
+ * <ul>
+ * <li> "javax.microedition.lcdui.Canvas" on profiles supporting LCDUI</li>
+ * <li> "java.awt.Component" on profiles supporting AWT</li>
+ * </ul>
+ *
+ * On platforms that support the Swing UI component framework, the
+ * "javax.swing.JComponent" string may be used to request a Swing component.
+ *
+ * @param svgImage the <code>SVGImage</code> this animator should render.
+ * @param componentBaseClass the desired base class for the component associated
+ * with the animator. This is used when the platform this specification
+ * is implemented on supports multiple UI component frameworks. If
+ * componentBaseClass is null, this is equivalent to invoking the
+ * <code>createAnimator</code> method with the svgImage parameter only.
+ * @return a new <code>SVGAnimator</code> instance.
+ * @throws NullPointerException if <code>svgImage</code> is null.
+ * @throws IllegalArgumentException if the requested
+ * <code>componentBaseClass</code> is not supported by the
+ * implementation.
+ */
+ public static SVGAnimator createAnimator(
+ SVGImage svgImage, String componentBaseClass)
+ {
+ System.out.println("P-Do In CreateAnimator of SVGAnimator.");
+
+ SVGAnimator tempAnimator = null;
+ tempAnimator=M2GSVGeSWTAnimator.buildAnimator(svgImage);
+// TODO Check for the toolkit?? tempAnimator=M2GSVGAnimator.buildAnimator(svgImage, componentBaseClass);
+ return tempAnimator;
+ }
+
+ /**
+ * The type of target component associated with the animator depends on the
+ * Java profile this specification is implemented on:
+ *
+ * <ul>
+ * <li> javax.microedition.lcdui.Canvas on profiles supporting LCDUI</li>
+ * <li> java.awt.Component on profiles supporting AWT</li>
+ * </ul>
+ * @return target the target component associated with the animator.
+ * @see #createAnimator
+ */
+ public abstract Object getTargetComponent();
+
+ /**
+ * Returns the current time increment used for animation rendering. The
+ * SVGAnimator increments the SVG document's current time by this amount
+ * between each rendering.
+ *
+ * @return the current time increment used for animation rendering. The default
+ * value is 0.1 (100 milliseconds)
+ * @see #setTimeIncrement
+ */
+ public abstract float getTimeIncrement();
+
+ /**
+ * Invoke the input Runnable in the Document update thread and return after
+ * the Runnable has completed.
+ *
+ * @param runnable the new Runnable to invoke.
+ * @throws java.lang.InterruptedException if the current thread is waiting,
+ * sleeping, or otherwise paused for a long time and another thread
+ * interrupts it.
+ * @throws NullPointerException if <code>runnable</code> is null.
+ * @throws IllegalStateException if the animator is in the <i>stopped</i> state.
+ */
+ public abstract void invokeAndWait(
+ Runnable runnable) throws InterruptedException;
+
+ /**
+ * Schedule the input Runnable for execution in the update thread at a later time.
+ *
+ * @param runnable the new Runnable to execute in the Document's update
+ * thread when time permits.
+ * @throws NullPointerException if <code>runnable</code> is null.
+ * @throws IllegalStateException if the animator is in the <i>stopped</i> state.
+ */
+ public abstract void invokeLater(java.lang.Runnable runnable);
+
+ /**
+ * Transitions this <code>SVGAnimator</code> to the <i>paused</i> state.
+ * The <code>SVGAnimator</code> stops advancing the document's current time
+ * automatically (see the SVGDocument's setCurrentTime method). As a result,
+ * animations are paused until another call to the <code>play</code> method
+ * is made, at which points animations resume from the document's current
+ * time. SVGImage updates (through API calls) trigger a rendering update
+ * while the <code>SVGAnimator</code> is in the <i>paused</i> state.
+ *
+ * @throws IllegalStateException if the animator is not in the <i>playing</i>
+ * state.
+ */
+ public abstract void pause();
+
+ /**
+ * Transitions this <code>SVGAnimator</code> to the <i>playing</i>
+ * state. While in the <i>playing</i> state, both Animation and SVGImage
+ * updates trigger rendering updates. Note that a change to the document's
+ * current time while in the playing state will cause the animator to seek
+ * to the new time, and continue to play animations forward.
+ *
+ * @throws IllegalStateException if the animator is not currently in
+ * the <i>stopped</i> or <i>paused</i> state.
+ */
+ public abstract void play();
+
+ /**
+ * Sets the time increment to use for animation rendering.
+ *
+ * @param timeIncrement the minimal time that should ellapse between frame
+ * rendering. In seconds. Should be greater than zero.
+ * @throws IllegalArgumentException if timeIncrement is less than or equal to
+ * zero.
+ * @see #getTimeIncrement
+ */
+ public abstract void setTimeIncrement(float timeIncrement);
+
+ /**
+ * Sets the <code>SVGEventListener</code> associated with this
+ * <code>SVGAnimator</code>.
+ *
+ * @param svgEventListener the new SVGEventListener which will receive
+ * events forwarded by this <code>SVGAnimator</code>. May be null,
+ * in which case events are not forwarded by the <code>SVGAnimator</code>.
+ */
+ public abstract void setSVGEventListener(SVGEventListener svgEventListener);
+
+ /**
+ * Transitions this <code>SVGAnimator</code> to the <i>stopped</i> state.
+ * This causes the <code>SVGAnimator</code> to stop advancing the document's
+ * current time automatically, and no rendering updates are performed while
+ * in <i>stopped</i> state. A call to the <i>play</i> method will cause
+ * the animations to resume from the document's current time.
+ *
+ * @throws IllegalStateException if the animator is not in the <i>playing</i>
+ * or <i>paused</i> state.
+ */
+ public abstract void stop();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGEventListener.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+/**
+ * The <code>SVGEventListener</code> is used to forward platform specific events
+ * to an application. The application can implement this interface and, in
+ * response, dispatch SVG events on an <code>SVGImage</code> object.
+ * <br />
+ * <br>
+ * <br>
+ * <b>Code example:</b>
+ * <pre>
+ *
+ * // Create an SVGAnimator
+ * SVGImage map = ...; // See the SVGImage documentation.
+ * SVGAnimator svgAnimator = SVGAnimator.createAnimator(map);
+ *
+ * // Create an SVGEventListener and set it on the animator.
+ * MIDPSVGEventListener listener = new MIDPSVGEventListener(map, animator);
+ * svgAnimator.setSVGEventListener(listener);
+ *
+ * //
+ * // SVGEventListener sample implementation. Adds a new
+ * // circle every time a key is pressed.
+ * //
+ * class MIDPSVGEventListener implements SVGEventListener, Runnable {
+ * protected SVGDocument svgDocument;
+ * protected SVGAnimator svgAnimator;
+ * protected Vector addToTree = new Vector();
+ *
+ * public MIDPSVGEventListener(SVGImage svgImage, SVGAnimator animator) {
+ * this.svgDocument = svgImage.getDocument();
+ * this.svgAnimator = svgAnimator;
+ * }
+ *
+ * public void keyPressed(int keyCode) {
+ * SVGElement circle = svgDocument.createElementNS(svgNS, "circle");
+ * circle.setFloatTrait("cx", ...);
+ * circle.setFloatTrait("cy", ...);
+ * // ....
+ *
+ * // We synchronized access to the addToTree vector because
+ * // it is accessed from different threads. Because we do
+ * // no know how fast this runnable is going to be scheduled
+ * // by the animator, it is possible that multiple circles
+ * // be created before the run() method is invoked. This explain
+ * // why we put all the newly created circles in a Vector and why
+ * // the run method inserts the current content of the vector
+ * // into the SVG document.
+ * synchronized (addToTree) {
+ * addToTree.addElement(circle);
+ * }
+ *
+ * svgAnimator.invokeLater(this);
+ * }
+ *
+ * public run() {
+ * synchronized (addToTree) {
+ * for (int i = 0; i < addToTree.size(); i++) {
+ * svgDocument.getDocumentElement().appendChild(
+ * (SVGElement) addToTree.elementAt(i));
+ * }
+ * addToTree.clear();
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ */
+public interface SVGEventListener
+{
+ /**
+ * Invoked by the SVG implementation when the associated component is
+ * hidden.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.hideNotify</code> method is invoked.
+ *
+ * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
+ * with type <code>java.awt.event.ComponentEvent.COMPONENT_HIDDEN</code> is
+ * invoked on a <code>java.awt.Component</code>'s component listener.
+ *
+ */
+ void hideNotify();
+
+ /**
+ * Invoked by the SVG implementation when a key was pressed while the
+ * component associated with the <code>SVGAnimator</code> had focus.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.keyPressed()</code> method is
+ * invoked.
+ *
+ * On AWT, this method is invoked when the
+ * <code>java.awt.event.KeyListener.keyPressed()</code> method is invoked on
+ * a <code>java.awt.Component</code>'s key listener.
+ *
+ * @param keyCode the code of the key that was pressed. For MIDP, the code
+ * is the same as for the <code>javax.microedition.lcdui.Canvas</code>
+ * <code>keyPressed</code> <code>keyCode</code> argument. For AWT, the code
+ * is the same as in the <code>java.awt.event.KeyEvent.getKeyCode()</code>
+ * method.
+ */
+ void keyPressed(int keyCode);
+
+ /**
+ * Invoked by the SVG implementation when a key was released while the
+ * component associated with the <code>SVGAnimator</code> had focus.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.keyReleased()</code> method is
+ * invoked.
+ *
+ * On AWT, this method is invoked when the
+ * <code>java.awt.event.KeyListener.keyReleased()</code> method is invoked on
+ * a <code>java.awt.Component</code>'s key listener.
+ *
+ * @param keyCode the code of the key that was pressed. For MIDP, the code
+ * is the same as for the <code>javax.microedition.lcdui.Canvas</code>
+ * <code>keyReleased</code> <code>keyCode</code> argument. For AWT, the code
+ * is the same as in the <code>java.awt.event.KeyEvent.getKeyCode()</code>
+ * method.
+ */
+ void keyReleased(int keyCode);
+
+ /**
+ * Invoked by the SVG implementation when the pointer device (if any), is
+ * pressed over the component associated with the <code>SVGAnimator</code>.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.pointerPressed()</code> method is
+ * invoked. Note that pointer events are only supported on MIDP if the
+ * platform supports them, as defined by the
+ * <code>Canvas.hasPointerEvents</code> method.
+ *
+ * On AWT, this method is invoked when the
+ * <code>java.awt.event.MouseListener.mousePressed()</code> method is invoked on
+ * a <code>java.awt.Component</code>'s mouse listener.
+ *
+ * @param x the x-axis coordinate, in the target component's space (i.e.,
+ * relative to the upper left corner of the component associated with the
+ * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
+ * <code>javax.microedition.midp.Canvas.pointerPressed()</code> method. On
+ * AWT, this is the same value as returned from the
+ * <code>java.awt.event.MouseEvent.getX()</code> method.
+ *
+ * @param y the y-axis coordinate, in the target component's space (i.e.,
+ * relative to the upper left corner of the component associated with the
+ * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
+ * <code>javax.microedition.midp.Canvas.pointerPressed()</code> method. On
+ * AWT, this is the same value as returned from the
+ * <code>java.awt.event.MouseEvent.getY()</code> method.
+ */
+ void pointerPressed(int x, int y);
+
+ /**
+ * Invoked by the SVG implementation when the pointer device (if any), is
+ * released over the component associated with the <code>SVGAnimator</code>.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.pointerReleased()</code> method is
+ * invoked. Note that pointer events are only supported on MIDP if the
+ * platform supports them, as defined by the
+ * <code>Canvas.hasPointerEvents</code> method.
+ *
+ * On AWT, this method is invoked when the
+ * <code>java.awt.event.MouseListener.mouseReleased()</code> method is invoked on
+ * a <code>java.awt.Component</code>'s mouse listener.
+ *
+ * @param x the x-axis coordinate, in the target component's space (i.e.,
+ * relative to the upper left corner of the component associated with the
+ * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
+ * <code>javax.microedition.midp.Canvas.pointerReleased()</code> method. On
+ * AWT, this is the same value as returned from the
+ * <code>java.awt.event.MouseEvent.getX()</code> method.
+ *
+ * @param y the y-axis coordinate, in the target component's space (i.e.,
+ * relative to the upper left corner of the component associated with the
+ * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
+ * <code>javax.microedition.midp.Canvas.pointerReleased()</code> method. On
+ * AWT, this is the same value as returned from the
+ * <code>java.awt.event.MouseEvent.getY()</code> method.
+ */
+ void pointerReleased(int x, int y);
+
+ /**
+ * Invoked by the SVG implementation when the associated component is
+ * shown.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.showNotify</code> method is invoked.
+ *
+ * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
+ * with type <code>java.awt.event.ComponentEvent.COMPONENT_SHOWN</code> is
+ * invoked on a <code>java.awt.Component</code>'s component listener.
+ *
+ */
+ void showNotify();
+
+ /**
+ * Invoked by the SVG implementation when the associated component is
+ * resized.
+ *
+ * On MIDP, this method is invoked when the
+ * <code>javax.microedition.lcdui.Canvas.sizeChanged</code> method is invoked.
+ *
+ * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
+ * with type <code>java.awt.event.ComponentEvent.COMPONENT_RESIZED</code> is
+ * invoked on a <code>java.awt.Component</code>'s component listener.
+ *
+ * @param width the new component width.
+ * @param height the new component height.
+ */
+ void sizeChanged(int width, int height);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGImage.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+//--------------------------------------------------
+//Imports
+//--------------------------------------------------
+import java.io.*;
+import java.io.InputStream;
+import org.w3c.dom.Document;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.svg.SVGElement;
+import com.nokia.microedition.m2g.M2GSVGImage;
+
+/**
+* This class represents an SVG image conforming to the W3C SVG Tiny 1.1 Profile. Applications can access the Document
+* associated with this SVGImage using <code>getDocument</code> method. Using the <code>Document</code> class,
+* it is possible to interact with the content and perform operations such as zoom, pan, and rotate
+* apart from various other functions. The event dispatching methods as described
+* in this class must be used for dispatching user specific events to the underlying SVG engine.
+*
+* <p>
+* The width and height values specified in the SVGImage are only used to compute the initial viewport width/height.
+* It is also important to note that according to the SVG 1.1 specification, if viewBox is not defined, then
+* the preserveAspectRatio attribute is ignored. Therefore, the contents should not be scaled if there is no
+* viewBox defined.
+* </p>
+* <p><b>Note:</b> If the application does not have the necessary privilege rights to access this (SVG)
+* content, a SecurityException may be thrown by the underlying implementation. This is applicable
+* to all the tree navigation (see {@link org.w3c.dom.Node Node}) and trait acessor methods (see {@link org.w3c.dom.svg.SVGElement SVGElement}).
+* Features such as zooming, panning and playing of animations will not be affected.
+* <p>
+* Here is the list of events supported in this specification:
+* <p>
+* <table cellpadding="2" cellspacing="2" border="1"
+ * style="border-collapse: collapse;">
+ * <tbody>
+ * <tr>
+ * <th width="150" valign="top" bgcolor="#999999"><b>Events<br>
+ * </b> </th>
+ * <th valign="top" bgcolor="#999999"><b>Description<br>
+ * </b> </th>
+ * </tr>
+ * <tr>
+ * <td valign="top"> <b>"DOMFocusIn"</b><br>
+ * </td>
+ * <td valign="top"> Occurs when the element comes into focus.<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top"> <b>"DOMFocusOut"</b><br>
+ * </td>
+ * <td valign="top"> Occurs when an element goes out of focus.<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top"> <b>"DOMActivate"</b><br>
+ * </td>
+ * <td valign="top"> Occurs when an element is activated, for instance, through a keypress (select)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top"> <b>"click"</b><br>
+ * </td>
+ * <td valign="top"> Occurs when the pointing device button is clicked over the SVG content (or particular SVGElement) <br>
+ * </td>
+ * </tr>
+ * </tbody>
+ * </table>
+* @see javax.microedition.m2g.ScalableImage
+* @see org.w3c.dom.Document
+*/
+
+public class SVGImage extends ScalableImage
+{
+ //--------------------------------------------------
+ // VARIABLES
+ //--------------------------------------------------
+ private M2GSVGImage iImg = null;
+
+ /**
+ * Constructor
+ */
+ protected SVGImage()
+ {
+ super();
+ }
+
+ /**
+ * This method is used to dispatch an "DOMActivate" event to the document.
+ * The element that has focus is activated, which means that a
+ * "DOMActivate" event with the the currently focused element as target is
+ * dispatched. If no element has focus, this method does not do anything
+ * and no event is dispatched.
+ */
+ public void activate()
+ {
+ iImg.activate();
+ }
+
+ /**
+ * This method creates and loads an empty SVGImage (skeleton) that can be used to
+ * programatically construct a simple SVG image. Note: A root <svg> element
+ * with default viewport size of 100x100 is also created inside this method.
+ *
+ * <p>If an handler is specified, the engine will invoke it for any external resource
+ * referenced in the document. If the handler is set to null, the SVGImage will try to
+ * load images automatically using the engine default implementation,but might not be
+ * able to load all of them.</p>
+ *
+ * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
+ * <image> is set or changed by the application, but the call is made only when the
+ * element is hooked into the document tree i.e. when the ancestors go all the way up to
+ * the root <svg> element. There are two cases:
+ * <ul>
+ * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
+ * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
+ * </ul>
+ * </p>
+ *
+ * @param handler implementation of the ExternalResourceHandler interface
+ * @see javax.microedition.m2g.ExternalResourceHandler
+ *
+ * @return an empty SVGImage
+ */
+ public static SVGImage createEmptyImage(ExternalResourceHandler handler)
+ {
+ M2GSVGImage image = M2GSVGImage.buildEmptyImage(handler);
+ if (image == null)
+ {
+ throw new NullPointerException();
+ }
+ SVGImage proxy = new SVGImage();
+ proxy.iImg = image;
+ return proxy;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public static ScalableImage createImage(
+ InputStream stream, ExternalResourceHandler handler) throws IOException
+ {
+ M2GSVGImage image = M2GSVGImage.buildImage(stream, handler, null, null);
+ if (image == null)
+ {
+ throw new NullPointerException();
+ }
+ SVGImage proxy = new SVGImage();
+ proxy.iImg = image;
+ return proxy;
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public static ScalableImage createImage(
+ String url, ExternalResourceHandler handler) throws IOException
+ {
+ M2GSVGImage image = M2GSVGImage.buildImage(url, handler);
+ if (image == null)
+ {
+ throw new NullPointerException();
+ }
+ SVGImage proxy = new SVGImage();
+ proxy.iImg = image;
+ return proxy;
+ }
+
+ /**
+ * This method is used to dispatch a mouse event of the specified <code>type</code> to the
+ * document. The mouse position is given as screen coordinates <code>x, y</code>. If the
+ * x, y values are outside the viewport area or no target is available for the x, y
+ * coordinates, the event is not dispatched. Note that when a "click" event is dispatched,
+ * a "DOMActivate" is automatically dispatched by the underlying implementation. The only
+ * required mouse event type is "click". Therefore, if an unsupported type is specified,
+ * a DOMException with error code NOT_SUPPORTED_ERR is thrown.
+ *
+ *
+ * @param type the type of mouse event.
+ * @param x the x location of the mouse/pointer in viewport coordinate
+ * system.
+ * @param y the y location of the mouse/pointer in viewport coordinate
+ * system.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR: if the event <code>type</code> is not supported.
+ * @throws NullPointerException if <code>type</code> is null.
+ * @throws IllegalArgumentException if the x or y values are negative.
+ *
+ */
+ public void dispatchMouseEvent(String type, int x, int y) throws DOMException
+ {
+ iImg.dispatchMouseEvent(type, x, y);
+ }
+
+ /**
+ * Returns the associated <code>Document</code>.
+ * @return the associated <code>Document</code>.
+ */
+ public Document getDocument()
+ {
+ return iImg.getDocument();
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public int getViewportHeight()
+ {
+ return iImg.getViewportHeight();
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public int getViewportWidth()
+ {
+ return iImg.getViewportWidth();
+ }
+
+ /**
+ * This method triggers a "DOMFocusIn" event with the specified element as
+ * the event target. That element becomes the element with focus. This
+ * method also triggers a "DOMFocusOut" event with the element which
+ * previous had focus as target. When the activate method is called, a
+ * "DOMActivate" event is triggered with the currently focused element as
+ * the target. The initial focus is always <code>null</code> and setting
+ * <code>null</code> will remove the current focus.
+ *
+ * @param element the element to set the focus on.
+ * @throws DOMException with error code WRONG_DOCUMENT_ERR: if invalid element is passed (for
+ * ex: an element that does not belong to this document).
+ */
+ public void focusOn(SVGElement element) throws DOMException
+ {
+ iImg.focusOn(element);
+ }
+
+ /**
+ * Increments the animation or media timeline for this SVGImage (in seconds). As the name
+ * implies, this method is intended to move only forward in the timeline and typically should be used
+ * to animate SVG content when the SVGAnimator class in not used. Setting negative values will throw
+ * an Exception. It is important to note that setting large increments of time would result in
+ * skipping parts of the animation as per the SVG animation model.
+ *
+ * @param seconds the value of time to increment in seconds.
+ * @throws IllegalArgumentException if the specified time is negative.
+ */
+ public void incrementTime(float seconds)
+ {
+ iImg.incrementTime(seconds);
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public void requestCompleted(
+ String URI, InputStream resourceData) throws IOException
+ {
+ iImg.requestCompleted(URI, resourceData);
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public void setViewportHeight(int height)
+ {
+ iImg.setViewportHeight(height);
+ }
+
+ /**
+ * @see javax.microedition.m2g.ScalableImage
+ */
+ public void setViewportWidth(int width)
+ {
+ iImg.setViewportWidth(width);
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/ScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+import com.nokia.microedition.m2g.M2GScalableGraphics;
+
+/**
+ * This is the fundamental class for 2D rendering. The ScalableGraphics context class
+ * provides and handles all the rendering capability within this package. In other
+ * words, the rendering can only be achieved through the render method provided
+ * in this class. Note that the ScalableGraphics instance must be bound to the rendering
+ * target prior to calling the render method. The implementation must clip to the
+ * viewport boundaries.
+*/
+public class ScalableGraphics
+{
+ // Defines a low rendering quality level.
+ public static final int RENDERING_QUALITY_LOW = 1;
+ // Defines a high rendering quality level.
+ public static final int RENDERING_QUALITY_HIGH = 2;
+
+ private M2GScalableGraphics iSg;
+
+ /**
+ * Constructor
+ */
+ private ScalableGraphics()
+ {
+ System.out.println("P-In ScalableGraphics() Creating iSg" );
+ iSg = new M2GScalableGraphics();
+ System.out.println("P-OUT ScalableGraphics() Creating iSg" );
+ }
+
+ /**
+ * Binds the given Graphics as the rendering target of this ScalableGraphics context. The
+ * type of the Graphics object depends on the Java profile that this specification is
+ * implemented on, as follows:
+ * <ul>
+ * <li> javax.microedition.lcdui.Graphics on profiles supporting LCDUI;</li>
+ * <li> java.awt.Graphics on profiles supporting AWT;</li>
+ * <li> either of the above on profiles supporting both AWT and LCDUI.</li>
+ * </ul>
+ * @param target the object (Graphics) to receive the rendered image.
+ * @throws NullPointerException if <code>target</code> is null.
+ * @throws IllegalArgumentException if <code>target</code> is invalid.
+ * @throws IllegalStateException if <code>target</code> is already bound.
+ */
+ public void bindTarget(java.lang.Object target)
+ {
+ System.out.println("P-In Bind Target of ScalableGraphics.java" );
+ iSg.bindTarget(target);
+ System.out.println("P-Out Bind Target of ScalableGraphics.java" );
+ }
+
+ /**
+ * Retrieve a new instance of ScalableGraphics that can be associated to
+ * an application.
+ * <p>
+ * @return the newly created <code>ScalableGraphics</code> instance.
+ */
+ public static ScalableGraphics createInstance()
+ {
+ return new ScalableGraphics();
+ }
+
+ /**
+ * Flushes the rendered ScalableImage to the currently bound target and then releases
+ * the target. This ensures that the ScalableImage is actually made visible on the target
+ * that was set in bindTarget. Otherwise, the image may or may not become visible.
+ * @throws IllegalStateException if <code>target</code> is not bound.
+ */
+ public void releaseTarget()
+ {
+ System.out.println("P-In Release Target of ScalableGraphics.java" );
+ iSg.releaseTarget();
+ System.out.println("P-Out Release Target of ScalableGraphics.java" );
+ }
+
+ /**
+ * Renders the specified ScalableImage using the supplied anchor point. The anchor point given
+ * is relative to the upper left corner of the rendering surface. It is important to note that
+ * the content is made visible or flushed to the display only after a call is made to
+ * <code>releaseTarget</code>.
+ * @param x the X coordinate of the anchor point, in pixels.
+ * @param y the Y coordinate of the anchor point, in pixels.
+ * @param image the ScalableImage to be rendered.
+ * @throws NullPointerException if <code>image</code> is null.
+ * @throws IllegalStateException if <code>target</code> is not bound.
+ * @see #releaseTarget
+ */
+ public void render(int x, int y, ScalableImage image)
+ {
+ System.out.println("P-In Render Target of ScalableGraphics.java" );
+ iSg.render(x,y, image);
+ System.out.println("P-Out Render Target of ScalableGraphics.java" );
+ }
+
+ /**
+ * Set the quality of rendering in the ScalableGraphics context. It can take one of the values,
+ * RENDERING_QUALITY_LOW or RENDERING_QUALITY_HIGH. Default=RENDERING_QUALITY_HIGH. The
+ * implementation of these quality levels is implementation dependent and should be mapped
+ * to definitions in SVG spec (shape, text, image and color rendering).
+ * @param mode this value indicates the quality of rendering required.
+ * @throws IllegalArgumentException if the <code>mode</code> is invalid.
+ */
+
+ public void setRenderingQuality(int mode)
+ {
+ iSg.setRenderingQuality(mode);
+ }
+
+ /**
+ * Set the transparency in the ScalableGraphics context with the supplied alpha value.
+ * Alpha value must be a floating point number in the range [0.0, 1.0]. The source pixels
+ * are always combined with destination pixels using the <i>Source Over Destination</i>
+ * rule [Porter-Duff]. In this context, the Source Over Destination rule has the following
+ * properties: a fully opaque pixel in the source must replace the destination pixel, a
+ * fully transparent pixel in the source must leave the destination pixel unchanged, and
+ * a semitransparent pixel in the source must be alpha blended with the destination pixel using
+ * the supplied value. The default alpha value is 1.0 (fully opaque), when not specified.
+ *
+ * @param alpha the constant alpha value to be used for rendering.
+ *
+ * @throws IllegalArgumentException if <code>alpha</code> is out of range.
+ */
+ public void setTransparency(float alpha)
+ {
+ iSg.setTransparency(alpha);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/javax/microedition/m2g/ScalableImage.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.m2g;
+
+import java.io.IOException;
+
+/**
+ * This class models images in vector format, such as the Scalable Vector
+ * Graphics (SVG) image format. Therefore, it is required that all classes
+ * representing "scalable" images extend this class.
+ * @see javax.microedition.m2g.SVGImage
+ */
+public abstract class ScalableImage
+{
+ /**
+ * Constructor
+ */
+ protected ScalableImage()
+ {
+ }
+
+ /**
+ * This method creates and loads a ScalableImage (e.g. SVG) from the specified stream.
+ * A ScalableImage can only be rendered using the render() method in the ScalableGraphics
+ * context.The image size is determined by the content specification
+ * (eg: width/height attributes on root SVG element). The default viewport size
+ * of 100-by-100 pixels is used when the size is unspecified. This method will throw an exception
+ * when the image is in error. For SVG document, the document is in error when:
+ * <ul>
+ * <li>the SVG document does not conform to the XML 1.0 specification</li>
+ * <li>an element has an attribute or property value which is not permissible according to the SVG specification </li>
+ * <li>the required or mandatory attributes according to the SVG specification are missing</li>
+ * <li>the document contains circular references on the <use> element</li>
+ * <li>the document contains <image> element(s) with local references </li>
+ * <li>the document contains elements with duplicate Id's</li>
+ * <li>the document contains animation(s) in error</li>
+ * </ul>
+ *
+ * <p>If an <code>handler</code> is specified, the engine will invoke it for any
+ * external resource referenced in the document. However, please note that data URIs
+ * (for ex: base64 encoded images like <image xlink:href="data:image/png;base64,/9j/4AAQ..."/>)
+ * are required to be decoded by the engine, and therefore the handler will not be invoked
+ * in such cases. All these requests must occur before createImage returns, and the
+ * engine must only make one call if there exist multiple resources
+ * with the same URI. If the <code>handler</code> is set to null, the ScalableImage
+ * will try to load images automatically using the engine's default implementation,
+ * but might not be able to load all of them. For example, if the ScalableImage
+ * is loaded from a file in a Jar file, the implementation will not be able
+ * to load images that have relative URIs (ex; <image xlink:href="myImage.png" />).
+ * If the handler is not able to locate a requested resource, it informs the SVG engine
+ * by calling the requestCompleted method with <code>null</code> for resourceData. </p>
+ *
+ * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
+ * <image> is set or changed by the application, but the call is made only when the
+ * element is hooked into the document tree i.e. when the ancestors go all the way up to
+ * the root <svg> element. There are two cases:
+ * <ul>
+ * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
+ * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
+ * </ul>
+ * </p>
+ *
+ * @param stream The stream from which the SVG content should be read.
+ * @param handler implementation of the ExternalResourceHandler interface
+ * @see javax.microedition.m2g.ExternalResourceHandler
+ *
+ * @return the loaded ScalableImage.
+ * @throws IOException if an error occurs while loading the content.
+ * @throws NullPointerException if <code>stream</code> is null.
+ */
+ public static ScalableImage createImage(java.io.InputStream stream,
+ ExternalResourceHandler handler) throws IOException
+ {
+ return SVGImage.createImage(stream, handler);
+ }
+
+
+ /**
+ * This method creates and loads a ScalableImage (e.g. SVG) with the specified
+ * URI. A ScalableImage can only be rendered using the render() method in the ScalableGraphics
+ * context.The image size is determined by the content specification
+ * (eg: width/height attributes on root SVG element). The default viewport size
+ * of 100-by-100 pixels is used when the size is unspecified. This method will throw an
+ * exception when the image is in error. For SVG document, the document is in error when:
+ * <ul>
+ * <li>the SVG document does not conform to the XML 1.0 specification</li>
+ * <li>an element has an attribute or property value which is not permissible according to the SVG specification </li>
+ * <li>the required or mandatory attributes according to the SVG specification are missing</li>
+ * <li>the document contains circular references on the <use> element</li>
+ * <li>the document contains <image> element(s) with local references </li>
+ * <li>the document contains elements with duplicate Id's</li>
+ * <li>the document contains animation(s) in error</li>
+ * </ul>
+ *
+ *
+ * <p>If an <code>handler</code> is specified, the engine will invoke it for any
+ * external resource referenced in the document. However, please note that data URIs
+ * (for ex: base64 encoded images like <image xlink:href="data:image/png;base64,/9j/4AAQ..."/>)
+ * are required to be decoded by the engine, and therefore the handler will not be invoked
+ * in such cases. All these requests must occur before createImage returns, and the
+ * engine must only make one call if there exist multiple resources
+ * with the same URI. If the <code>handler</code> is set to null, the ScalableImage
+ * will try to load images automatically using the engine's default implementation,
+ * but might not be able to load all of them. For example, if the ScalableImage
+ * is loaded from a file in a Jar file, the implementation will not be able
+ * to load images that have relative URIs (ex: <image xlink:href="myImage.png" />).
+ * If the handler is not able to locate a requested resource, it informs the SVG engine
+ * by calling the requestCompleted method with <code>null</code> for resourceData. </p>
+ *
+ * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
+ * <image> is set or changed by the application, but the call is made only when the
+ * element is hooked into the document tree i.e. when the ancestors go all the way up to
+ * the root <svg> element. There are two cases:
+ * <ul>
+ * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
+ * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
+ * </ul>
+ * </p>
+ *
+ * <p>
+ * If the platform implementation supports the JSR-75 FileConnection, then the file: URLs
+ * as used by JSR-75 shall be supported and the images are loaded from files identified
+ * by this locator. This can be used to load possible DRM protected image files from the
+ * file system.
+ *
+ * @param url A string in URL syntax that identifies the image source.
+ * @param handler implementation of the ExternalResourceHandler interface
+ * @see javax.microedition.m2g.ExternalResourceHandler
+ *
+ * @return the loaded ScalableImage
+ * @throws IOException if an error occurs while loading the SVG content.
+ * @throws NullPointerException if <code>URL</code> is null.
+ * @throws java.lang.IllegalArgumentException if the specified locator is of unsupported type.
+ * @throws SecurityException if the application does not have the privilege rights to access
+ * the contents of this resource.
+ *
+ */
+ public static ScalableImage createImage(String url,
+ ExternalResourceHandler handler) throws IOException
+ {
+ return SVGImage.createImage(url, handler);
+ }
+
+ /**
+ * This method returns the ScalableImage's viewport height. The initial
+ * viewport height is taken from the "height" value specified in the Scalable Image. The value
+ * returned is always in pixels. If the specified height is defined in percentages, the
+ * values are mapped to the default view port size of 100x100. If the viewport height
+ * is explicitly changed by the application, then the percentages are ignored and the content
+ * is made to fit to this new viewport height.
+ *
+ * @return the current height of this ScalableImage.
+ * @see #setViewportHeight
+ */
+ public abstract int getViewportHeight();
+
+ /**
+ * This method returns the ScalableImage's viewport width. The initial
+ * viewport width is taken from the "width" value specified in the Scalable Image. The value
+ * returned is always in pixels. If the specified width is defined in percentages, the
+ * values are mapped to the default view port size of 100x100. If the viewport width
+ * is explicitly changed by the application, then the percentages are ignored and the content
+ * is made to fit to this new viewport width.
+ *
+ * @return the current width of this ScalableImage.
+ * @see #setViewportWidth
+ */
+ public abstract int getViewportWidth();
+
+ /**
+ * Once the requested external resource is available, the application forwards this information
+ * (resourceData) to the SVG engine. If this method is called a second time for a same URL of a
+ * same <code>SVGImage</code>, the engine will replace the current resource data with the new
+ * one. <b>Note:</b> Setting <code>null</code> for resourceData indicates that the requested resource
+ * could not be fetched by the <code>ResourceHandler</code> or application, and in this
+ * event the SVG engine will not make further attempts to load this resource.
+ *
+ * @param URI URI that was requested through requestExternalResource
+ * @param resourceData inputstream containing the external resource
+ *
+ * @see javax.microedition.m2g.ExternalResourceHandler
+ *
+ * @throws IOException if an error occurs while loading the resource.
+ * @throws NullPointerException if URL is null.
+ */
+ public abstract void requestCompleted(String URI, java.io.InputStream resourceData) throws IOException;
+
+ /**
+ * This method sets the new (viewport) height of this ScalableImage.
+ *
+ * @param height the new height to be set.
+ * @see #getViewportHeight
+ * @throws IllegalArgumentException if height is negative.
+ */
+ public abstract void setViewportHeight(int height);
+
+ /**
+ * This method sets the new (viewport) width of this ScalableImage.
+ * The viewport is the area where the ScalableImage is rendered. Any parts
+ * of the viewport that lie outside the boundaries of the target clipping
+ * rectangle are clipped. The viewport upper left corner (x, y) is given
+ * relative to the upper left corner of the target rendering surface.
+ *
+ * @param width the new width to be set.
+ * @see #getViewportWidth
+ * @throws IllegalArgumentException if width is negative.
+ */
+ public abstract void setViewportWidth(int width);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/DOMException.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package org.w3c.dom;
+
+/**
+ *
+ */
+public class DOMException extends RuntimeException
+{
+
+ /**
+ * If a node is used in a different document than the one that created it
+ * (that doesn't support it).
+ */
+ public static final short WRONG_DOCUMENT_ERR = 4;
+
+ /**
+ * If index or size is negative, or greater than the allowed value.
+ */
+ public static final short INDEX_SIZE_ERR = 1;
+
+ /**
+ * If any Node is inserted somewhere it doesn't belong.
+ */
+ public static final short HIERARCHY_REQUEST_ERR = 3;
+
+ /**
+ * If an attempt is made to modify an object where modifications are not allowed.
+ */
+ public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
+
+ /**
+ * If an attempt is made to reference a {@link org.w3c.dom.Node Node} in a context where it does not exist. See {@link org.w3c.dom.Node#insertBefore insertBefore} for example.
+ */
+ public static final short NOT_FOUND_ERR = 8;
+
+ /**
+ * If the implementation does not support the requested type of object or operation.
+ */
+ public static final short NOT_SUPPORTED_ERR = 9;
+
+ /**
+ * If an attempt is made to use an object that is not, or is no longer, usable.
+ */
+ public static final short INVALID_STATE_ERR = 11;
+
+ /**
+ * If an attempt is made to modify the type of the underlying object.
+ */
+ public static final short INVALID_MODIFICATION_ERR = 13;
+
+ /**
+ * If a parameter or an operation is not supported by the underlying object.
+ */
+ public static final short INVALID_ACCESS_ERR = 15;
+
+ /**
+ * If the type of an object is incompatible with the expected type of the parameter associated to the object.
+ */
+ public static final short TYPE_MISMATCH_ERR = 17;
+
+ /**
+ *
+ * The member variable to store exception's code, like INVALID_ACCESS_ERR.
+ */
+ public short code;
+
+ /**
+ * Constructs a DOMException with a detailed message.
+ *
+ * @param code the exception's error code.
+ * @param message the exception's descriptive message.
+ */
+ public DOMException(final short code,
+ final String message)
+ {
+ super(message);
+ this.code = code;
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/Document.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package org.w3c.dom;
+
+/**
+ * The Document interface represents an XML Document.
+ *
+ * <p>This interface is a subset of the Document interface defined
+ * in the <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html">
+ * DOM Level 3 Core</a>.</p>
+ *
+ *
+ * <p>Note the behavior of the following methods from the
+ * <code>Node</code> interface when called on a <code>Document</code>
+ * object:
+ *
+ * <ul>
+ * <li>getParentNode returns <code>null</code></li>
+ * <li>appendChild throws <code>HIERARCHY_REQUEST_ERR</code></li>
+ * <li>insertBefore throws <code>HIERARCHY_REQUEST_ERR</code></li>
+ * <li>removeChild throws <code>NOT_SUPPORTED_ERR</code></li>
+ * </ul>
+ * </p>
+ *
+ */
+public interface Document extends Node
+{
+
+ /**
+ * Create a new <code>Element</code> based on the specified
+ * (qualified) SVG tag name. This JSR does not require multiple
+ * namespaces and may throw a <code>DOMException</code> with a
+ * code of <code>NOT_SUPPORTED_ERR</code> if the URI is not the
+ * SVG namespace URI, or if the specified name is not a valid SVG
+ * Tiny element name. Only the following elements must be supported:
+ * <rect>, <circle>, <ellipse>, <line>,
+ * <path> <use> <image> <text>,
+ * <a> and <g>.
+ *
+ * @param namespaceURI the namespace uri for the newly created
+ * element. This should always be the SVG namespace URI "http://www.w3.org/2000/svg".
+ * @param qualifiedName the qualified name for the newly created
+ * element (For example: "rect", to create a <rect> element)
+ *
+ * @return the newly created SVG Element.
+ *
+ * @throws DOMException NOT_SUPPORTED_ERR if the type of element is
+ * not supported by the implementation. JSR 226 only requires creation
+ * support for some of the SVG namespace elements and only for a limited
+ * number of local names in that namespace (see above documentation).Therefore, in
+ * a conformant JSR 226 implementation, trying to create elements with a namespace
+ * URIs other than the SVG namespace URI and with a qualified name not in the list
+ * of required qualified names may result in this exception being thrown.
+ * @throws NullPointerException if <code>namespaceURI</code> or
+ * <code>qualifiedName</code> is null.
+ *
+ */
+ public Element createElementNS(String namespaceURI, String qualifiedName)
+ throws DOMException;
+
+ /**
+ * Return a child element of this document Node which corresponds to the top-most
+ * tag in XML file. For SVG files it must be <code>SVGSVGElement</code>, but return
+ * type is Element for DOM Core compatibility and to allow for future extensions.
+ *
+ * @return the root <code>Element</code> associated with this
+ * document.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Element getDocumentElement();
+
+ /**
+ * Return the <code>Element</code> in the current document with
+ * the given unique ID. If no such element exists, this returns null.
+ *
+ * @param id the ID of the object to be retrieved.
+ * @return the Element that matches with the given ID or
+ * <code>null</code> if the ID is not present.
+ *
+ * @throws NullPointerException if id is null
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Element getElementById(String id);
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/Element.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom;
+
+
+/**
+ * This empty interface is defined to ensure compatibility with the DOM
+ * specification, and also to be used as a return type of some Document
+ * methods.
+ *
+ */
+public interface Element extends Node
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/Node.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package org.w3c.dom;
+
+/**
+ * The Node interface describes generic nodes in an SVG document tree.
+ *
+ * <p>This interface is a subset of the Node interface defined
+ * in the <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html">
+ * DOM Level 3 Core</a>.</p>
+ *
+ */
+
+public interface Node
+{
+
+
+ /**
+ * Returns the namespace URI of the Node.
+ *
+ * @return the namespace URI of the Node.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public String getNamespaceURI();
+
+ /**
+ * Returns the local part of the qualified name of this node. If the node is of type SVGElement, this returns the tag name without a prefix.
+ * But, if the node is of type Document then <code>null</code> is returned.
+ * @return the local part of the qualified name of this node.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public String getLocalName();
+
+ /**
+ * Returns the parent <code>Node</code> of this <code>Node</code>.
+ *
+ * @return the parent node or null if there is no parent (i.e. if a node has
+ * just been created and not yet added to the tree, or if it has been removed
+ * from the tree, this is null).
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Node getParentNode();
+
+ /**
+ * Appends a child to this <code>Node</code>.
+ *
+ * @param newChild the <code>Node</code> to be appended to this
+ * <code>Node</code>. This is equivalent to insertBefore(newChild,null)
+ * @return the added <code>Node</code>.
+ *
+ * @throws DOMException with error code HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children
+ * of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself,
+ * or if this node is of type Document and the DOM application attempts to append a second Element node.
+ * @throws DOMException with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than
+ * the one that created this node.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the
+ * child is of a type that cannot be created with createElementNS.
+ * @throws DOMException with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into
+ * error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
+ * @throws NullPointerException if <code>newChild</code> is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Node appendChild(Node newChild) throws DOMException;
+
+ /**
+ * Removes the specified child associated with this Node. Elements that have ids cannot be
+ * removed from the tree.
+ *
+ * @param oldChild the <code>Node</code> that is to be removed.
+ * @return the node removed.
+ * @throws DOMException with error code NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR: if this node is of type Document or if the
+ * child, or any of its descendants, is of a type that cannot be created with createElementNS.
+ * @throws DOMException with error code INVALID_ACCESS_ERR: if the element being removed or one of its decendants
+ * have non-null id.
+ * @throws NullPointerException if <code>oldChild</code> is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Node removeChild(Node oldChild) throws DOMException;
+
+ /**
+ * Inserts newChild before refChild in the child list for this node. If refChild is null,
+ * newChild is inserted at the end of the list. If the newChild is already part of the
+ * tree, it is first removed.
+ *
+ *
+ * @param newChild the child to add
+ * @param refChild the child before which the new child should be added.
+ * @return the node being inserted.
+ * @throws DOMException with error code HIERARCHY_REQUEST_ERR: if this node is of a type that does not allow children
+ * of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself,
+ * or if this node is of type Document and the DOM application attempts to append a second Element node.
+ * @throws DOMException with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than
+ * the one that created this node.
+ * @throws DOMException with error code NOT_FOUND_ERR: raised if refChild is not a child of this node.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the
+ * child is of a type that cannot be created with createElementNS.
+ * @throws DOMException with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into
+ * error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
+ * @throws NullPointerException if <code>newChild</code> is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException;
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/events/Event.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.events;
+
+import java.lang.String;
+
+/**
+ * The Event interface is used to provide contextual information about an event to the handler
+ * processing the event. An object which implements the Event interface is passed as the first
+ * parameter to the {@link org.w3c.dom.events.EventListener#handleEvent handleEvent} call. If
+ * an event target is an element instance (see <a href="http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGElementInstance">SVGElementInstance</a>), the currentTarget is an implementation of EventTarget
+ * that does not implement the Node interface.
+ */
+
+public interface Event
+{
+ /**
+ * This method is used to get the current target of this event.
+ * In SVG Tiny, this is always an object to which event listener was attached.
+ *
+ * @return the event's <code>EventTarget</code>.
+ */
+ public EventTarget getCurrentTarget();
+
+ /**
+ * This method returns the event type information. The name of the event is case-sensitive.
+ * The following event types are supported:
+ * <br>
+ * <b>click</b>, <b>DOMActivate</b>, <b>DOMFocusIn</b>, <b>DOMFocusOut</b> (defined DOM Events);
+ * @return the event's type.
+ */
+ public String getType();
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/events/EventListener.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.events;
+
+/**
+* This interface represents an event listener, and is a subset of the EventListener interface
+* defined in the <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/idl-definitions.html">
+* DOM Level 2 Event model</a>.
+* <p>
+* This interface must be implemented and registered on an EventTarget using the
+* {@link org.w3c.dom.events.EventTarget#addEventListener addEventListener} method to be notified
+* about events that occur on or bubble through the event target.
+*
+*
+*/
+
+public interface EventListener
+{
+
+ /**
+ * This method is called whenever an event occurs of the type for which the
+ * EventListener interface was registered.. The Event object contains the
+ * necessary information pertaining to the event, such as its
+ * target and type.
+ *
+ * @param evt the Event object containing necessary event information.
+ */
+ public void handleEvent(Event evt);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/events/EventTarget.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.events;
+
+import org.w3c.dom.DOMException;
+
+/**
+*
+* This interface represents an event target, and is a subset of the EventTarget interface
+* defined in the <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/idl-definitions.html">
+* DOM Level 2 Event model</a>.
+* <br>
+* This interface is implemented by an object (SVGElements) that can notify listeners about events and allows
+* registration and removal of {@link org.w3c.dom.events.EventListener EventListener} objects.
+*
+*
+*/
+
+public interface EventTarget
+{
+
+ /**
+ * This method registers the specified listener with the event target. If an EventListener is added to an EventTarget
+ * while it is processing an event, it will not be triggered by the current actions. If multiple identical EventListeners
+ * are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause
+ * the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener
+ * method.
+ *
+ * @param type The type of event to listen to.
+ * @param listener Will be notified when an event of the desired type happens on this target or one of its descendant.
+ * @param useCapture If true, the listener will be called during the event flow capture phase. Otherwise, the listener
+ * will be called during the bubble phase. If the event's target is this target, then the listener will be called during the 'at target' phase of event flow.
+ *
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if useCapture is true since capture phase is not supported in SVG Tiny.
+ * @throws NullPointerException if <code>listener</code> is null.
+ * @throws NullPointerException if <code>type</code> is null.
+ */
+ public void addEventListener(String type, EventListener listener, boolean useCapture);
+
+ /**
+ * This method removes the specified listener from the event target. If an EventListener is removed
+ * from an EventTarget while it is processing an event, it will not be triggered by the current actions. Calling removeEventListener
+ * with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
+ *
+ * @param type The type of event that was listened to.
+ * @param listener The listener that was previously registered.
+ * @param useCapture If true, the listener was listening to events in the capture phase of event flow, otherwise the listener
+ * was listening to events in the bubble phase.
+ *
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if useCapture is true since capture phase is not supported in SVG Tiny.
+ * @throws NullPointerException if <code>listener</code> is null.
+ * @throws NullPointerException if <code>type</code> is null.
+ */
+ public void removeEventListener(String type, EventListener listener, boolean useCapture);
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGAnimationElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * This interface represents an Animation element, which contains methods to control the timing of
+ * animations.
+ */
+public interface SVGAnimationElement extends SVGElement
+{
+
+ /**
+ * Creates a begin instance time for the current time plus or minus the passed offset.
+ * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
+ * begin instance times list</a>.
+
+ *
+ * @param offset The offset in seconds at which to begin the element.
+ */
+ public void beginElementAt(float offset);
+
+ /**
+ * Creates an end instance time for the current time plus or minus the passed offset.
+ * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
+ * end instance times list</a>.
+
+ *
+ * @param offset The offset in seconds at which to end the element.
+ */
+ public void endElementAt(float offset);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1051 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+import org.w3c.dom.DOMException;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.events.EventTarget;
+
+/**
+ * This interface represents an SVG element in the document tree. Element's id can be set only
+ * if it does not already have an id. {@link org.w3c.dom.DOMException DOMException} with error
+ * code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing id.
+ * Elements with non-null id can be inserted, but <b>cannot be removed</b> from the DOM tree
+ * (see {@link org.w3c.dom.Node#removeChild removeChild}). This interface also provides methods
+ * to traverse elements in the DOM tree.
+ *
+ * <p>
+ * This interface can also be used read and manipulate the value of "traits" associated with this
+ * SVGElement. Each <i>trait</i> corresponds to an attribute or property,which is parsed and
+ * understood by the element and in most cases animatable. Unlike attributes, each element has a
+ * well-defined set of traits and attempting to access undefined trait is an error. Also unlike
+ * attributes traits are typed and their values are normalized; for instance SVG path specification
+ * is parsed and all path commands are converted to their absolute variants, it is not possible to
+ * say through the value of the trait if a path command was absolute or relative. When getting and
+ * setting trait values, accessor of the correct type must be used or exception will be thrown.
+ * </p>
+ * <p>
+ * Initial trait values come from parsing corresponding attributes. If value is not specified, but
+ * corresponing attribute (or property for environments where styling is supported) is inherited,
+ * inherited value is returned as a result of the trait query method. If it is not inherited, default
+ * value is returned. Default values are also returned in the case when there is no parent to inherit
+ * from, for ex: when you create a new element, set a trait value to 'inherit', but there is no parent for
+ * inheritance. It is important to note that the value which is returned is always a base value (i.e. before animation
+ * is applied), and this is true for both static and animated content.
+ * </p>
+ * <p>
+ * Setting a trait value has the same effect as changing a corresponding attribute, but trait
+ * setters can operate on typed values. The value which is modified is always a base value.
+ * For inheritable traits the trait value can always be set to "inherit"
+ * (but querying the value will always return the actual inherited value as explained above).
+ * </p>
+ * <p>
+ * There are two situations where the various trait setter methods (such as
+ * setTrait, setFloatTrait or setPathTrait methods) consider a value
+ * invalid and throw a DOMException with the INVALID_ACCESS_ERR code.
+ * The first situation is when the trait value is invalid with regards to
+ * its definition (for example, trying to set the "stroke-linejoin" trait
+ * to "foo" would cause this exception).
+ * The second situation is when the trait value is invalid with regards to
+ * animations currently applied to the trait. The value is considered
+ * invalid because it would put the animation, and therefore the document,
+ * in an error state. For example, if a <path> element has animations on
+ * its "d" attribute, trying to change the "d" attribute to a value
+ * incompatible with the animations will cause the exception to happen.
+ * </p>
+ *
+ * <h3>Traits supported in this specification, SVG Tiny 1.1 DOM</h3>
+ *
+ *
+ * <p>The table below shows the list of attributes and properties that SVG Tiny
+ * DOM 1.1 implementations must support. Each light gray section lists one or
+ * multiple elements for which the subsequent attributes or properties
+ * apply. Each attribute row lists the allowed getter and setter (s). The last
+ * column specifies the default values that must be used for each attribute or
+ * property.</p>
+ * <p><b>Note:</b> For 'REQUIRED' attributes, there are two cases:
+ *
+ * <ul>
+ * <li>i) The document is in error, if this attribute was not present at the time of loading.</li>
+ * <li>ii) When using uDOM API, the specified default value (in parenthesis) must be used.</li>
+ * </ul>
+ * </p>
+ *
+ * <table height="1586" cellpadding="2" cellspacing="2" border="1"
+ * width="825" style="border-collapse: collapse;">
+ * <tbody>
+ * <tr>
+ * <th width="150" valign="top" bgcolor="#999999"><b>Property<br>
+ * </b> </th>
+ * <th valign="top" bgcolor="#999999"><b>Trait Getter <br>[possible return value(s)]<br>
+ * </b> </th>
+ * <th bgcolor="#999999" valign="top"><b>Trait Setter <br>[allowed value(s)]<br>
+ * </b> </th>
+ * <th bgcolor="#999999" valign="top"><b>Default Values<br>
+ * </b> </th>
+ * </tr>
+ * <tr>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>,
+ * <rect>, <circle>, <ellipse>, <line>,
+ * <path>, <g>, <image>, <text>, <a>, and <use></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">color <br>
+ * </td>
+ * <td valign="top">getRGBColorTrait [SVGRGBColor]<br>
+ * </td>
+ * <td valign="top">setTrait [inherit]<br>setRGBColorTrait [SVGRGBColor]<br>
+ * </td>
+ * <td valign="top" align="center">rgb(0,0,0)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">display<br>
+ * </td>
+ * <td valign="top">getTrait [inline | none ] <br>
+ * </td>
+ * <td valign="top">setTrait [inline | none | inherit ] </td>
+ * <td valign="top" align="center">"inline"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">fill<br>
+ * </td>
+ * <td valign="top">getRGBColorTrait [null, SVGRGBColor]<br>
+ * </td>
+ * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait(none | currentColor | inherit)<br>
+ * </td>
+ * <td valign="top" align="center">rgb(0,0,0)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">fill-rule<br>
+ * </td>
+ * <td valign="top">getTrait [nonzero | evenodd] <br>
+ * </td>
+ * <td valign="top">setTrait [nonzero | evenodd | inherit] </td>
+ * <td valign="top" align="center">"nonzero"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">stroke</td>
+ * <td valign="top">getRGBColorTrait [null, SVGRGBColor]</td>
+ * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait [none | currentColor | inherit]</td>
+ * <td valign="top" align="center">"none"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-dashoffset</td>
+ * <td valign="top">getFloatTrait </td>
+ * <td valign="top">setTrait [inherit]<br>setFloatTrait </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-linecap</td>
+ * <td valign="top">getTrait [butt | round | square]</td>
+ * <td valign="top">setTrait [butt | round | square | inherit]</td>
+ * <td valign="top" align="center">"butt"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-linejoin</td>
+ * <td valign="top">getTrait [miter | round | bevel ]</td>
+ * <td valign="top">setTrait [miter | round | bevel | inherit]</td>
+ * <td valign="top" align="center">"miter"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-miterlimit</td>
+ * <td valign="top">getFloatTrait [ value >= 1]</td>
+ * <td valign="top">setTrait [inherit]<br>setFloatTrait [value >= 1]</td>
+ * <td valign="top" align="center">4.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-width</td>
+ * <td valign="top">getFloatTrait [value >= 0]</td>
+ * <td valign="top">setTrait [inherit]<br> setFloatTrait [value >= 0]</td>
+ * <td valign="top" align="center">1.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">visibility</td>
+ * <td valign="top">getTrait [visible | hidden]</td>
+ * <td valign="top">setTrait [visible | hidden | inherit]</td>
+ * <td valign="top" align="center">"visible"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>, <text>, <g>, <a>, and <use>;<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">font-family<br>
+ * </td>
+ * <td valign="top">getTrait [single, computed font-family value]<br>
+ * </td>
+ * <td valign="top">setTrait [same syntax as font-family attribute]<br>
+ * </td>
+ * <td valign="top" align="center"> User-Agent <br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">font-size<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>setTrait [inherit]<br>
+ * </td>
+ * <td valign="top" align="center"> User-Agent <br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">font-style<br>
+ * </td>
+ * <td valign="top">getTrait [normal | italic | oblique ] </td>
+ * <td valign="top">setTrait [normal | italic | oblique | inherit] </td>
+ * <td valign="top" align="center">"normal"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">font-weight<br>
+ * </td>
+ * <td valign="top">getTrait [100 | 200 | 300 <br> | 400 | 500 | 600 | 700 | 800 | 900 ] </td>
+ * <td valign="top">setTrait [normal | bold | bolder | lighter | 100 | 200 | 300 <br />
+ * | 400 | 500 | 600 | 700 | 800 | 900 | inherit] </td>
+ * <td valign="top" align="center">"normal"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">text-anchor<br>
+ * </td>
+ * <td valign="top">getTrait [start | middle | end]<br>
+ * </td>
+ * <td valign="top">setTrait [start | middle | end | inherit ]<br>
+ * </td>
+ * <td valign="top" align="center">"start"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#999999" valign="top"><b>Attribute<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Trait Getter<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Trait Setter<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Default Values<br>
+ * </b></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top">
+ * <rect>, <circle>, <ellipse>, <line>, <path>, <g>,
+ * <image>, <text>, <a>, and <use></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">transform<br>
+ * </td>
+ * <td valign="top">getMatrixTrait [SVGMatrix]<br>
+ * </td>
+ * <td valign="top">setMatrixTrait [SVGMatrix]<br>
+ * </td>
+ * <td valign="top" align="center">Identity matrix<br>
+ * (1,0,0,1,0,0)<br>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><rect><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">height<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">width<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]</td>
+ * <td valign="top">setFloatTrait [ value >= 0]</td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">rx<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]</td>
+ * <td valign="top">setFloatTrait [value >= 0]</td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">ry<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><circle><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cx<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cy<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">r<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><ellipse><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cx<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cy<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">rx<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">ry<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><line><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x1<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x2<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y1<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y2<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><path> (path-length is not supported)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">d<br>
+ * </td>
+ * <td valign="top">getPathTrait [SVGPath]<br>
+ * </td>
+ * <td valign="top">setPathTrait [SVGPath]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(Empty SVGPath)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><image><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait <br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">width<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">height<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTrait NS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS [non local-URI value]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>( "" )<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><use><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTraitNS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><a><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">target<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">setTrait<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTraitNS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="*" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><text><br />(Notes:
+ * For 'x' and 'y', it is only possible
+ * to provide floating point scalar values; an array of x or y values is not supported. <br />
+ * 'rotate' attribute is not supported.)<br/>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">#text<br>
+ * </td>
+ * <td valign="top">getTrait [not null]<br>
+ * </td>
+ * <td valign="top">setTrait [not null]<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><svg><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">version<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">Not available (readonly)<br>
+ * </td>
+ * <td valign="top" align="center">"1.1"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">baseProfile<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">Not available (readonly)<br>
+ * </td>
+ * <td valign="top" align="center">"tiny"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">viewBox<br>
+ * </td>
+ * <td valign="top">getRectTrait [null, SVGRect]<br>
+ * </td>
+ * <td valign="top">setRectTrait [SVGRect]<br>
+ * </td>
+ * <td valign="top" align="center">null<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">zoomAndPan<br>
+ * </td>
+ * <td valign="top">getTrait [disable | magnify]<br>
+ * </td>
+ * <td valign="top">setTrait [disable | magnify]<br>
+ * </td>
+ * <td valign="top" align="center">"magnify"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * </tbody>
+ * </table>
+ */
+
+public interface SVGElement extends Element, EventTarget
+{
+
+ /**
+ * Sets the Element's id attribute.
+ * @param Id the value of Id to be set for this Element.
+ * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing Id.
+ * @throws DOMException with error code INVALID_ACCESS_ERR is raised if the Id is not unique i.e. if this Id already exists in the document.
+ * @throws NullPointerException if <code>Id</code> is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public void setId(String Id)
+ throws DOMException;
+
+ /**
+ * Returns the Element's Id, null if no id specified.
+ * @return the Element's Id.
+ */
+ public String getId();
+
+ /**
+ * Returns the first child element node of this element. <code>null</code> if this element has no child elements.
+ * @return the first child element node of this element.
+ */
+ public Element getFirstElementChild();
+
+ /**
+ * Returns the next sibling element node of this element. <code>null</code> if this element has no element sibling
+ * nodes that come after this one in the document tree.
+ * @return the next sibling element node of this element.
+ */
+ public Element getNextElementSibling();
+
+
+ /**
+ * Returns the trait value as String. In SVG Tiny only certain traits can be obtained as a String value. Syntax of the
+ * returned String matches the syntax of the corresponding attribute. This element is exactly equivalent to {@link org.w3c.dom.svg.SVGElement#getTraitNS getTraitNS}
+ * with namespaceURI set to null.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as String for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public String getTrait(String name)
+ throws DOMException;
+
+ /**
+ * Same as {@link org.w3c.dom.svg.SVGElement#getTrait getTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.
+ *
+ * @param namespaceURI the namespaceURI of the trait to retrieve.
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as String for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public String getTraitNS(String namespaceURI, String name)
+ throws DOMException;
+
+ /**
+ * Get the trait value as float.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as float for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a float
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public float getFloatTrait(String name)
+ throws DOMException;
+
+ /**
+ * Returns the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. The returned object is a copy of the actual trait value and will not change if
+ * the corresponding trait changes.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as SVGMatrix for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public SVGMatrix getMatrixTrait(String name)
+ throws DOMException;
+
+ /**
+ * Returns the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. The returned object is a copy of the actual trait value and will not change if
+ * the corresponding trait changes.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as SVGRect for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRect SVGRect}
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public SVGRect getRectTrait(String name)
+ throws DOMException;
+
+ /**
+ * Returns the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. The returned object is a copy of the actual trait value and will not change if
+ * the corresponding trait changes.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as SVGPath for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGPath SVGPath}
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public SVGPath getPathTrait(String name)
+ throws DOMException;
+
+ /**
+ * Returns the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. The returned object is a copy of the trait value and will not change if
+ * the corresponding trait changes. If the actual trait value is not an RGBColor (i.e. "none"), this method will return null.
+ *
+ * @param name the name of the trait to retrieve.
+ * @return the trait value as SVGRGBColor for the specified name.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public SVGRGBColor getRGBColorTrait(String name)
+ throws DOMException;
+
+ /**
+ * Set the trait value as String. In SVG Tiny only certain traits can be set through a String value. The syntax of the String
+ * that should be given as a value must be the same as syntax of the corresponding XML attribute value. Exactly equivalent
+ * to {@link org.w3c.dom.svg.SVGElement#setTraitNS setTraitNS} with namespaceURI attribute set to null.
+ *
+ * @param name the name of the trait to be set.
+ * @param value the value of the trait to be set as String.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
+ * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public void setTrait(String name, String value)
+ throws DOMException;
+
+ /**
+ * Same as {@link org.w3c.dom.svg.SVGElement#setTrait setTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.
+ *
+ * @param namespaceURI the namespaceURI of the trait to be set.
+ * @param name the name of the trait to be set.
+ * @param value the value of the trait to be set as String.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
+ * This error is also thrown when the <use> element is hooked into the document tree and the the value of xlink:href is set invalid.
+ * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public void setTraitNS(String namespaceURI, String name, String value)
+ throws DOMException;
+
+ /**
+ * Set the trait value as float.
+ *
+ * @param name the name of the trait to be set.
+ * @param value the value of the trait to be set as float.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a float
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+ public void setFloatTrait(String name, float value)
+ throws DOMException;
+
+ /**
+ * Set the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. Values in SVGMatrix are copied in the trait so subsequent changes to the given
+ * SVGMatrix have no effect on the value of the trait.
+ *
+ * @param name the name of the trait to be set.
+ * @param matrix the value of the trait to be set as SVGMatrix.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input matrix value is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public void setMatrixTrait(String name, SVGMatrix matrix)
+ throws DOMException;
+
+ /**
+ * Set the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. Values in SVGRect are copied in the trait so subsequent changes to the given
+ * SVGRect have no effect on the value of the trait.
+ *
+ * @param name the name of the trait to be set.
+ * @param rect the value of the trait to be set as SVGRect.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRect SVGRect}
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
+ * SVGRect is invalid if the width or height values are set to negative.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public void setRectTrait(String name, SVGRect rect)
+ throws DOMException;
+
+ /**
+ * Set the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. Values in SVGPath are copied in the trait so subsequent changes to the given
+ * SVGPath have no effect on the value of the trait.
+ *
+ * @param name the name of the trait to be set.
+ * @param path the value of the trait to be set as SVGPath.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGPath SVGPath}
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
+ * SVGPath is invalid if it begins with any segment other than MOVE_TO segment. Note that an empty SVGPath is still a valid value.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public void setPathTrait(String name, SVGPath path)
+ throws DOMException;
+
+ /**
+ * Set the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. Values in SVGRGBColor are copied in the trait so subsequent changes to the given
+ * SVGRGBColor have no effect on the value of the trait.
+ *
+ * @param name the name of the trait to be set.
+ * @param color the value of the trait to be set as SVGRGBColor.
+ * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
+ * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is null.
+ * @throws SecurityException if the application does not have the necessary privilege rights
+ * to access this (SVG) content.
+ */
+
+ public void setRGBColorTrait(String name, SVGRGBColor color)
+ throws DOMException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGException.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * An exception thrown for SVG-specific errors, such as noninvertable matrix in {@link org.w3c.dom.svg.SVGMatrix#inverse inverse}.
+ */
+public class SVGException extends RuntimeException
+{
+ /**
+ * An integer indicating the type of error generated.
+ */
+ public short code;
+
+ /**
+ * Constructs a SVGException with a detailed message.
+ *
+ * @param code the exception's error code.
+ * @param message the exception's descriptive message.
+ */
+ public SVGException(short code, String message)
+ {
+ super(message);
+ this.code = code;
+ }
+
+
+ /**
+ * Value passed to an SVG-specific method is invalid, such as out of range color component in {@link org.w3c.dom.svg.SVGSVGElement#createSVGRGBColor createSVGRGBColor}.
+ */
+ public static final short SVG_INVALID_VALUE_ERR = 1;
+
+ /**
+ * Matrix that has a determinant equal to zero, and therefore not invertable.
+ */
+ public static final short SVG_MATRIX_NOT_INVERTABLE = 2;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGLocatableElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * This interface represents an SVGLocatableElement. It is implemented by all drawable SVG elements
+ * in the document tree. Drawable elements are: <rect>, <circle>, <ellipse>,
+ * <line>, <path> <use> <image> <text>, <svg>, <a>,
+ * and <g>. <b>Note</b> that animations will have an effect on the values of bounding box.
+ *
+ * <br>
+ * <br>
+ * <br>
+ *The following example further clarify the behavior of the getBBox()
+ *method. The example have a short explanation, an SVG fragment and are
+ *followed by a set of bounding box values which have the following
+ *format:<br>
+ *<tt><br>
+ *[elementId] : {x, y, width, height} | {null}</tt><br>
+ *<br>
+ *where x, y, width and height define the values of the SVGRect object's
+ *returned from a getBBox call on the element with the specified id.
+ *There are a few cases where the bounding box may be null (see example
+ *6).<br>
+ *<br>
+ *<h3>Example #1: Simple groups and bounds</h3>
+ *<br>
+ *This first example shows the values returned by the getBBox method for
+ *various simple basic shapes and groups. In particular, it shows that
+ *the transform, on an element, does not change the value of its user
+ *space bounding box.<br>
+ *<br>
+ *<tt><g id="group1" transform="translate(10, 20)" fill="red" >
+ *<br>
+ * <rect id="rect1" transform="scale(2)" x="10" y="10" width="50"
+ *height="50"/>
+ *<br>
+ * <rect id="rect2" x="10" y="10" width="100" height="100"/>
+ *<br>
+ * <g id="group2" transform="translate(10, 20)" >
+ *<br>
+ * <rect id="rect3" x="0" y="10" width="150" height="50"/>
+ *<br>
+ * <circle id="circle1" cx="20" cy="20" r="100" />
+ *<br>
+ * </g>
+ *<br>
+ *</g>
+ *<br>
+ *</tt><br>
+ *<tt>[group1] : {-70.0, -60.0, 230.0, 200.0}
+ *<br>
+ *[rect1] : {10.0, 10.0, 50.0, 50.0}
+ *<br>
+ *[rect2] : {10.0, 10.0, 100.0, 100.0}
+ *<br>
+ *[group2] : {-80.0, -80.0, 230.0, 200.0}
+ *<br>
+ *[rect3] : {0.0, 10.0, 150.0, 50.0}
+ *<br>
+ *[circle1] : {-80.0, -80.0, 200.0, 200.0}
+ *</tt><br>
+ *<br>
+ *<h3>Example #2: Bounding box on zero width or height rectangle<br>
+ *</h3>
+ *This example illustrates that the bounding box on elements is based on
+ *the element's geometry coordinates. For example, the bounding box on a
+ *zero-width rectangle is defined (see below), even though the rectangle
+ *is not rendered.<br>
+ *<pre><tt><g id="group1" transform="translate(10, 20)" fill="red" ></tt></pre>
+ *<pre><tt> </tt><rect id="rect2" x="10" y="10" width="400" height="0"/></pre>
+ *<pre wrap=""><tt> <g id="group2" transform="translate(10, 20)" >
+ * <rect id="rect3" x="0" y="10" width="150" height="50"/>
+ * </g></tt><tt>
+ *</g>
+ *</tt></pre>
+ *<pre><tt>[group1] : {10.0, 10.0, 400.0, 70.0}
+ *</tt>[rect2] : {10.0, 10.0, 400.0, 0.0}<tt>
+ *</tt>[group2] : {0.0, 10.0, 150.0, 50.0}<tt>
+ *[rect3] : {0.0, 10.0, 150.0, 50.0}</tt>
+ *</pre>
+ *<h3>Example #3: Bounding Box on zero radius ellipses.</h3>
+ *This is another example of how bounding boxes are based on the
+ *element's geometry. Here, the bounding box of an ellipse with a zero
+ *x-axis radius is still defined, even though the ellipse is not rendered.<br>
+ *<pre wrap=""><svg id="mySVG" width="10" height="20">
+ *<g id="group1" transform="translate(10, 20)" fill="red" >
+ * <rect id="rect1" x="10" y="10" width="100" height="100"/>
+ * <ellipse id="ellipse1" cx="20" cy="20" rx="0" ry="70" />
+ *</g></pre>
+ *<tt>[mySVG] : {20.0, -30.0, 100.0, 160.0}
+ *<br>
+ *[group1] : {10.0, -50.0, 100.0, 160.0}
+ *<br>
+ *[rect1] : {10.0, 10.0, 100.0, 100.0}
+ *<br>
+ *[ellipse1] : {20.0, -50.0, 0.0, 140.0}
+ *</tt><br>
+ *<h3>Example #4: Viewports do not clip bounding boxes</h3>
+ *This example shows that no matter what the viewport is on the root SVG
+ *element, the bounding boxes, based on the geometry, are still defined.
+ *Here, even though the root svg has a zero width, the bounding boxes for
+ *the root itself and its children is precisely defined.<br>
+ *<pre wrap=""><svg id="mySVG" width="0" height="50">
+ * <g id="group1" transform="translate(10, 20)" fill="red" >
+ * <rect id="rect1" x="10" y="10" width="50" height="50"/>
+ * <g id="group2" transform="translate(10, 20)" >
+ * <rect id="rect2" x="0" y="10" width="150" height="0"/>
+ * <circle id="circle1" cx="20" cy="20" r="500" />
+ * </g>
+ * </g>
+ *</svg>
+ *</pre>
+ *<tt>[mySVG] : {-460.0, -440.0, 1000.0, 1000.0}
+ *<br>
+ *[group1] : {-470.0, -460.0, 1000.0, 1000.0}
+ *<br>
+ *[rect1] : {10.0, 10.0, 50.0, 50.0}
+ *<br>
+ *[group2] : {-480.0, -480.0, 1000.0, 1000.0}
+ *<br>
+ *[rect2] : {0.0, 10.0, 150.0, 0.0}
+ *<br>
+ *[circle1] : {-480.0, -480.0, 1000.0, 1000.0}
+ *</tt><br>
+ *<h3>Example #5: getBBox on <use></h3>
+ *This example shows that the bounding box for a <use> element
+ *accounts for the x and y attributes defined on the element, just like
+ *the x and y attributes impact the bounding box computation on a
+ *<rect> or on an <image> element.<br>
+ *<br>
+ *<tt><svg>
+ *<br>
+ * <defs>
+ *<br>
+ * <rect id="myRect" x="0" y="0" width="60" height="40" />
+ *<br>
+ * </defs>
+ *<br>
+ * <use id="myUse" xlink:href="#myRect" x="-30" y="-20" />
+ *<br>
+ *</svg>
+ *<br>
+ *</tt>
+ *<br>
+ *<tt>[myRect] : {0.0, 0.0, 60.0, 40.0}
+ *<br>
+ *[myUse] : {-30.0, -20.0, 60.0, 40.0}
+ *</tt><br>
+ *<h3>Example #6: Empty group</h3>
+ *This example shows that the bounding box for an empty group is null. By
+ *the same token, the bounding box of a <path> with an empty
+ *SVGPath (i.e., one with no path commands, which may happen after
+ *creating a new <path> element with a Document.createElementNS
+ *call) is also null.<br>
+ *<br>
+ *<tt><g id="emptyG" />
+ *<br>
+ *<br>
+ *[emptyG] : {null}
+ *</tt><br>
+ *<br>
+ *<h3>Example #7: Impact of display='none' and visibility='hidden'<br>
+ *</h3>
+ *This example shows how the bounding box of children with display='none'
+ *are not accounted for in the computation of their parent's bounding
+ *box. This reflects the definition of the display property and its
+ *impact on rendering and bounding box computation. The example also
+ *shows that elements with a 'hidden' visibility still contribute to
+ *their parent's bounding box computation.<br>
+ *<br>
+ *<tt><g id="g1"> <br>
+ * <g id="g1.1.display.none" display="none"> <br>
+ * <rect id="rect1" x="10" y="10" width="40" height="40"/><br>
+ * <g/>
+ *<br>
+ * <rect id="rect2.visibility.hidden" visibility="hidden" <br>
+ * x="30" y="60" width="10" height="20"/>
+ *<br>
+ *</g></tt><br>
+ *<br>
+ *<tt>[g1] : {30.0, 60.0, 10.0, 20.0} <br>
+ *[g1.1.display.none] : {10.0, 10.0, 40.0, 40.0}<br>
+ *[rect1] : {10.0, 10.0, 40.0, 40.0}<br>
+ *[rec2.visibility.hidden] : {30.0, 60.0, 10.0, 20.0}</tt><br>
+ *<h3>Example #8: Concatenating bounding boxes in the container's user
+ *space.<br>
+ *</h3>
+ *This example shows how the concatenation and computation of bounding
+ *boxes for container element happens in the container's user space.<br>
+ *<br>
+ *<tt><g id="g1"><br>
+ * <line id="line1" x2="100" y2="100" transform="rotate(-45)"/><br>
+ *</g></tt><br>
+ *<tt><br>
+ *[g1] : {0.0, 0.0, 141.42136, 0}<br>
+ *[line1] : {0.0, 0.0, 100.0, 100.0}</tt><br>
+ *<h3>Example #9: No influence of stroke-width.</h3>
+ *This example illustrates that stroking has no impact on the computation
+ *of bounding boxes.<br>
+ *<tt><br>
+ *<g><br>
+ * <line id="thickLine" stroke-width="10" x2="100" y2="0" /><br>
+ *</g></tt><br>
+ *<br>
+ *[thickLine] : {0.0, 0.0, 100.0, 0.0}<br>
+ *<br>
+ *<h3>Example #10: No influence of viewBox.</h3>
+ *This example illustrates that viewBox has no impact on the computation
+ *of bounding boxes.<br>
+ *<tt><br>
+ *<svg id="rootSvg" width="500" height="300" viewBox="0 0 200 100" ><br>
+ * <rect x="-100" y="-200" width="500" height="100" /><br>
+ *</svg></tt><br>
+ *<br>
+ *[rootSVG] : {-100, -200, 500, 100}<br>
+ *
+ *
+ */
+public interface SVGLocatableElement extends SVGElement
+{
+
+ /**
+ * <p>
+ * Returns the tight bounding box in current user coordinate space. Tight bounding box is the smallest
+ * possible rectangle that includes the geometry of all contained graphics elements excluding stroke.
+ * The calculation is done in the user coordinate space of the element. When bounding box
+ * is calculated elements with display property (trait) set to none are ignored. Exact rules for the bounding
+ * box calculation are given in the <a href="http://www.w3.org/TR/SVG/coords.html#ObjectBoundingBox">SVG spec</a>.
+ * </p>
+ *
+ * @return the tight bounding box in current user coordinate space.
+ */
+ public SVGRect getBBox();
+
+ /**
+ * <p>
+ * Returns the transformation matrix from current user units (i.e., after application of the transform attribute, if any)
+ * to the parent user agent's notion of a "pixel". For display devices, ideally this represents a physical screen pixel.
+ * For other devices or environments where physical pixel sizes are not known, then an algorithm similar to the CSS2
+ * definition of a "pixel" can be used instead. Note that <code>null</code> is returned if this element is not hooked into the
+ * document tree.
+ * </p>
+ *
+ * @return the transformation matrix from current user units to the parent user agent's notion of a "pixel".
+ */
+ public SVGMatrix getScreenCTM();
+
+ /**
+ * <p>
+ * Returns the tight bounding box in screen coordinate space. Tight bounding box is the smallest
+ * possible rectangle that includes the geometry of all contained graphics elements excluding stroke.
+ * The box coordinates are in the screen coordinate space, which is connected to the current user
+ * coordinate space by the matrix returned by {@link org.w3c.dom.svg.SVGLocatableElement#getScreenCTM getScreenCTM} method.
+ * Note that <code>null</code> is returned if this element is not hooked into the
+ * document tree.
+ * </p>
+ *
+ * @return the tight bounding box in screen coordinate space.
+ */
+ public SVGRect getScreenBBox();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGMatrix.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+import org.w3c.dom.svg.SVGException;
+import org.w3c.dom.DOMException;
+
+/**
+ * This interface represents an "SVGMatrix" datatype, identified by an affine transform.
+ * It can be used to read and modify the values of transform attribute as per SVG specification.
+ * Note that the mTranslate, mMultiply, mScale and mRotate methods in this interface
+ * mutate the SVGMatrix object and return a reference to the SVGMatrix instance itself, after
+ * performing the necessary matrix operation.
+ * <p>This matrix transforms source coordinates (x, y) into destination coordinates (x', y') by
+ * considering them to be a column vector and multiplying the coordinate vector by the matrix
+ * according to the following process:</p>
+ *
+ * <p>
+ * <pre>
+ * [ x' ] [ a c e ] [ x ] [ a.x + c.y + e ]
+ * [ y' ] = [ b d f ] [ y ] = [ b.x + d.y + f ]
+ * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
+ * </pre>
+ * </p>
+ */
+public interface SVGMatrix
+{
+
+ /**
+ * Returns a component of the matrix by component's zero-based index. <code>getComponent(0)</code> is a, <code>getComponent(1)</code> is b, etc.
+ *
+ * @param index the index of the matrix component to retrieve.
+ * @return the component for the specified index.
+ * @throws DOMException - INDEX_SIZE_ERR if the <code>index</code> is invalid.
+ */
+ public float getComponent(int index)
+ throws DOMException;
+
+ /**
+ * Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting current matrix.
+ *
+ * @param secondMatrix the matrix to post-multiply with.
+ * @return the resulting current matrix after post-multiplication.
+ * @throws NullPointerException - if secondMatrix is null.
+ */
+ public SVGMatrix mMultiply(SVGMatrix secondMatrix);
+
+ /**
+ * Returns a new instance of SVGMatrix containing the inverse of the current matrix.
+ *
+ * @return the inverse of the current matrix.
+ * @throws SVGException - SVG_MATRIX_NOT_INVERTABLE when determinant of this matrix is zero.
+ */
+ public SVGMatrix inverse()
+ throws SVGException;
+
+ /**
+ * Post-multiplies a translation transformation on the current matrix and returns the resulting current matrix.
+ * This is equivalent to calling <code>multiply(T)</code>, where <code>T</code> is an
+ * <code>SVGMatrix</code> object represented by the following
+ * matrix:
+ *
+ * <p>
+ * <pre>
+ * [ 1 0 x ]
+ * [ 0 1 y ]
+ * [ 0 0 1 ]
+ * </pre>
+ * </p>
+ *
+ * @param x the distance by which coordinates are translated
+ * in the X axis direction.
+ * @param y the distance by which coordinates are translated
+ * in the Y axis direction.
+ * @return the resulting current matrix after post-multiplication.
+ */
+ public SVGMatrix mTranslate(float x, float y);
+
+ /**
+ * Post-multiplies a uniform scale transformation on the current matrix and returns the resulting current matrix.
+ * This is equivalent to calling <code>multiply(S)</code>, where <code>S</code> is an <code>SVGMatrix</code>
+ * object represented by the following matrix:
+ *
+ * <p>
+ * <pre>
+ * [ scaleFactor 0 0 ]
+ * [ 0 scaleFactor 0 ]
+ * [ 0 0 1 ]
+ * </pre>
+ * </p>
+ *
+ * @param scaleFactor the factor by which coordinates are scaled along the
+ * X and Y axis.
+ * @return the resulting current matrix after post-mutiplication.
+ */
+ public SVGMatrix mScale(float scaleFactor);
+
+ /**
+ * Post-multiplies a rotation transformation on the current matrix and returns the resulting current matrix.
+ * This is equivalent to calling <code>multiply(R)</code>, where <code>R</code> is an
+ * <code>SVGMatrix</code> object represented by the following matrix:
+ *
+ * <p>
+ * <pre>
+ * [ cos(angle) -sin(angle) 0 ]
+ * [ sin(angle) cos(angle) 0 ]
+ * [ 0 0 1 ]
+ * </pre>
+ * </p>
+ *
+ * @param angle the angle of rotation in degrees.
+ * @return the resulting current matrix after post-multiplication.
+ */
+ public SVGMatrix mRotate(float angle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGPath.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+import org.w3c.dom.DOMException;
+
+
+/**
+ * This interface represents an "SVGPath" datatype used to define the path geometry.
+ * Corresponds to SVG path specification or the "d" attribute.
+ *
+ *
+ * <p>The native implementations must support the following simplifications or
+ * canonicalization of path segments. Any simplifications should be lossless.
+ *
+ * <ul>
+ * <li>Relative commands (c, h, l, m, q, s, t, and v) must be converted to their absolute counterparts·</li>
+ * <li>Horizontal and Vertical lines (H, h, V, and v) must be converted to general lines (L and l)·</li>
+ * <li>Translate command S to command C·</li>
+ * <li>Translate command T to command Q.</li>
+ * </ul>
+ * </p>
+ */
+public interface SVGPath
+{
+
+ /**
+ * Numeric value is ASCII code of the letter 'M'.
+ */
+ public static final short MOVE_TO = 77;
+
+ /**
+ * Numeric value is ASCII code of the letter 'L'.
+ */
+ public static final short LINE_TO = 76;
+
+ /**
+ * Numeric value is ASCII code of the letter 'C'.
+ */
+ public static final short CURVE_TO = 67;
+
+ /**
+ * Numeric value is ASCII code of the letter 'Q'.
+ */
+ public static final short QUAD_TO = 81;
+
+ /**
+ * Numeric value is ASCII code of the letter 'Z'.
+ */
+ public static final short CLOSE = 90;
+
+
+ /**
+ * Return number of segments in this path.
+ *
+ * @return the number of segments in this path.
+ */
+ public int getNumberOfSegments();
+
+ /**
+ * Returns segment command by zero-based command index. Returns one of MOVE_TO, LINE_TO, CURVE_TO, QUAD_TO or CLOSE.
+ *
+ * @param cmdIndex the command index for the segment command to retrieve.
+ * @return the segment command for the specified cmdIndex.
+ * @throws DOMException with error code INDEX_SIZE_ERR if segment index out of bounds.
+ *
+ */
+ public short getSegment(int cmdIndex)
+ throws DOMException;
+
+ /**
+ * Returns segment parameter by zero-based command index and zero-based parametr index.
+ *
+ * @param cmdIndex the command index for the segment parameter to retrieve.
+ * @param paramIndex the parameter index for the segment parameter to retrieve.
+ * @return the segment parameter for the specified cmdIndex and paramIndex.
+ * @throws DOMException with error code INDEX_SIZE_ERR if segment index out of bounds or param index out of bounds for this segment's type.
+ */
+ public float getSegmentParam(int cmdIndex, int paramIndex)
+ throws DOMException;
+
+ /**
+ * Appends 'M' (absolute move) segment to the path with the specified coordinates.
+ *
+ * @param x the x-axis coordinate for the specified point.
+ * @param y the y-axis coordinate for the specified point.
+ */
+ public void moveTo(float x, float y);
+
+ /**
+ * Appends 'L' (absolute line) segment to the path with the specified coordinates.
+ *
+ * @param x the x-axis coordinate of the specified point.
+ * @param y the y-axis coordinate of the specified point.
+ */
+ public void lineTo(float x, float y);
+
+ /**
+ * Appends 'Q' (absolute quadratic curve) segment to the path.
+ *
+ * @param x1 the x-axis coordinate of the first control point.
+ * @param y1 the y-axis coordinate of the first control point.
+ * @param x2 the x-axis coordinate of the final end point.
+ * @param y2 the y-axis coordinate of the final end point.
+ *
+ */
+ public void quadTo(float x1, float y1, float x2, float y2);
+
+ /**
+ * Appends 'C' (absolute cubic curve) segment to the path.
+ *
+ * @param x1 the x-axis coordinate of the first control point.
+ * @param y1 the y-axis coordinate of the first control point.
+ * @param x2 the x-axis coordinate of the second end point.
+ * @param y2 the y-axis coordinate of the second end point.
+ * @param x3 the x-axis coordinate of the final end point.
+ * @param y3 the y-axis coordinate of the final end point.
+ *
+ */
+ public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3);
+
+ /**
+ * Appends 'Z' (close path) segment to the path
+ */
+ public void close();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGPoint.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * This interface represents an "SVGPoint" datatype, identifiend by its x and y components.
+ */
+public interface SVGPoint
+{
+
+ /**
+ * Sets the x component of the point to the specified float value.
+ *
+ * @param value the x component value
+ *
+ */
+
+ public void setX(float value);
+
+ /**
+ * Sets the y component of the point to the specified float value.
+ *
+ * @param value the y component value
+ *
+ */
+
+ public void setY(float value);
+
+
+ /**
+ * Returns the x component of the point.
+ *
+ * @return the x component of the point.
+ *
+ */
+
+ public float getX();
+
+ /**
+ * Returns the y component of the point.
+ *
+ * @return the y component of the point.
+ *
+ */
+ public float getY();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGRGBColor.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * This interface represents an "SVGRGBColor" datatype made up of red, green, and blue components.
+ * It can be used to read properties that store color values ({@link org.w3c.dom.svg.SVGElement#getRGBColorTrait getRGBColorTrait})
+ * such as <code>fill</code>, <code>stroke</code>, and <code>color</code>.
+ */
+public interface SVGRGBColor
+{
+
+ /**
+ * Returns the red component of the SVGRGBColor.
+ *
+ * @return the red component.
+ *
+ */
+ public int getRed();
+
+ /**
+ * Returns the green component of the SVGRGBColor.
+ *
+ * @return the green component.
+ *
+ */
+ public int getGreen();
+
+ /**
+ * Returns the blue component of the SVGRGBColor.
+ *
+ * @return the blue component.
+ *
+ */
+ public int getBlue();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGRect.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+
+/**
+ * This interface represents an "SVGRect" datatype, consisting of a minimum X, minimum Y, width
+ * and height values.
+ */
+public interface SVGRect
+{
+
+ /**
+ * Sets the minimum X value of this SVGRect to the specified value.
+ *
+ * @param value the minimum X value.
+ *
+ */
+ public void setX(float value);
+
+ /**
+ * Sets the minimum Y value of this SVGRect to the specified value.
+ *
+ * @param value the minimum Y value.
+ *
+ */
+ public void setY(float value);
+
+ /**
+ * Sets the width of this SVGRect to the specified value.
+ *
+ * @param value the rectangle width value.
+ *
+ */
+ public void setWidth(float value);
+
+ /**
+ * Sets the height of this SVGRect to the specified value.
+ *
+ * @param value the rectangle height value.
+ *
+ */
+ public void setHeight(float value);
+
+ /**
+ * Returns the minimum X value for this SVGRect.
+ *
+ * @return the minimum X value.
+ *
+ */
+ public float getX();
+
+ /**
+ * Returns the minimum Y value for this SVGRect.
+ *
+ * @return the minimum Y value.
+ *
+ */
+ public float getY();
+
+
+ /**
+ * Returns the width for this SVGRect.
+ *
+ * @return the rectangle width.
+ *
+ */
+ public float getWidth();
+
+ /**
+ * Returns the height for this SVGRect.
+ *
+ * @return the rectangle height.
+ *
+ */
+ public float getHeight();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGSVGElement.java Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.w3c.dom.svg;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * <p>This interface represents <svg> element in (SVG) document tree.</p>
+ * <h4>User Agent Transforms</h4>
+ * <p>
+ * The DOM attributes currentScale, currentRotate and currentTranslate are combined to form user agent transformation
+ * which is applied at the outermost level on the SVG document (i.e., outside the outermost 'svg' element) if "magnification"
+ * is enabled (i.e., zoomAndPan attribute is set to "magnify"). Their values
+ * can potentialy be modified through user-agent specific UI. User agent transformation can be obtained
+ * by multiplying matrix
+ * <p>
+ * <pre>
+ * [currentScale 0 currentTranslate.x] [cos(currentRotate) -sin(currentRotate 0]
+ * [ 0 currentScale currentTranslate.y] by [sin(currentRotate) cos(currentRotate) 0]
+ * [ 0 0 1 ] [ 0 0 1]
+ * </pre>
+ * </p>
+ *
+ * i.e. (translate, then scale, then rotate the coordinate system). The reference point for scale and rotate operations is the origin (0, 0).
+ * </p>
+ *
+ * <p><b>Note:</b> If the application does not have the necessary privilege rights to access this (SVG)
+ * content, a SecurityException may be thrown by the underlying implementation. This is applicable
+ * to all the Tree navigation and Trait acessor methods. Features such as zooming, panning and
+ * playing of animations will not be affected.
+ * </p>
+ */
+public interface SVGSVGElement extends SVGLocatableElement
+{
+ /**
+ * Sets current user agent scale (zoom) coefficient.
+ *
+ * @param value the value of user agent scale coefficient to be set.
+ * @throws DOMException with error code INVALID_ACCESS_ERR if the scale value is set to zero.
+ */
+ public void setCurrentScale(float value)
+ throws DOMException;
+
+ /**
+ * Returns current user agent scale (zoom) coefficient. The initial value for currentScale is 1.
+ *
+ * @return the current user agent scale coefficient.
+ */
+ public float getCurrentScale();
+
+ /**
+ * Sets current user agent rotate coefficient in degrees.
+ *
+ * @param value the value of user agent rotate coefficient to be set.
+ */
+ public void setCurrentRotate(float value);
+
+ /**
+ * Returns current user agent rotation angle in degrees. The initial value for currentRotate is 0.
+ *
+ * @return the current user agent rotation coefficient in degrees.
+ */
+ public float getCurrentRotate();
+
+ /**
+ * Current user agent translation used for scrolling or panning (The returned {@link org.w3c.dom.svg.SVGPoint SVGPoint} object is "live" and setting its
+ * x and y components will change user agent's translation). The initial values for currentTranslate is SVGPoint(0,0).
+ *
+ * @return returns the current user agent translation.
+ */
+ public SVGPoint getCurrentTranslate();
+
+ /**
+ * Returns current animation timeline time in seconds.
+ *
+ * @return the current animation timeline time in seconds.
+ */
+ public float getCurrentTime();
+
+ /**
+ * Sets current animation timeline time (in seconds). This API is required to support moving
+ * forwards in timeline. The underlying implementations are normally designed to seek
+ * forward in time and setting the time backwards is not meant to play the animation backwards.
+ * Note: Moving backwards in time is a costly feature for the implementations to support.
+ *
+ * @param seconds the value of time to be set in seconds.
+ */
+
+ public void setCurrentTime(float seconds);
+
+ /**
+ * Creates new {@link org.w3c.dom.svg.SVGMatrix SVGMatrix} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
+ * type using {@link org.w3c.dom.svg.SVGElement#setMatrixTrait setMatrixTrait} method. The internal representation of the matrix is as follows:
+ * <p>
+ * <pre>
+ * [ a c e ]
+ * [ b d f ]
+ * [ 0 0 1 ]
+ * </pre>
+ * </p>
+ *
+ * @param a the 'a' component of the matrix to be set.
+ * @param b the 'b' component of the matrix to be set.
+ * @param c the 'c' component of the matrix to be set.
+ * @param d the 'd' component of the matrix to be set.
+ * @param e the 'e' component of the matrix to be set.
+ * @param f the 'f' component of the matrix to be set.
+ *
+ * @return the newly created SVGMatrix object.
+ *
+ * @see org.w3c.dom.svg.SVGMatrix
+ */
+
+ public SVGMatrix createSVGMatrixComponents(float a, float b, float c, float d, float e, float f);
+
+ /**
+ * Creates new {@link org.w3c.dom.svg.SVGRect SVGRect} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRect SVGRect}
+ * type using {@link org.w3c.dom.svg.SVGElement#setRectTrait setRectTrait} method. The intial values for x, y, width, height of this new SVGRect are zero.
+ *
+ * @return the newly created SVGRect object.
+ */
+
+ public SVGRect createSVGRect();
+
+ /**
+ * Creates new {@link org.w3c.dom.svg.SVGPath SVGPath} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGPath SVGPath}
+ * type using {@link org.w3c.dom.svg.SVGElement#setPathTrait setPathTrait} method.
+ *
+ * @return the newly created SVGPath object with empty path commands.
+ */
+
+ public SVGPath createSVGPath();
+
+ /**
+ * Creates new {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
+ * type using {@link org.w3c.dom.svg.SVGElement#setRGBColorTrait setRGBColorTrait} method.
+ *
+ * @param red the red component of SVGRGBColor object.
+ * @param green the green component of SVGRGBColor object.
+ * @param blue the blue component of SVGRGBColor object.
+ *
+ * @return the newly created SVGRGBColor object with specified (r,g,b) values.
+ *
+ * @throws SVGException with error code SVG_INVALID_VALUE_ERR: if any of the parameters is not in the 0..255 range.</li>
+ */
+ public SVGRGBColor createSVGRGBColor(int red, int green, int blue)
+ throws SVGException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/CM2GEventSource.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event server framework's event source implementation
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// -----------------------------------------------------------------------------
+// CM2GEventSource::NewL
+// -----------------------------------------------------------------------------
+TInt CM2GEventSource::NewL(
+ JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GEventSource::NewLC()");
+ CM2GEventSource* self = new(ELeave) CM2GEventSource;
+ // Cleanup the event source object if a leave occurs during construction:
+ TConstructor selfCleanup(self, aJni);
+ self->ConstructL(aJni, aPeer, aServer);
+ // Pop the cleanup of the object and create a handle:
+ return selfCleanup.GetHandle();
+}
+
+// -----------------------------------------------------------------------------
+// CM2GEventSource::~CM2GEventSource
+// -----------------------------------------------------------------------------
+CM2GEventSource::~CM2GEventSource()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CM2GEventSource::CM2GEventSource
+// -----------------------------------------------------------------------------
+CM2GEventSource::CM2GEventSource()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CM2GEventSource::CM2GEventSource
+// -----------------------------------------------------------------------------
+void CM2GEventSource::ConstructL(
+ JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer)
+{
+ CJavaEventSourceBase::ConstructL(aJni, aPeer, aServer);
+}
+
+M2G_NS_END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/CM2GRenderContext.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,553 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Render context implementation
+*
+*/
+
+// INCLUDE FILES
+#include <eikenv.h> // CCoeEnv
+#include <graphics.h>
+
+#include "CM2GRenderContext.h"
+#include "MM2GSVGProxy.h"
+#include "svgtbitmap.h"
+#include <ImageConversion.h>
+#include <f32file.h>
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+/* static */ const TReal32 MM2GRenderContext::KFullOpaque = 1.0;
+/* static */
+const TReal32 MM2GRenderContext::KFullTransparency = 0.0;
+/* static */
+const TUint8 MM2GRenderContext::KMaxAlphaValue = 255;
+/* static */
+const TDisplayMode MM2GRenderContext::KDefaultDisplayMode = EColor16MA;
+/* static */
+const TDisplayMode MM2GRenderContext::KMaskDisplayMode = EGray256;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::CM2GRenderContext
+// -----------------------------------------------------------------------------
+CM2GRenderContext::CM2GRenderContext()
+ : CBase(),
+ iProxy(NULL),
+ iEngineHandle(M2G_INVALID_HANDLE),
+ iAlpha(MM2GRenderContext::KFullOpaque),
+ iScaledAlpha(MM2GRenderContext::KMaxAlphaValue),
+ iImgBmp(NULL),
+ iWindowSurface(NULL)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::CM2GRenderContext");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::NewL
+// -----------------------------------------------------------------------------
+CM2GRenderContext* CM2GRenderContext::NewL(MM2GSVGProxy* aProxy)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::NewL()");
+
+ CM2GRenderContext* self = new(ELeave) CM2GRenderContext;
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aProxy);
+
+ CleanupStack::Pop();
+
+ return self;
+}
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::~CM2GRenderContext
+// -----------------------------------------------------------------------------
+CM2GRenderContext::~CM2GRenderContext()
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GRenderContext::~CM2GRenderContext() - proxy=%d, engine=%d", iProxy, iEngineHandle);
+ if ((iEngineHandle != M2G_INVALID_HANDLE) && (iProxy != NULL))
+ {
+ TRAP_IGNORE(iProxy->DeleteSvgEngineL(iEngineHandle));
+ }
+ if(iWindowSurface)
+ {
+ delete iWindowSurface;
+ }
+ if(targetBitmap)
+ {
+ delete targetBitmap;
+ }
+ if(iTargetQImage)
+ {
+ delete iTargetQImage;
+ }
+ if(tempBitmapForMask)
+ {
+ delete tempBitmapForMask;
+ }
+ delete iImgBmp;
+ iFbsSession.Disconnect();
+}
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::BindL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::BindL(TInt& aTargetHandle)
+ {
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::BindL()");
+ // get the screen size
+ TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
+
+ iWindowSurface = (reinterpret_cast<Java::GFX::WindowSurface*>(aTargetHandle));
+ //wSurfaceType = (Java::GFX::WindowSurfaceType)iWindowSurface->getType();
+ wSurfaceType = Java::GFX::WsTypeQtImage;
+
+ iWindowSurface->bind(wSurfaceType);
+
+ switch(wSurfaceType)
+ {
+ case Java::GFX::WsTypeQtImage:
+ User::LeaveIfNull(iOffScreenQImage = iWindowSurface->getQtImage());
+ targetBitmap = new CSvgtBitmap ((TInt8*)iOffScreenQImage->bits(),
+ TSize(iOffScreenQImage->size().width(),iOffScreenQImage->size().height()),
+ EColor16MU,iOffScreenQImage->bytesPerLine());
+ break;
+
+ /*TODO for time being..case Java::GFX::WsTypeQtImage:
+ User::LeaveIfNull(iTargetQImage = iWindowSurface->getQtImage());
+ InitializeQImageOffscreenBufferL(screenSize,iTargetQImage);
+ break;*/
+
+ case Java::GFX::WsTypeSymbianBitmap:
+ CFbsBitmap* tempBitmap;
+ User::LeaveIfNull(tempBitmap = (reinterpret_cast<Java::GFX::WindowSurface*>(aTargetHandle)->getSymbianBitmap()));
+ InitializeCFbsBitmapOffscreenBufferL(screenSize,tempBitmap);
+ //iOffScreenBitmap = new(ELeave) CFbsBitmap();
+ break;
+
+ default:
+ User::Leave(KErrNotSupported);
+ break;
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::InitializeQImageOffscreenBufferL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::InitializeQImageOffscreenBufferL(TSize aScreenSize,QImage* aQimage)
+ {
+ QSize aSize;
+ aSize.setHeight(aScreenSize.iHeight);
+ aSize.setWidth(aScreenSize.iWidth);
+ iOffScreenQImage = new QImage(aSize,aQimage->format());
+
+ //TODO For time being the format is EColor16MU
+ targetBitmap = new CSvgtBitmap ((TInt8*)iOffScreenQImage->bits(),
+ TSize(iOffScreenQImage->size().width(),iOffScreenQImage->size().height()),
+ EColor16MU,iOffScreenQImage->bytesPerLine());
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::InitializeCFbsBitmapOffscreenBufferL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::InitializeCFbsBitmapOffscreenBufferL(TSize aScreenSize,CFbsBitmap* aBitmap)
+ {
+
+ iOffScreenBitmap = new(ELeave) CFbsBitmap();
+ User::LeaveIfError(
+ iOffScreenBitmap->Create(aScreenSize, aBitmap->DisplayMode()));
+
+// TODO check for stride in case of bitmap.
+// iTargetBitmap = new CSvgtBitmap( (TInt8*)iOffScreenBitmap->DataAddress() ,aScreenSize,iOffScreenBitmap->DisplayMode()/*KDefaultDisplayMode TODO chk this*/,iOffScreenBitmap->ScanLineLength(iOffScreenBitmap->SizeInPixels().iWidth,KDefaultDisplayMode) );
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::GetImgHandleL
+// -----------------------------------------------------------------------------
+/*
+ * TODO we don't need method anymore as now we need Surface handle
+ * TM2GBitmapHandle CM2GRenderContext::GetImgHandleL() const
+{
+ User::LeaveIfNull(iImgBmp);
+
+ return REINTERPRET_CAST(TM2GBitmapHandle, iImgBmp);
+}*/
+
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::InitImageBitmapL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::InitImageBitmapL()
+ {
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::InitImageBitmapL() - begin");
+ // get the screen size
+ TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
+ switch (wSurfaceType)
+ {
+ case Java::GFX::WsTypeQtImage:
+ {
+ break;
+ }
+ case Java::GFX::WsTypeSymbianBitmap:
+ {
+ break;
+ }
+
+ default:
+ break;
+ }
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::InitImageBitmapL() - end");
+ }
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::ReleaseL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::ReleaseL()
+ {
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ReleaseL() - begin");
+
+ iTargetQImage = NULL;
+ iOffScreenQImage = NULL;
+ iWindowSurface->release();
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ReleaseL() - end");
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::RenderL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::RenderLCDUIL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW, TInt aSvgH,
+ TM2GRenderRect& aRect
+)
+{
+ // prepare viewbox
+ TRect viewbox;
+ TPoint anchor;
+
+ PrepareViewbox(aRect, aSvgW, aSvgH, viewbox, anchor);
+ RenderLCDUIL(aSvgDocHandle, aCurrentTime, viewbox, anchor);
+}
+
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::RenderESWTL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ const TReal32 aCurrentTime,
+ TInt aSvgW, TInt aSvgH,
+ TM2GRenderRect& aRect,
+ TBool aUseNativeClear,
+ TInt* aReturnData)
+{
+ // prepare viewbox
+ TRect viewbox;
+ TPoint anchor;
+
+ PrepareViewbox(aRect, aSvgW, aSvgH, viewbox, anchor);
+
+ aReturnData[0] = 0;
+ aReturnData[1] = 0;
+ aReturnData[2] = 0;
+ aReturnData[3] = 0;
+ aReturnData[4] = anchor.iX;
+ aReturnData[5] = anchor.iY;
+ aReturnData[6] = viewbox.iTl.iX;
+ aReturnData[7] = viewbox.iTl.iY;
+ aReturnData[8] = viewbox.Width();
+ aReturnData[9] = viewbox.Height();
+
+ RenderESWTL(aSvgDocHandle, aCurrentTime, viewbox, anchor, aUseNativeClear, aReturnData);
+
+ return;
+}
+// CM2GRenderContext::SetRenderingQualityL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::SetRenderingQualityL(TInt aMode)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::SetRenderingQualityL()");
+ User::LeaveIfNull(iProxy);
+ iProxy->RenderQualityL(iEngineHandle, aMode);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::SetTransparencyL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::SetTransparency(TReal32 aAlpha)
+{
+ iAlpha = aAlpha;
+ iScaledAlpha = STATIC_CAST(TUint8, (aAlpha * MM2GRenderContext::KMaxAlphaValue));
+}
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::ConstructL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::ConstructL(MM2GSVGProxy* aProxy)
+ {
+ // Init member variables
+ SetTransparency(MM2GRenderContext::KFullOpaque);
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - begin");
+
+ if (aProxy)
+ {
+ iProxy = aProxy;
+ iProxy->CreateSvgEngineL(iEngineHandle);
+ M2G_DEBUG_2("M2G_DEBUG: CM2GRenderContext::ConstructL() - proxy: %d, new engine: %d", iProxy, iEngineHandle);
+ }
+ else
+ {
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - proxy is invalid");
+ M2G_THROW(KM2GArgNotOk);
+ }
+
+ User::LeaveIfError(iFbsSession.Connect());
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - end");
+ }
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::PrepareViewbox
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::PrepareViewbox(
+ TM2GRenderRect& aRr,
+ TInt aSvgW, TInt aSvgH,
+ TRect& aViewbox, TPoint& aAnchor)
+{
+ M2G_DEBUG_6("M2G_DEBUG: CM2GRenderContext::PrepareViewbox() cX=%d, cY=%d, cW=%d, cH=%d, anchorX=%d, anchorY=%d - begin", aRr.GetClipX(), aRr.GetClipY(), aRr.GetClipW(), aRr.GetClipH(), aRr.GetAnchorX(), aRr.GetAnchorY());
+
+ // Create an anchor point and an svg render area rect
+ aAnchor.SetXY(aRr.GetAnchorX(), aRr.GetAnchorY());
+ aViewbox.SetRect(aAnchor, TSize(aSvgW, aSvgH));
+
+ // NOTE: It's already verified in Java side that the SVG render area and
+ // the clip area intersects each other
+ aViewbox.Intersection(aRr);
+
+ // Check if the clip rect has changes the svg rect
+ if (aViewbox.iTl != aAnchor)
+ {
+ // Update anchor position
+ TPoint oldAnchor(aAnchor);
+ aAnchor = aViewbox.iTl;
+
+ // Update svg rect
+ aViewbox.Move((-oldAnchor.iX), (-oldAnchor.iY));
+ }
+ else
+ {
+ // The clip rect has not changed the svg rect. Only the
+ // anchor position need to be updated
+ aViewbox.Move(-aAnchor.iX, -aAnchor.iY);
+ }
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::PrepareViewbox() - end");
+}
+
+void CM2GRenderContext::RenderLCDUIL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ TReal32 aCurrentTime,
+ const TRect& aViewbox,
+ const TPoint& aAnchor)
+ {
+ M2G_DEBUG_4("M2G_DEBUG: CM2GRenderContext::RenderL() viewbox: x=%d, y=%d, w=%d, h=%d begin", aViewbox.iTl.iX, aViewbox.iTl.iY, aViewbox.Size().iWidth, aViewbox.Size().iHeight);
+
+ // No need to render if content is fully transparency (i.e. alpha=0)
+ if (iScaledAlpha == 0)
+ {
+ return;
+ }
+
+ QStringList list;
+ list <<"QImage-Format_RGB32";
+ TBuf8<32> fname;
+
+ // 1: render the svg document on the iImgBmp
+ iProxy->RenderDocumentL(
+ iEngineHandle,
+ aSvgDocHandle,
+ (TM2GSvgBitmapHandle)targetBitmap
+ , (TUint)NULL, aCurrentTime);
+
+ fname.Zero();
+ fname.Format(_L8("c:\\%s.bmp"), list.at(0).toLocal8Bit().constData());
+ TBool ret = iOffScreenQImage->save((const char*)fname.PtrZ());
+
+ QPixmap pixmap = QPixmap::fromImage(*iOffScreenQImage);
+ tempBitmapForMask = pixmap.toSymbianCFbsBitmap();
+
+ TFileName bitmapFilename;
+ bitmapFilename.Copy(_L("c:\\bugbitmap"));
+ bitmapFilename.AppendNum(tempBitmapForMask->Handle());
+ bitmapFilename.Append(_L(".bmp"));
+ SaveBitmapL(*tempBitmapForMask, bitmapFilename);
+
+ iWindowSurface->release();
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::RenderL() end");
+ }
+
+// -----------------------------------------------------------------------------
+/*TODO
+ * Write the separate RenderDocumentL method for QImage and CFbsBitmap
+ * also handle subsequent BitBlt and
+ * CreateAlphaBlendMaskL
+ * */
+void CM2GRenderContext::RenderESWTL(
+ TM2GSvgDocumentHandle& aSvgDocHandle,
+ TReal32 aCurrentTime,
+ const TRect& aViewbox,
+ const TPoint& aAnchor,
+ TBool /*aUseNativeClear*/,
+ TInt* aReturnData)
+{
+
+}
+// CM2GRenderContext::CreateAlphaBlendMask
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::ClearBitmapL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::ClearBitmapL(CFbsBitmap* aBmp)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - begin");
+
+ User::LeaveIfNull(aBmp);
+
+ TM2GBitmapLock lock(aBmp);
+
+ TSize size = aBmp->SizeInPixels();
+ TInt scanlineLength = aBmp->ScanLineLength(size.iWidth, aBmp->DisplayMode());
+
+ TUint32* buf = aBmp->DataAddress();
+ char* bufBytes = REINTERPRET_CAST(char*, buf);
+
+ Mem::FillZ(bufBytes, size.iHeight * scanlineLength);
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - end");
+}
+
+
+void CM2GRenderContext::ClearSurfaceL(TM2GSvgBitmapHandle aSvgtBmpHandle )
+ {
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - begin");
+//TODO As Currently we are not using this functionality.
+/* switch(wSurfaceType)
+ {
+ case Java::GFX::WsTypeQtImage:
+ QImage* tempQImage;
+ User::LeaveIfNull(tempQImage = (reinterpret_cast<Java::GFX::WindowSurface*>(aSvgtBmpHandle)->getQtImage()));
+ //TODO Do we need to lock the qimage as implemented below TM2GBitmapLock lock(tempBitmap);?
+ QSize sizeQimage = tempQImage->size();//TODO Check for SizeInPixels
+ TInt scanlineLengthQimage = tempQImage->bytesPerLine();
+ //uchar* bufBytesQimage = REINTERPRET_CAST(uchar*, tempQImage->bits());
+
+ Mem::FillZ(tempQImage->bits(), sizeQimage.height() * scanlineLengthQimage);
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearSurface Qimage Clear function- end");
+ break;
+
+ case Java::GFX::WsTypeSymbianBitmap:
+ CFbsBitmap* tempBitmap;
+ User::LeaveIfNull(tempBitmap = (reinterpret_cast<Java::GFX::WindowSurface*>(aSvgtBmpHandle)->getSymbianBitmap()));
+ TM2GBitmapLock lock(tempBitmap);
+ TSize sizeBmp = tempBitmap->SizeInPixels();
+ TInt scanlineLengthBmp = tempBitmap->ScanLineLength(sizeBmp.iWidth, tempBitmap->DisplayMode());
+ TUint32* bufBmp = tempBitmap->DataAddress();
+ char* bufBytesBmp = REINTERPRET_CAST(char*, bufBmp);
+
+ Mem::FillZ(bufBytesBmp, sizeBmp.iHeight * scanlineLengthBmp);
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearSurface Bitmap Clear function- end");
+ break;
+
+ default:
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap Type Not Supported.- end");
+ User::Leave(KErrNotSupported);
+ break;
+ }
+ */
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::FillBitmapL
+// -----------------------------------------------------------------------------
+void CM2GRenderContext::FillBitmapL(CFbsBitmap* aBmp, const TUint8& aChar)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GRenderContext::FillBitmap() filled with=%d - begin", aChar);
+ User::LeaveIfNull(aBmp);
+ TM2GBitmapLock lock(aBmp);
+
+ TSize size = aBmp->SizeInPixels();
+ TInt scanlineLength = aBmp->ScanLineLength(size.iWidth, aBmp->DisplayMode());
+
+ TUint32* buf = aBmp->DataAddress();
+ char* bufBytes = REINTERPRET_CAST(char*, buf);
+
+ Mem::Fill(bufBytes, size.iHeight * scanlineLength, aChar);
+
+ M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::FillBitmap - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GRenderContext::GetBufferHandleL
+// -----------------------------------------------------------------------------
+TM2GSvgBitmapHandle CM2GRenderContext::GetBufferHandleL() const
+ {
+ switch(wSurfaceType)
+ {
+ case Java::GFX::WsTypeQtImage:
+ User::LeaveIfNull(iOffScreenQImage);
+ return REINTERPRET_CAST(TM2GSvgBitmapHandle , iOffScreenQImage);
+ break;
+
+ case Java::GFX::WsTypeSymbianBitmap:
+ User::LeaveIfNull(iOffScreenBitmap);
+ return REINTERPRET_CAST(TM2GSvgBitmapHandle , iOffScreenBitmap);
+ break;
+
+ default:
+ User::Leave(KErrNotSupported);
+ break;
+ }
+
+ }
+
+//CODE to check the Bitmap Contain.
+TInt CM2GRenderContext::SaveBitmapL(const CFbsBitmap& aNVGBitmap, const TFileName& aFileName)
+ {
+ TFileName bitmapFilename;
+ bitmapFilename.Copy(aFileName);
+ RFs aFs;
+ User::LeaveIfError(aFs.Connect());
+ CImageEncoder * imgEncoder = 0;
+ TRequestStatus requesStatus = 0;
+ imgEncoder = CImageEncoder::FileNewL(aFs, bitmapFilename, _L8("image/bmp"), CImageEncoder::EOptionAlwaysThread);
+ imgEncoder->Convert(&requesStatus, aNVGBitmap);
+ User::WaitForRequest(requesStatus);
+ delete imgEncoder;
+ aFs.Close();
+ return 0;
+ }
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/CM2GSVGProxy.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGTopt proxy implementation
+*
+*/
+
+// INCLUDE FILES
+#include <AknUtils.h> // Files add recently
+#include <avkon.hrh> // Files add recently
+#include <SvgJavaInterfaceImpl.h>
+#include <utf.h> // Character conversion API
+#include <featmgr.h>
+#include "CM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::NewL
+// -----------------------------------------------------------------------------
+CM2GSVGProxy* CM2GSVGProxy::NewL()
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::NewL()");
+ CM2GSVGProxy* self = new(ELeave) CM2GSVGProxy;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::~CM2GSVGProxy
+// -----------------------------------------------------------------------------
+CM2GSVGProxy::~CM2GSVGProxy()
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native SVGTopt: %d", iNative);
+ if (iNative)
+ {
+ CloseContainers();
+ delete iNative;
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native deleted");
+ iNative = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AddCloseL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AddCloseL(const TM2GSvgPathHandle& aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - begin");
+ iNative->SvgPathAddClose(aPathHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AddCurveToL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AddCurveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TM2GPathCurveData& aPathCurveData)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - begin");
+ iNative->SvgPathAddCurveTo(
+ aPathHandle,
+ aPathCurveData[ 0 ], aPathCurveData[ 1 ], // X1, Y1
+ aPathCurveData[ 2 ], aPathCurveData[ 3 ], // X2, Y2
+ aPathCurveData[ 4 ], aPathCurveData[ 5 ]); // X3, Y3
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AddLineToL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AddLineToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - begin");
+ iNative->SvgPathAddLineTo(aPathHandle, aX, aY);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AddMoveToL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AddMoveToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX, const TReal32& aY)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - begin");
+ iNative->SvgPathAddMoveTo(aPathHandle, aX, aY);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AddQuadToL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AddQuadToL(
+ const TM2GSvgPathHandle& aPathHandle,
+ const TReal32& aX1, const TReal32& aY1,
+ const TReal32& aX2, const TReal32& aY2)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - begin");
+ iNative->SvgPathAddQuadTo(aPathHandle, aX1, aY1, aX2, aY2);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::AppendChildL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::AppendChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - begin");
+ iNative->SvgElementAppendChild(aElementHandle, aChildElementHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::BeginElementAtL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::BeginElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() offset:%f - begin", aOffset);
+ iNative->SvgDocumentBeginElementAt(
+ aDocumentHandle, aElementHandle, aOffset);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CheckRemoveableL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CheckRemoveableL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aRemoveable)
+
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - begin");
+ aRemoveable = iNative->SvgElementCheckRemoveable(aElementHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::ClearSvgSurfaceL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::ClearSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ClearSvgSurfaceL() - not supported");
+ User::Leave(KErrNotSupported);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CreateDocumentL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CreateDocumentL(const TPtrC16& aData, TM2GSvgDocumentHandle& aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL() - begin");
+ aDocumentHandle = M2G_INVALID_HANDLE;
+
+ M2G_DEBUG_1("M2G_DEBUG: M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(): content length=%d - call engine", aData.Length());
+
+ // Create document handle. Note: validity check is done in java side
+ aDocumentHandle = iNative->SvgDocumentCreateL(aData);
+ // Append document handle to the container
+ if (iSvgDocuments.Find(aDocumentHandle) == KErrNotFound)
+ {
+ TRAPD(err, iSvgDocuments.Append(aDocumentHandle));
+ if (err != KM2GOk)
+ {
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
+ }
+ }
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), handle=%d, total document count=%d - end", aDocumentHandle, iSvgDocuments.Count());
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CreateElementNsL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CreateElementNsL(
+ const TM2GSvgAttrType& aType,
+ const TM2GSvgDocumentHandle& /* aDocumentHandle */,
+ TM2GSvgElementHandle& aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() - begin");
+ // Note: validity check is done in java side
+ aElementHandle = iNative->SvgElementCreate(aType);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() handle=%d - end", aElementHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CreatePathL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CreatePathL(TM2GSvgPathHandle& aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - begin");
+ aPathHandle = iNative->SvgPathCreate();
+ if (aPathHandle == M2G_INVALID_HANDLE)
+ {
+ User::Leave(KM2GMemoryNotOk);
+ }
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CreateSvgEngineL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL() - begin");
+ // Create engine handle
+ aEngineHandle = iNative->SvgEngineCreate();
+ if (aEngineHandle == M2G_INVALID_HANDLE)
+ {
+ User::Leave(KM2GMemoryNotOk);
+ }
+ // Append engine handle to the container
+ if (iSvgEngines.Find(aEngineHandle) == KErrNotFound)
+ {
+ TRAPD(err, iSvgEngines.Append(aEngineHandle));
+ if (err != KM2GOk)
+ {
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
+ }
+ }
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), handle=%d, total engine count=%d - end", aEngineHandle, iSvgEngines.Count());
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CreateSvgSurfaceL
+// -----------------------------------------------------------------------------
+TM2GBitmapHandle CM2GSVGProxy::CreateSvgSurfaceL(TInt /* aWidth */, TInt /* aHeight */)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgSurfaceL() - not supported");
+
+ User::Leave(KErrNotSupported);
+
+ return M2G_INVALID_HANDLE;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::DeleteDocumentL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() native:%d, document:%d - begin", iNative, aDocumentHandle);
+ TInt findResult = iSvgDocuments.Find(aDocumentHandle);
+ if (findResult != KErrNotFound)
+ {
+ // Try to remove the handle from the container
+ TRAPD(err, iSvgDocuments.Remove(findResult));
+ if (err != KM2GOk)
+ {
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
+ }
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - container remove result=%d", err);
+ // Delete the handle
+ iNative->SvgDocumentDestroy(aDocumentHandle);
+ }
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - total document count=%d - end", iSvgDocuments.Count());
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::DeleteSvgEngineL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() engine:%d - begin", aEngineHandle);
+ TInt findResult = iSvgEngines.Find(aEngineHandle);
+ if (findResult != KErrNotFound)
+ {
+ // Try to remove the handle from the container
+ TRAPD(err, iSvgEngines.Remove(findResult));
+ if (err != KM2GOk)
+ {
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
+ }
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - container remove result=%d", err);
+ // Delete the handle
+ iNative->SvgEngineDestroy(aEngineHandle);
+ }
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - total engine count=%d - end", iSvgEngines.Count());
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::DeleteSvgSurfaceL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::DeleteSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DeleteSvgSurfaceL() - not supported");
+
+ User::Leave(KErrNotSupported);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::DestroyPathL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::DestroyPathL(const TM2GSvgPathHandle& aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - begin");
+ iNative->SvgPathDestroy(aPathHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::DispatchMouseEventL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::DispatchMouseEventL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle)
+{
+ M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): doc handle:%d, x=%d, y=%d- begin", aDocumentHandle, aX, aY);
+ aElementHandle = iNative->SvgDocumentDispatchMouseEvent(
+ aDocumentHandle, aX, aY);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): element handle=%d - end", aElementHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::EndElementAtL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::EndElementAtL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ const TReal32& aOffset)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() offset=%f - begin", aOffset);
+ iNative->SvgDocumentEndElementAt(
+ aDocumentHandle, aElementHandle, aOffset);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::FocusOnL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::FocusOnL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOnL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
+ iNative->SvgDocumentFocusOn(aDocumentHandle, aElementHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOnL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::FocusOutL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::FocusOutL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOutL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
+ iNative->SvgDocumentFocusOut(aDocumentHandle, aElementHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOutL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetBBoxL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult)
+{
+ aResult = KM2GOk;
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetBBoxL() - begin");
+ iNative->SvgElementGetBBox(
+ aElementHandle,
+ aAttributeType,
+ &aRectData[ 0 ], // X
+ &aRectData[ 1 ], // Y
+ &aRectData[ 2 ], // Width
+ &aRectData[ 3 ]); // Height
+ M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetColorTrait
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GColorData& aColor,
+ TInt& aResult)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - begin");
+ aResult = iNative->SvgElementGetColorAttribute(
+ aElementHandle,
+ aAttributeType,
+ &aColor[ 0 ], // Red
+ &aColor[ 1 ], // Green
+ &aColor[ 2 ]); // Blue
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetElementByIdL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetElementByIdL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aId,
+ TM2GSvgElementHandle& aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - begin");
+ aElementHandle = iNative->SvgDocumentGetElementById(
+ aDocumentHandle,
+ aId);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetElementTypeIdL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() - begin");
+ aId = STATIC_CAST(TInt16, iNative->SvgElementGetType(aElementHandle));
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() type id:%d- end", aId);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetEnumTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeTypeId,
+ TInt16& aEnumTrait)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() - begin");
+ aEnumTrait = iNative->SvgElementGetEnumAttribute(
+ aElementHandle,
+ aAttributeTypeId);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() enum trait:%d - end", aEnumTrait);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetExternalListItemL
+// -----------------------------------------------------------------------------
+TInt CM2GSVGProxy::GetExternalListItemL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aIndex,
+ TPtrC16& aItem)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListItemL() index=%d- begin", aIndex);
+ TInt result = iNative->SvgDocumentGetExternalListItem(aDocumentHandle, aIndex, aItem);
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetExternalListListItemL() result:%d, item sz:%d - end", result, aItem.Length());
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetExternalListSizeL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetExternalListSizeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aListSz)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL() - begin");
+ aListSz = iNative->SvgDocumentGetExternalListSize(aDocumentHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL(): %d - end", aListSz);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetFirstElementChildL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetFirstElementChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aChildHandle)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() element=%d - begin", aElementHandle);
+ aChildHandle = iNative->SvgElementGetFirstElementChild(aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() child=%d - end", aChildHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetFloatTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TReal32& aFloatTrait)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - begin");
+ aFloatTrait =
+ iNative->SvgElementGetFloatAttribute(aElementHandle, aAttributeType);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetMatrixTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GMatrixData& aMatrix, TInt& aResult)
+{
+ // [ m00 m01 m02 ]
+ // [ m10 m11 m12 ]
+ // [ 0 0 1 ]
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - begin");
+ aResult = iNative->SvgElementGetMatrixAttribute(
+ aElementHandle,
+ aAttributeType,
+ &aMatrix[ 0 ], // m00
+ &aMatrix[ 1 ], // m10
+ &aMatrix[ 2 ], // m01
+ &aMatrix[ 3 ], // m11
+ &aMatrix[ 4 ], // m02
+ &aMatrix[ 5 ]); // m12
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetMediaTimeL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TReal32& aSeconds)
+{
+ aSeconds = iNative->SvgDocumentGetMediaTime(aDocumentHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetNextElementSiblingL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetNextElementSiblingL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aSiblingElementHandle)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), element=%d - begin", aElementHandle);
+ aSiblingElementHandle = iNative->SvgElementGetNextElementSibling(aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), sibling=%d - end", aSiblingElementHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetNumberOfSegmentsL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetNumberOfSegmentsL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt& aNumberOfSegments)
+{
+ aNumberOfSegments = iNative->SvgPathGetSegmentCount(aPathHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetParentL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetParentL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aParentElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetParentL() - begin");
+ aParentElementHandle = iNative->SvgElementGetParent(aElementHandle);
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetParentL() element=%d, parent=%d, - end", aElementHandle, aParentElementHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetPathTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt& aPathTrait)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() - begin");
+ aPathTrait = iNative->SvgElementGetPathAttribute(aElementHandle, aAttributeType);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() %d - end", aPathTrait);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetRectTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TM2GRectData& aRectData, TInt& aResult)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL() - begin");
+ aResult = iNative->SvgElementGetRectAttribute(
+ aElementHandle,
+ aAttributeType,
+ &aRectData[ 0 ], // X
+ &aRectData[ 1 ], // Y
+ &aRectData[ 2 ], // Width
+ &aRectData[ 3 ]); // Height
+ M2G_DEBUG_5("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL(): result=%d [x=%f, y=%f, w=%f, h=%f] - end", aResult, aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetRootElementL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetRootElementL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TM2GSvgElementHandle& aRootElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() - begin");
+ aRootElementHandle = iNative->SvgDocumentGetRootElement(aDocumentHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() handle:%d - end", aRootElementHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetScreenBBoxL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetScreenBBoxL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GScreenBBoxData& aScreenBBoxData)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL() - begin");
+ iNative->SvgElementGetScreenBBox(
+ aElementHandle,
+ &aScreenBBoxData[ 0 ], // X
+ &aScreenBBoxData[ 1 ], // Y
+ &aScreenBBoxData[ 2 ], // Width
+ &aScreenBBoxData[ 3 ]); // Height
+ M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aScreenBBoxData[ 0 ], aScreenBBoxData[ 1 ], aScreenBBoxData[ 2 ], aScreenBBoxData[ 3 ]);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetSegmentParameterL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetSegmentParameterL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex, TInt aParamIndex,
+ TReal32& aSegmentParam)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d - begin", aSegmentIndex, aParamIndex);
+ aSegmentParam = iNative->SvgPathGetSegmentParameter(
+ aPathHandle,
+ aSegmentIndex,
+ aParamIndex);
+ M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d, param=%d - end", aSegmentIndex, aParamIndex, aSegmentParam);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetSegmentTypeL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetSegmentTypeL(
+ const TM2GSvgPathHandle& aPathHandle,
+ TInt aSegmentIndex,
+ TInt16& aSegmentType)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d - begin", aSegmentIndex);
+ aSegmentType = iNative->SvgPathGetSegmentType(
+ aPathHandle,
+ aSegmentIndex);
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d, type=%d - end", aSegmentIndex, aSegmentType);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetStringTraitL
+// -----------------------------------------------------------------------------
+TInt CM2GSVGProxy::GetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TPtrC16& aStr)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute type:%d, handle:%u - begin", aAttributeType, aElementHandle);
+
+ TInt result = iNative->SvgElementGetStringAttribute(aElementHandle, aAttributeType, aStr);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute sz:%d", aStr.Length());
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetSvgSurfaceHeightL
+// -----------------------------------------------------------------------------
+TInt CM2GSVGProxy::GetSvgSurfaceHeightL(const TM2GBitmapHandle& /* aSurfaceHandle */)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceHeightL - not supported");
+
+ User::Leave(KErrNotSupported);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetSvgSurfaceWidthL
+// -----------------------------------------------------------------------------
+TInt CM2GSVGProxy::GetSvgSurfaceWidthL(const TM2GBitmapHandle& /* aSurfaceHandle */)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceWidthL - not supported");
+
+ User::Leave(KErrNotSupported);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetUsedFromElementL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetUsedFromElementL(
+ const TM2GSvgElementHandle& aElementHandle,
+ TM2GSvgElementHandle& aHandle)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() used from element=%d - begin", aElementHandle);
+ aHandle = iNative->SvgElementGetUsedFromElement(aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() found element=%d - end", aHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetViewportHeightL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aHeight)
+{
+ aHeight = iNative->SvgDocumentGetViewportHeight(aDocumentHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::GetViewportWidthL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::GetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt& aWidth)
+{
+ aWidth = iNative->SvgDocumentGetViewportWidth(aDocumentHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::InitViewportL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::InitViewportL(const TM2GSvgDocumentHandle& aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InitViewportL()");
+ return iNative->SvgDocumentViewportInit(aDocumentHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::InsertBeforeL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::InsertBeforeL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aNewChildElementHandle,
+ const TM2GSvgElementHandle& aReferenceElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - begin");
+ iNative->SvgElementInsertBefore(
+ aElementHandle,
+ aNewChildElementHandle,
+ aReferenceElementHandle);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::IsActiveL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::IsActiveL(const TM2GSvgElementHandle& aElementHandle, TInt& aActive)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsActiveL() - begin");
+ aActive = iNative->SvgElementIsActive(aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsActiveL() active:%d - end", aActive);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::IsElementInDomL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::IsElementInDomL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgElementHandle& aElementHandle,
+ TInt& aIsElementInDom)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() doc handle=%d, elem handle=%d - begin", aDocumentHandle, aElementHandle);
+ aIsElementInDom = iNative->SvgElementElementInDOM(
+ aDocumentHandle, aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() result=%d - end", aIsElementInDom);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::IsUsedL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::IsUsedL(const TM2GSvgElementHandle& aElementHandle, TInt& aResult)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsUsedL() - begin");
+ aResult = iNative->SvgElementIsUsed(aElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsUsedL(), result=%d - end", aResult);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::RemoveChildL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::RemoveChildL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgElementHandle& aChildElementHandle,
+ TM2GSvgElementHandle& aHandle)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() parent=%d, child=%d - begin", aElementHandle, aChildElementHandle);
+ aHandle = iNative->SvgElementRemoveChild(aElementHandle, aChildElementHandle);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() result handle=%d - end", aHandle);
+}
+
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::RenderDocumentL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GBitmapHandle& aSurfaceHandle,
+ TM2GBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() native:%d, time=%f - begin", iNative, aCurrentTime);
+ M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, surface:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
+ iNative->SvgEngineRenderDocument(
+ aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
+}
+
+//TODO following changes done for Qimage
+//Check for TUint or TInt for subsequent API Call
+void CM2GSVGProxy::RenderDocumentL(
+ const TM2GSvgEngineHandle& aEngineHandle,
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TM2GSvgBitmapHandle& aSurfaceHandle,
+ TM2GSvgBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime)
+ {
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() Qimage variant native:%d, time=%f - begin", iNative, aCurrentTime);
+ M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, SvgBitmapHandle:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
+ iNative->SvgEngineRenderDocument(
+ aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
+
+ }
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::RenderQualityL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::RenderQualityL(
+ const TM2GSvgDocumentHandle& aEngineHandle,
+ TInt aQuality)
+{
+ iNative->SvgEngineSetRenderQuality(aEngineHandle, aQuality);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::RequestCompletedL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::RequestCompletedL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TPtrC16& aURI,
+ const TPtrC8& aResourceData,
+ TInt& aCompleted)
+{
+ M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RequestCompleted() uri sz=%d, resource sz= %d ", aURI.Length(), aResourceData.Length());
+ aCompleted = iNative->SvgDocumentRequestCompleted(
+ aDocumentHandle,
+ aURI,
+ aResourceData);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RequestCompletedL() completed=%d - end", aCompleted);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetColorTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetColorTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GColorData& aColor)
+{
+ iNative->SvgElementSetColorAttribute(
+ aElementHandle,
+ aAttributeType,
+ aColor[ 0 ], // red
+ aColor[ 1 ], // green
+ aColor[ 2 ]); // blue
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetEnumTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetEnumTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ TInt16 aValue)
+{
+ iNative->SvgElementSetEnumAttribute(
+ aElementHandle,
+ aAttributeType,
+ aValue);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetFloatTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetFloatTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TReal32& aValue)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetFloatTraitL() - %f", aValue);
+ iNative->SvgElementSetFloatAttribute(
+ aElementHandle,
+ aAttributeType,
+ aValue);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetMatrixTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetMatrixTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GMatrixData& aMatrix)
+{
+ // [ m00 m01 m02 ]
+ // [ m10 m11 m12 ]
+ // [ 0 0 1 ]
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - begin");
+ iNative->SvgElementSetMatrixAttribute(
+ aElementHandle,
+ aAttributeType,
+ aMatrix[ 0 ], // m00 - A
+ aMatrix[ 1 ], // m10 - B
+ aMatrix[ 2 ], // m01 - C
+ aMatrix[ 3 ], // m11 - D
+ aMatrix[ 4 ], // m02 - E
+ aMatrix[ 5 ]); // m12 - F
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetMediaTimeL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetMediaTimeL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ const TReal32& aSeconds)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() %f - begin", aSeconds);
+ iNative->SvgDocumentSetMediaTime(aDocumentHandle, aSeconds);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetPathTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetPathTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GSvgPathHandle& aPathHandle)
+{
+ iNative->SvgElementSetPathAttribute(
+ aElementHandle,
+ aAttributeType,
+ aPathHandle);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetRectTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetRectTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeType,
+ const TM2GRectData& aRect)
+{
+ iNative->SvgElementSetRectAttribute(
+ aElementHandle,
+ aAttributeType,
+ aRect[ 0 ], // aX
+ aRect[ 1 ], // aY
+ aRect[ 2 ], // aWidth
+ aRect[ 3 ]); // aHeight
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetRenderingQualityL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetRenderingQualityL(
+ const TM2GSvgDocumentHandle& aEngineHandle,
+ TInt aMode)
+{
+ iNative->SvgEngineSetRenderQuality(aEngineHandle, aMode);
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetStringTraitL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetStringTraitL(
+ const TM2GSvgElementHandle& aElementHandle,
+ const TM2GSvgAttrType& aAttributeTypeId,
+ const TPtrC16& aStr)
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL() - begin");
+ iNative->SvgElementSetStringAttribute(
+ aElementHandle,
+ aAttributeTypeId,
+ aStr);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL(): str sz:%d - end", aStr.Length());
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetViewportWidthL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetViewportWidthL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aWidth)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL(): %d - begin", aWidth);
+ iNative->SvgDocumentSetViewportWidth(aDocumentHandle, aWidth);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL() - end");
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::SetViewportHeightL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::SetViewportHeightL(
+ const TM2GSvgDocumentHandle& aDocumentHandle,
+ TInt aHeight)
+{
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL(): %d - begin", aHeight);
+ iNative->SvgDocumentSetViewportHeight(aDocumentHandle, aHeight);
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL() - end");
+}
+
+// == PROTECTED METHODS ==
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CloseContainers
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::CloseContainers()
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - begin");
+ if (iNative)
+ {
+ // Clear document container
+ TInt count = iSvgDocuments.Count();
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - document count=%d", count);
+ for (TInt index = 0; index < count; index++)
+ {
+ iNative->SvgDocumentDestroy(iSvgDocuments[index]);
+ }
+ iSvgDocuments.Reset();
+ iSvgDocuments.Close();
+ // Clear engine container
+ count = iSvgEngines.Count();
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - engine count=%d", count);
+ for (TInt index = 0; index < count; index++)
+ {
+ iNative->SvgEngineDestroy(iSvgEngines[index]);
+ }
+ iSvgEngines.Reset();
+ iSvgEngines.Close();
+ }
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - end");
+}
+
+// == PRIVATE METHODS ==
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::CM2GSVGProxy
+// -----------------------------------------------------------------------------
+CM2GSVGProxy::CM2GSVGProxy()
+ : CBase(),
+ iNative(NULL),
+ iSvgEngines(),
+ iSvgDocuments()
+{
+ iSvgEngines.Compress();
+ iSvgDocuments.Compress();
+}
+
+// -----------------------------------------------------------------------------
+// CM2GSVGProxy::ConstructL
+// -----------------------------------------------------------------------------
+void CM2GSVGProxy::ConstructL()
+{
+ M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ConstructL() - begin");
+
+ //Get the font spec with variant default font
+ const TInt KApacFontId = EApacPlain16;
+ const TInt KLatintFontId = ELatinBold12;
+ TInt fontId = KLatintFontId;
+
+ switch (AknLayoutUtils::Variant())
+ {
+ case EApacVariant:
+ {
+ fontId = KApacFontId;
+ }
+ break;
+
+ case EEuropeanVariant:
+ default:
+ break;
+ }
+
+ const CFont* font = AknLayoutUtils::FontFromId(fontId);
+ TFontSpec spec = font->FontSpecInTwips();
+
+ iNative = CSvgJavaInterfaceImpl::NewL(spec);
+ M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::ConstructL() - SVGTopt created: %d", iNative);
+}
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/CSynchronization.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: M2GCore function call synchronization for J9
+*
+*/
+
+// INCLUDE FILES
+#include "CSynchronization.h"
+
+NONSHARABLE_CLASS(M2gGlobals)
+{
+public:
+ M2gGlobals() : mSync(0) {}
+
+public:
+ CSynchronization* mSync;
+};
+
+#if defined(__WINSCW__)
+
+#include <pls.h>
+M2gGlobals* getM2gGlobals()
+{
+ // Access the PLS of this process.
+ //Todo have to check Uid for process.
+ return Pls<M2gGlobals>(TUid::Uid(0x200211E2));
+}
+
+#else
+
+static M2gGlobals* sGlobals = 0;
+
+M2gGlobals* getM2gGlobals()
+{
+ if (sGlobals == 0)
+ {
+ sGlobals = new M2gGlobals();
+ }
+ return sGlobals;
+}
+#endif
+
+
+// STATIC MEMBERS
+/*static*/ //CSynchronization* CSynchronization::iSelf = NULL;
+
+// -----------------------------------------------------------------------------
+// CSynchronization::InstanceL
+// -----------------------------------------------------------------------------
+/*static*/ CSynchronization* CSynchronization::InstanceL()
+{
+ static M2gGlobals* globals = getM2gGlobals();
+ if (!globals->mSync)
+ {
+ globals->mSync = CSynchronization::NewL();
+ }
+ return globals->mSync;
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::NewL
+// -----------------------------------------------------------------------------
+/*static*/ CSynchronization* CSynchronization::NewL()
+{
+ CSynchronization* self = new(ELeave) CSynchronization();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::ConstructL
+// -----------------------------------------------------------------------------
+void CSynchronization::ConstructL()
+{
+ User::LeaveIfError(iGuard.CreateLocal());
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::CSynchronization
+// -----------------------------------------------------------------------------
+CSynchronization::CSynchronization() : iErrorCode(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::~CSynchronization
+// -----------------------------------------------------------------------------
+CSynchronization::~CSynchronization()
+{
+ iGuard.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::Lock
+// -----------------------------------------------------------------------------
+void CSynchronization::Lock()
+{
+ iGuard.Wait();
+ iErrorCode = 0;
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::Unlock
+// -----------------------------------------------------------------------------
+void CSynchronization::Unlock()
+{
+ iErrorCode = 0;
+ iGuard.Signal();
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::SetErrorCode
+// -----------------------------------------------------------------------------
+void CSynchronization::SetErrorCode(TInt aCode)
+{
+ iErrorCode = aCode;
+}
+
+// -----------------------------------------------------------------------------
+// CSynchronization::GetErrorCode
+// -----------------------------------------------------------------------------
+TInt CSynchronization::GetErrorCode()
+{
+ return iErrorCode;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/M2GGeneral.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,287 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: General methods
+*
+*/
+
+// INCLUDE FILES
+#include <s32strm.h> // RWriteStream
+
+
+#ifdef M2G_INFO_POPUP
+#include <eikenv.h> // CEikonEnv::InfoWinL
+#endif
+
+#include <jni.h>
+
+#include <SvgJavaInterfaceImpl.h>
+#include "M2GGeneral.h"
+
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::RaiseException
+// -----------------------------------------------------------------------------
+void M2GGeneral::RaiseException(
+ JNIEnv* aEnv, const TDesC8& aName, const TUint8* aMsg)
+{
+ M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::RaiseException() ####");
+
+ if (aEnv)
+ {
+ jclass clazz = aEnv->FindClass(
+ REINTERPRET_CAST(const char*, aName.Ptr()));
+
+ if (!clazz)
+ {
+ // if exception class not found, then use java.lang.Exception
+ clazz = aEnv->FindClass(
+ REINTERPRET_CAST(const char*, KJavaExceptionClass().Ptr()));
+ }
+
+ aEnv->ThrowNew(clazz, REINTERPRET_CAST(const char*, aMsg));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::CheckErrorCode
+// -----------------------------------------------------------------------------
+TInt M2GGeneral::CheckErrorCode(JNIEnv* aEnv, TInt aErrorCode)
+{
+ M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode: %d - begin", aErrorCode);
+ TInt code = aErrorCode;
+ const TUint8* msg = (STATIC_CAST(const TDesC8&, KM2GEmptyString8)).Ptr();
+ jcfcommon::auto_ptr<MJavaError> error;
+
+ // Check if an error object
+ if (aErrorCode > 0)
+ {
+ M2G_DEBUG_0("M2G_DEBUG: M2GGeneral::CheckErrorCode(), is MJavaError");
+
+ // Error object need to be deleted here and the auto_ptr takes care of that!!
+ error.reset(JavaUnhand< MJavaError >(aErrorCode));
+
+ // Get an error description through the MJavaError object
+ msg = error->Description().Ptr();
+
+ switch (error->ErrorCode())
+ {
+ case KM2GIOException:
+ {
+ code = error->ErrorCode();
+ }
+ default:
+ {
+ code = error->ErrorCode();
+ }
+ }
+ M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode(), MJavaError: error code=%d", code);
+ }
+
+ switch (code)
+ {
+ case KM2GMemoryNotOk:
+ {
+ M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - OutOfMemoryError ####");
+ M2GGeneral::RaiseException(aEnv, KJavaOutOfMemoryErrorClass, msg);
+ return code;
+ }
+ case KM2GIOException:
+ {
+ M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - IOException ####");
+ M2GGeneral::RaiseException(aEnv, KJavaIOExceptionClass, msg);
+ return code;
+ }
+ case KM2GHandleNotOk:
+ {
+ M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - NullPointerException ####");
+ M2GGeneral::RaiseException(aEnv, KJavaNullPointerException, msg);
+ return code;
+ }
+ default:
+ {
+ M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode() error code=%d - end", code);
+ return code;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::CheckHandle
+// -----------------------------------------------------------------------------
+TInt M2GGeneral::CheckHandle(JNIEnv* aEnv, TInt aHandle)
+{
+ if (aHandle == M2G_INVALID_HANDLE)
+ {
+ M2GGeneral::RaiseException(aEnv, KJavaNullPointerException);
+ }
+ if (aHandle < 0)
+ {
+ M2GGeneral::CheckErrorCode(aEnv, aHandle);
+ }
+ return aHandle;
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::CheckErrorCodeAndHandle
+// -----------------------------------------------------------------------------
+TInt M2GGeneral::CheckErrorCodeAndHandle(
+ JNIEnv* aEnv, TInt aErrorCode, TInt aHandle, TInt aErrorResult)
+{
+ if ((aErrorCode == KM2GOk) && (aHandle != M2G_INVALID_HANDLE))
+ {
+ return aHandle;
+ }
+ if (aErrorCode != KM2GOk)
+ {
+ M2GGeneral::CheckErrorCode(aEnv, aErrorCode);
+ }
+ else if (aHandle == M2G_INVALID_HANDLE)
+ {
+ M2GGeneral::RaiseException(aEnv, KJavaOutOfMemoryErrorClass);
+ }
+ return aErrorResult;
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::PopupInfo
+// -----------------------------------------------------------------------------
+#ifdef M2G_INFO_POPUP
+void M2GGeneral::PopupInfo(
+ const TDesC& aLine1,
+ const TDesC& aLine2)
+{
+ TInt err = KM2GOk;
+ TRAP(err, CEikonEnv::InfoWinL(aLine1, aLine2));
+ if (err == KM2GOk)
+ {
+ // DUMMY
+ }
+}
+#endif // M2G_INFO_POPUP
+
+
+#ifdef M2G_STATISTIC_DEBUG
+// -----------------------------------------------------------------------------
+// M2GGeneral::TM2GStatistic::TM2GStatistic
+// -----------------------------------------------------------------------------
+M2GGeneral::TM2GStatistic::TM2GStatistic()
+{
+ Reset();
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::TM2GStatistic::Reset()
+// -----------------------------------------------------------------------------
+void M2GGeneral::TM2GStatistic::Reset()
+{
+ // Time
+ iStartTime.UniversalTime();
+ iEndTime.UniversalTime();
+ // Thread
+ iId = RThread().Id();
+ RThread thread;
+ if (thread.Open(iId) == KM2GOk)
+ {
+ iThreadName = thread.Name();
+ thread.Close();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::TM2GStatistic::Print()
+// -----------------------------------------------------------------------------
+void M2GGeneral::TM2GStatistic::Print(TBool aPrintElapsedTime)
+{
+ TInt totalRom = 0;
+ TInt totalRam = 0;
+ TInt freeRam = 0;
+ HAL::Get(HALData::EMemoryROM, totalRom);
+ HAL::Get(HALData::EMemoryRAM, totalRam);
+ HAL::Get(HALData::EMemoryRAMFree, freeRam);
+
+ // Update time
+ iEndTime.UniversalTime();
+
+ M2G_DEBUG_0("====================================================");
+ // Write memory info
+ if (aPrintElapsedTime)
+ {
+ M2G_DEBUG_5(
+ "Rom size:%d, ram size:%d, ram free:%d, ram used:%d, elapsed time:%d",
+ totalRom >> 10,
+ totalRam >> 10,
+ freeRam >> 10,
+ (totalRam - freeRam) >> 10,
+ iEndTime.MicroSecondsFrom(iStartTime).Int64());
+ }
+ else
+ {
+ M2G_DEBUG_4(
+ "Rom size:%d, ram size:%d, ram free:%d, ram used:%d",
+ totalRom >> 10,
+ totalRam >> 10,
+ freeRam >> 10,
+ (totalRam - freeRam) >> 10);
+ }
+ // Write thread info
+ RThread thread;
+ if (thread.Open(iId) == KM2GOk)
+ {
+ TThreadStackInfo stackInfo;
+ thread.StackInfo(stackInfo);
+ thread.Close();
+ TUint id = iId;
+ M2G_DEBUG_2("Thread id:%d, size:%d", id, (stackInfo.iBase - stackInfo.iLimit) >> 10);
+ }
+ M2G_DEBUG_0("====================================================");
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::TM2GStatistic::Print()
+// -----------------------------------------------------------------------------
+void M2GGeneral::TM2GStatistic::Print(RWriteStream& /*aStream*/)
+{
+}
+
+// -----------------------------------------------------------------------------
+// M2GGeneral::TM2GStatistic::Log()
+// -----------------------------------------------------------------------------
+void M2GGeneral::TM2GStatistic::Log()
+{
+ M2G_DEBUG_0("M2GGeneral::TM2GStatistic::Log()");
+ M2GGeneral::TM2GStatistic statistic;
+ statistic.Print();
+}
+
+#endif // M2G_STATISTIC_DEBUG
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/M2GUtils.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,346 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Util methods
+*
+*/
+
+// INCLUDE FILES
+#include <bitdev.h> // CFbsBitmapDevice
+#include <bitstd.h> // CFbsBitGc
+#include <e32math.h> // FRand
+#include "M2GUtils.h"
+
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class TSWTBitBlt;
+class TM2GBitmapLock;
+// -----------------------------------------------------------------------------
+// M2GBitmapUtils::BitBlt
+// -----------------------------------------------------------------------------
+TInt M2GBitmapUtils::BitBlt(CFbsBitmap& aTarget,
+ const CFbsBitmap& aSource,
+ const TPoint& aPoint,
+ const TRect* aRect,
+ const CFbsBitmap* aSourceMask)
+{
+ M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
+ CFbsBitGc* context = NULL;
+ CFbsBitmapDevice* device = NULL;
+ TInt err = KM2GOk;
+ TRAP(err, (device = CFbsBitmapDevice::NewL(&aTarget)));
+ if ((err == KM2GOk) && (device != NULL))
+ {
+ err = device->CreateContext(context);
+ if ((err == KM2GOk) && (context != NULL))
+ {
+ M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - CFbsBitGc::BitBlt()");
+ if (aRect)
+ {
+ // Check if mask
+ if (aSourceMask)
+ {
+ M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - mask rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
+ // A pixel that is masked by a BLACK is NOT transferred to a destination rectangle.
+ context->BitBltMasked(aPoint, &aSource, *aRect, aSourceMask, ETrue);
+ err = KM2GOk;
+ }
+ else
+ {
+ M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
+ context->BitBlt(aPoint, &aSource, *aRect);
+ err = KM2GOk;
+ }
+ }
+ else
+ {
+ M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - no rect");
+ context->BitBlt(aPoint, &aSource);
+ err = KM2GOk;
+ }
+ }
+ }
+ delete context;
+ delete device;
+ context = NULL;
+ device = NULL;
+ M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
+ return err;
+}
+
+
+TInt M2GBitmapUtils::BitQBlt(QImage& aTargetQimage,
+ const QImage& aSourceQimage,
+ const TPoint& aPoint,
+ const TRect* aRect,
+ const CFbsBitmap* aSourceMask)
+{
+ M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitQBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
+
+ QPixmap pixmapTarget = QPixmap::fromImage(aTargetQimage);
+ CFbsBitmap* aTarget = pixmapTarget.toSymbianCFbsBitmap();
+
+ QPixmap pixmapSource = QPixmap::fromImage(aSourceQimage);
+ CFbsBitmap* aSource = pixmapSource.toSymbianCFbsBitmap();
+
+ CFbsBitGc* context = NULL;
+ CFbsBitmapDevice* device = NULL;
+ TInt err = KM2GOk;
+ TRAP(err, (device = CFbsBitmapDevice::NewL(aTarget)));
+ if ((err == KM2GOk) && (device != NULL))
+ {
+ err = device->CreateContext(context);
+ if ((err == KM2GOk) && (context != NULL))
+ {
+ M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - CFbsBitGc::BitBlt()");
+ if (aRect)
+ {
+ // Check if mask
+ if (aSourceMask)
+ {
+ M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - mask rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
+ // A pixel that is masked by a BLACK is NOT transferred to a destination rectangle.
+ context->BitBltMasked(aPoint, aSource, *aRect, aSourceMask, ETrue);
+ err = KM2GOk;
+ }
+ else
+ {
+ M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
+ context->BitBlt(aPoint, aSource, *aRect);
+ err = KM2GOk;
+ }
+ }
+ else
+ {
+ M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - no rect");
+ context->BitBlt(aPoint, aSource);
+ err = KM2GOk;
+ }
+ }
+ }
+ delete context;
+ delete device;
+ context = NULL;
+ device = NULL;
+ M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
+ return err;
+}
+
+
+
+TInt M2GBitmapUtils::BitBlt(CBitmapContext& aTargetContext,
+ const CFbsBitmap& aSource,
+ const TPoint& aPoint,
+ const TRect* aRect,
+ const CFbsBitmap* aSourceMask,
+ /*MSwtClient* aClientHandle,*/
+ TBool aUseNativeClear /*= EFalse*/)
+{
+ M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
+ TInt err = KM2GOk;
+ TSWTBitBlt bitBlitter(aTargetContext, aPoint,
+ &aSource, aRect, aSourceMask, aUseNativeClear);
+ bitBlitter();
+ M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::TM2GRenderRect
+// -----------------------------------------------------------------------------
+TM2GRenderRect::TM2GRenderRect(
+ TInt aAnchorX, TInt aAnchorY,
+ TInt aClipX, TInt aClipY,
+ TInt aClipW, TInt aClipH)
+ : TRect(
+ TPoint(aClipX, aClipY),
+ TSize(aClipW, aClipH)),
+ iAnchorX(aAnchorX),
+ iAnchorY(aAnchorY)
+{
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::TM2GRenderRect
+// -----------------------------------------------------------------------------
+TM2GRenderRect::TM2GRenderRect(TInt* aDimensions, TInt /*aLength*/)
+ : TRect(
+ TPoint(aDimensions[EClipX], aDimensions[EClipY]),
+ TSize(aDimensions[EClipW], aDimensions[EClipH])),
+ iAnchorX(aDimensions[EAnchorX]),
+ iAnchorY(aDimensions[EAnchorY])
+{
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::~TM2GRenderRect
+// -----------------------------------------------------------------------------
+TM2GRenderRect::~TM2GRenderRect()
+{
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::TM2GRenderRect
+// -----------------------------------------------------------------------------
+TM2GRenderRect::TM2GRenderRect(const TM2GRenderRect& aRd)
+{
+ (*this = aRd);
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::operator=
+// -----------------------------------------------------------------------------
+TM2GRenderRect& TM2GRenderRect::operator=(const TM2GRenderRect& aRd)
+{
+ if (this != &aRd)
+ {
+ iAnchorX = aRd.iAnchorX;
+ iAnchorY = aRd.iAnchorY;
+ SetRect(aRd.iTl.iX, aRd.iTl.iY, aRd.iBr.iX, aRd.iBr.iY);
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+// TM2GRenderRect::GetRegionSizeInPixels
+// -----------------------------------------------------------------------------
+TSize TM2GRenderRect::GetRegionSizeInPixels(
+ TM2GRenderRect& aRect,
+ const TSize& aSz)
+{
+ return TSize(
+ // determine the width of the region to be paint
+ M2GGeneral::Min< TInt >(aRect.GetAnchorX() + aSz.iWidth, aRect.GetClipX() + aRect.GetClipW()) -
+ M2GGeneral::Max< TInt >(aRect.GetAnchorX(), aRect.GetClipX()),
+ // determine the height of the region to be paint
+ M2GGeneral::Min< TInt >(aRect.GetAnchorY() + aSz.iHeight, aRect.GetClipY() + aRect.GetClipH()) -
+ M2GGeneral::Max< TInt >(aRect.GetAnchorY(), aRect.GetClipY()));
+}
+
+
+// -----------------------------------------------------------------------------
+// TM2GBitmapLock::TM2GBitmapLock
+// -----------------------------------------------------------------------------
+TM2GBitmapLock::TM2GBitmapLock(const CFbsBitmap* aBitmap, TBool aLock)
+ : iBitmap(aBitmap), iIsLocked(EFalse)
+{
+ if (aLock)
+ {
+ Lock();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// TM2GBitmapLock::~TM2GBitmapLock
+// -----------------------------------------------------------------------------
+TM2GBitmapLock::~TM2GBitmapLock()
+{
+ Unlock();
+}
+
+// -----------------------------------------------------------------------------
+// TM2GBitmapLock::Lock()
+// -----------------------------------------------------------------------------
+void TM2GBitmapLock::Lock()
+{
+ if (iBitmap && !iIsLocked)
+ {
+ iBitmap->LockHeap();
+ iIsLocked = ETrue;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// TM2GBitmapLock::Unlock()
+// -----------------------------------------------------------------------------
+void TM2GBitmapLock::Unlock()
+{
+ if (iBitmap && iIsLocked)
+ {
+ iBitmap->UnlockHeap();
+ iIsLocked = EFalse;
+ }
+}
+
+TSWTBitBlt::TSWTBitBlt(CBitmapContext& aTargetContext,
+ const TPoint& aPoint,
+ const CFbsBitmap* aBitmap,
+ const TRect* aSourceRect,
+ const CFbsBitmap* aMaskBitmap,
+ TBool aUseNativeClear)
+ : iTargetContext(aTargetContext),
+ iPoint(aPoint),
+ iUseNativeClear(aUseNativeClear)
+{
+ iBitmap = aBitmap;
+ iRect = aSourceRect;
+ iMaskBitmap = aMaskBitmap;
+}
+void TSWTBitBlt::operator()() const
+{
+ M2G_DEBUG_0("TSWTBitBlt()+");
+ CFbsBitmap* tempBitmap = new(ELeave) CFbsBitmap;
+ CleanupStack::PushL(tempBitmap);
+ User::LeaveIfError(tempBitmap->Duplicate(iBitmap->Handle()));
+ if (iRect)
+ {
+ if (iUseNativeClear)
+ {
+ iTargetContext.SetBrushColor(KRgbWhite);
+ iTargetContext.Clear(*iRect);
+ }
+ if (iMaskBitmap)
+ {
+ CFbsBitmap* tempMask = new(ELeave) CFbsBitmap;
+ CleanupStack::PushL(tempMask);
+ User::LeaveIfError(tempMask->Duplicate(iMaskBitmap->Handle()));
+ iTargetContext.BitBltMasked(
+ iPoint, tempBitmap, *iRect, tempMask, ETrue);
+ CleanupStack::PopAndDestroy(tempMask);
+ }
+ else
+ {
+ iTargetContext.BitBlt(iPoint, tempBitmap, *iRect);
+ }
+ }
+ else
+ {
+ if (iUseNativeClear)
+ {
+ iTargetContext.SetBrushColor(KRgbWhite);
+ iTargetContext.Clear();
+ }
+ iTargetContext.BitBlt(iPoint, tempBitmap);
+ }
+ CleanupStack::PopAndDestroy(tempBitmap);
+ M2G_DEBUG_0("TSWTBitBlt()-");
+}
+//TODO Check for M2G_DO_LOCK M2G_DO_UNLOCK
+//TODO Put Check for aSvgProxyHandle in all the functions.
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GDocument.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,442 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GDocument.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_createDocument
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::CreateDocumentL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aData Document data
+ * @param aHandle Document handle to be returned
+ * @throws Exception if not ok
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1createDocument(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jstring aData)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _createDocument - begin");
+
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+ RJString data(*aJni, aData);
+ TPtrC16* bData = STATIC_CAST(TPtrC16*, &data);
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->CreateDocumentL(*bData, handle););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, M2G_INVALID_HANDLE);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _createDocument: %d - end", handle);
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_createElementNS
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::CreateElementNsL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aType Element type id.
+ * @param aDocumentHandle Document handle.
+ * @param aHandle Element handle to be returned
+ * @throws Exception if not ok
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1createElementNS(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jshort aType,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _createElementNS - begin");
+
+ // Execute native engine method
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->CreateElementNsL(
+ aType,
+ aDocumentHandle,
+ handle); );
+
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _createElementNS: %d - end", handle);
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_deleteDocument
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::DeleteDocumentL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @throws Exception if not ok
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1deleteDocument(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle )
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _deleteDocument - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ // Extract the SVGProxy handle
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->DeleteDocumentL(aDocumentHandle););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _deleteDocument - end");
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_getElementById
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetElementByIdL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aId Element ID.
+ * @param aHandle Element handle to be returned.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1getElementById(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jstring aId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getElementById - begin");
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+ RJString id(*aJni, aId);
+ TPtrC16* lId = STATIC_CAST(TPtrC16*, &id);
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->GetElementByIdL(aDocumentHandle, *lId, handle););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getElementById: %d - end", handle);
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_getViewportHeight
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetViewportHeightL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aHeight Height to be returned.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1getViewportHeight(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getViewportHeight - begin");
+ TInt err = KM2GNotOk;
+ TInt height = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->GetViewportHeightL(aDocumentHandle, height););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getViewportHeight: %d - end", height);
+ return height;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_getViewportWidth
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetViewportWidthL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aWidth Width to be returned.
+ * Class: com_nokia_microedition_m2g_M2GDocument
+ * Method: _getViewportWidth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1getViewportWidth(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getViewportWidth - begin");
+ TInt err = KM2GNotOk;
+ TInt width = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->GetViewportWidthL(aDocumentHandle, width););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getViewportWidth: %d - end", width);
+ return width;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_isElementInDom
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::IsElementInDomL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aElementHandle Element pointer.
+ * @param aIsElementInDom Result
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1isElementInDOM(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI _isElementInDOM - begin");
+ TInt isElementInDom = -1;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->IsElementInDomL(
+ aDocumentHandle, aElementHandle, isElementInDom););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI _isElementInDOM: %d - end", isElementInDom);
+ return isElementInDom;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_requestCompleted
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::RequestCompletedL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aURI Resource uri
+ * @param aResourceData Resource data
+ * @param aCompleted Result
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1requestCompleted(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jstring aURI,
+ jbyteArray aResourceData)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _requestCompleted - begin");
+
+ RJString uri(*aJni, aURI);
+ TInt err = KM2GNotOk;
+ TPtrC8 lResData8;
+ jbyte* resBytes = NULL;
+
+ if (aResourceData)
+ {
+ resBytes = aJni->GetByteArrayElements(aResourceData, NULL);
+ lResData8.Set(REINTERPRET_CAST(TUint8*, resBytes), aJni->GetArrayLength(aResourceData));
+ }
+
+ TInt completed = -1;
+ TPtrC16* pUri = STATIC_CAST(TPtrC16*, &uri);
+
+ M2G_DO_LOCK
+
+ if (aSvgProxyHandle)
+ {
+
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->RequestCompletedL(
+ aDocumentHandle,
+ *pUri,
+ lResData8,
+ completed););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ if (aResourceData)
+ {
+ aJni->ReleaseByteArrayElements(aResourceData, resBytes, JNI_ABORT); // don't copy back
+ }
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _requestCompleted: %d - end", completed);
+
+ return completed;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_setViewportHeight
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetViewportHeightL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aHeight Height
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1setViewportHeight(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aHeight)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportHeight - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->SetViewportHeightL(
+ (TM2GSvgDocumentHandle)aDocumentHandle, aHeight););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportHeight - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GDocument::_setViewportWidth
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetViewportWidthL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aWidth Width
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GDocument__1setViewportWidth(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aWidth)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportWidth - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->SetViewportWidthL(
+ (TM2GSvgDocumentHandle)aDocumentHandle, aWidth););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportWidth - end");
+}
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GManager.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GManager.h"
+#include "CM2GSVGProxy.h"
+#include "CM2GEventSource.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_createSvgEngine
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::CreateSvgEngineL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aHandle Svg engine handle
+*/
+/**
+ * JNI method
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GManager__1createSvgEngine(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine - begin");
+
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->CreateSvgEngineL(handle););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ handle = M2GGeneral::CheckErrorCodeAndHandle(
+ aJni, err, handle, M2G_INVALID_HANDLE);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine: %d - end", handle);
+ return handle;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_createSvgProxy
+// -----------------------------------------------------------------------------
+/**
+ * Creates an svg proxy.
+ * @since Series S60 3.0
+ * @param Svg proxy handle
+/**
+ * JNI method
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GManager__1createSvgProxy(
+ JNIEnv* aJni,jclass)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy - begin");
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ TRAP(err, MM2GSVGProxy* proxy = CM2GSVGProxy::NewL(); handle = JavaMakeHandle(proxy););
+ M2G_DO_UNLOCK(aJni)
+
+ handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy: %d - end", handle);
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgEngine
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::DeleteSvgEnginedL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+
+/**
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgEngine(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aSvgEngineHandle )
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine - begin");
+
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->DeleteSvgEngineL(
+ STATIC_CAST(TM2GSvgEngineHandle, aSvgEngineHandle)););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine: - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgProxy
+// -----------------------------------------------------------------------------
+/**
+ * Deletes a proxy object. NOTE: The proxy object has to be deleted inside same
+ * thread as it was created, otherwice there will be problem to delete a CFbsBitmap
+ * server object inside the SVGTopt componenet see KATA-6KYA9T (SVGEngineJI: SVGTopt
+ * crashes when deleting svg document object that contains external resource)
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+
+/**
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgProxy(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* proxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,delete proxy;);
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy: - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_finalizeEventSource
+// -----------------------------------------------------------------------------
+/**
+ * JNI method TODO check this function for modifications
+ */
+//JNIEXPORT void JNICALL
+//Java_com_nokia_microedition_m2g_M2GManager__1finalizeEventSource(
+// JNIEnv *aJni, jclass, jint aEventSourceHandle, jboolean aUiToolkit)
+//{
+// M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _finalizeEventSource: %d", aEventSourceHandle);
+// if (aUiToolkit)
+// {
+//// MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
+//// if (client)
+//// {
+//// delete client;
+//// client = NULL;
+//// }
+// }
+// else
+// {
+// CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
+// if (eventSource)
+// {
+// eventSource->Dispose(*aJni);
+// }
+// eventSource = NULL;
+// }
+//}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GManager::_initEventSource
+// -----------------------------------------------------------------------------
+/**
+ * JNI method TODO check this function for modifications
+
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GManager__1initEventSource(
+ JNIEnv *aJni,
+ jclass aPeer,
+ jint aServer)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
+
+ M2G_DO_LOCK
+ TRAPD(eventSourceHandle, eventSourceHandle = CM2GEventSource::NewL(
+ *aJni, aPeer, aServer));
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckHandle(aJni, eventSourceHandle);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
+ return eventSourceHandle;
+}*/
+////TODO check this function for modifications
+//JNIEXPORT jint JNICALL
+//Java_com_nokia_microedition_m2g_M2GManager__1initSwtEventSource(
+// JNIEnv *aJni,
+// jclass /*aPeer*/)
+//{
+// M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
+//
+// MSwtClient* client = NULL;
+// TRAP_IGNORE(client = SWT::CreateClientL());
+// if (!client)
+// {
+// return KErrNotFound;
+// }
+// M2GGeneral::CheckHandle(aJni, (int)client);
+// M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
+// return (int)client;
+//}
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGAnimationElement.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGAnimationElement.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_beginElementAt
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::BeginElementAtL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aElementHandle Element handle
+ * @param aOffset Offset time
+ * @throws Exception if not ok.
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1beginElementAt(
+ JNIEnv* aJni,
+ jobject,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aElementHandle,
+ jfloat aOffset,
+ jfloat aCurrentTime)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin");
+ TInt err = KM2GNotOk;
+
+ if (aSvgProxyHandle && aDocumentHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TInt16 restartAttribute;
+
+ TRAP(err, aProxy->GetEnumTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute),
+ restartAttribute);
+ )
+
+ TInt isActive;
+ TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive); )
+
+ if (isActive && (restartAttribute == KM2GRestartWhenNotActive))
+ {
+ M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute);
+ }
+ else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever))
+ {
+ // Cannot restart even if animation hasn't ended?
+ M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute);
+ }
+ else
+ {
+ M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime);
+ TRAP(err, aProxy->BeginElementAtL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ (aOffset+aCurrentTime) );
+ )
+ }
+ }
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end");
+
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::EndElementAt method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aElementHandle Element handle
+ * @param aOffset Offset time
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1endElementAt(
+ JNIEnv* aJni,
+ jobject,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aElementHandle,
+ jfloat aOffset)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin");
+ TInt err = KM2GNotOk;
+
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+
+ TRAP(err, aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ aOffset);
+ )
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end");
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_isActive
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::EndElementAt method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ */
+JNIEXPORT jboolean JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1isActive(
+ JNIEnv* aJni,
+ jobject,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin");
+ TInt err = KM2GNotOk;
+ TInt active = 0;
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+
+ TRAP(err, aProxy->IsActiveL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ active);
+ )
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active);
+ return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse));
+}
+
+M2G_NS_END
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGElement.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,1141 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGElement.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_appendChild
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AppendChildL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aChildElementHandle Child handle
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1appendChild(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jint aChildElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->AppendChildL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle)); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - end");
+ M2GGeneral::CheckErrorCode(aJni, err);
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_checkRemoveable
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::CheckRemoveableL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aRemoveable Result
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_m2g_M2GSVGElement__1checkRemoveable(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ TInt removeable = -1;
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable - begin");
+ TInt err = KM2GNotOk;
+
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->CheckRemoveableL(aElementHandle, removeable););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable: %d - end", removeable);
+ return removeable;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getBBox
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetBBoxL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aRectData Returns rect components
+ * @param aResult Result "0" ok
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getBBox(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloatArray aRectComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox - begin");
+
+ TM2GRectData rect;
+ TInt result = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetBBoxL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ rect, result); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ aJni->SetFloatArrayRegion(
+ REINTERPRET_CAST(jfloatArray, aRectComponents),
+ 0,
+ rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox: %d - end", result);
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getColorTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetColorTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aColors Color elements ( RGB )
+ * @param aTrait Result
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getColorTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jintArray aColorComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait - begin");
+ TM2GColorData color;
+ TInt result = -1;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetColorTraitL(
+ aElementHandle,
+ aAttributeTypeId,
+ color,
+ result); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ if (color[ 0 ] == -1 && color[ 1 ] == -1 && color[ 2 ] == -1)
+ {
+ result = 0;
+ aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), &(color[ 0 ]));
+ }
+ else if (result != -1)
+ {
+ result = 1;
+ aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), color.Begin());
+ }
+
+ M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait: %d, R=%d, G=%d, B=%d - end", result, color[ 0 ], color[ 1 ], color[ 2 ]);
+ return result;
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getElementTypeId
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetElementTypeIdL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aId
+ */
+JNIEXPORT jshort JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getElementTypeId(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId - begin");
+ TInt16 id = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetElementTypeIdL(aElementHandle, id); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId: %d - end", id);
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getEnumTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetEnumTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aEnumTrait The enumeration value of the specified attribute
+ */
+JNIEXPORT jshort JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getEnumTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait - begin");
+ TInt16 enumTrait = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetEnumTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ enumTrait); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait: %d - end", enumTrait);
+ return enumTrait;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getFirstElementChild
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetFirstElementChildL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aHandle Element handle to be returned.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getFirstElementChild(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild - begin");
+
+ TInt childHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetFirstElementChildL(aElementHandle, childHandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild: %d - end", childHandle);
+ return childHandle;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getFloatTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetFloatTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aFloatTrait Float attribute to be returned
+ */
+JNIEXPORT jfloat JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getFloatTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait - begin");
+ TInt err = KM2GNotOk;
+ TReal32 floatTrait = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err ,aProxy->GetFloatTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ floatTrait););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait: %f - end", floatTrait);
+ return STATIC_CAST(jfloat, floatTrait);
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getMatrixTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetMatrixTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aResult Result: "0" if ok and "-1" if nok
+ s*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getMatrixTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloatArray aMatrixComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait - begin");
+ TM2GMatrixData matrix;
+ TInt result = -1;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetMatrixTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ matrix, result); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ if (M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk)
+ {
+ // Init matrix object
+ jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents, 0);
+ TInt count =
+ M2GGeneral::Min(aJni->GetArrayLength(aMatrixComponents), matrix.Count());
+ for (TInt index = 0; index < count; index++)
+ {
+ components[ index ] = matrix[ index ];
+ }
+ // Release data source
+ aJni->ReleaseFloatArrayElements(aMatrixComponents, components, 0);
+ }
+
+ M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getNextElementSibling
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetNextElementSiblingL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aSiblingHandle Sibling handle
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getNextElementSibling(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling - begin");
+ TInt siblingHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetNextElementSiblingL(aElementHandle, siblingHandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling: %d - end", siblingHandle);
+ return siblingHandle;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getParent
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetParentL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aParentHandle Parent handle to be returned.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getParent(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent - begin");
+ TInt parentHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetParentL(aElementHandle, parentHandle););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent: %d - end", parentHandle);
+ return parentHandle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getPathTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetPathTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aAttributeTypeId Attribute type.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getPathTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait - begin");
+ TInt aPathTrait = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetPathTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ aPathTrait); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait: %d - end", aPathTrait);
+ return aPathTrait;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getRectTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetRectTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aRectData Returns rect components
+ * @param aResult Result "0" if ok and "-1" if nok
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getRectTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloatArray aRectComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - begin");
+ TM2GRectData rect;
+ TInt result = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err , aProxy->GetRectTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ rect, result); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ aJni->SetFloatArrayRegion(
+ REINTERPRET_CAST(jfloatArray, aRectComponents),
+ 0,
+ rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait: %d - end", result);
+ return result;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getRootElement
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetRootElementL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aRootElementHandle Root element handle
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getRootElement(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement - begin");
+ TInt rootElementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetRootElementL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ rootElementHandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement: %d - end", rootElementHandle);
+ return rootElementHandle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getScreenBBox
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetScreenBBoxL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aRectData Returns rect components
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getScreenBBox(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jfloatArray aScreenBBoxComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox - begin");
+ TM2GScreenBBoxData screenBBox;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetScreenBBoxL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ screenBBox); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ aJni->SetFloatArrayRegion(
+ REINTERPRET_CAST(jfloatArray, aScreenBBoxComponents),
+ 0,
+ screenBBox.Count(), REINTERPRET_CAST(jfloat*, screenBBox.Begin()));
+
+ M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox: %f, %f, %f, %f - end", screenBBox[ 0 ], screenBBox[ 1 ], screenBBox[ 2 ], screenBBox[ 3 ]);
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getStringTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetStringTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aAttributeTypeId Attribute type.
+ * @param aAttribute Returns a string attribute
+ */
+JNIEXPORT jstring JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getStringTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait - begin");
+
+ TPtrC16 attribute;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetStringTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ attribute); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) &&
+ (attribute.Length() > 0))
+ {
+ return CreateJavaString(*aJni, attribute);
+ }
+
+ return NULL;
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait: %d - end", err);
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_getUsedFromElement
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetUsedFromElementL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aHandle Return element handle
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1getUsedFromElement(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement - begin");
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->GetUsedFromElementL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ handle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement: %d - end", handle);
+ return handle;
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_insertBefore
+// -----------------------------------------------------------------------------
+/**
+ * Class: com_nokia_microedition_m2g_M2GSVGElement
+ * Method: insertBefore
+ * Signature:
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1insertBefore(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jint aNewChildElementHandle,
+ jint aReferenceElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->InsertBeforeL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle)); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_isUsed
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::IsUsedL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aResult Return "1" if used otherwise returns "0"
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1isUsed(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle )
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed - begin");
+ TInt result = KM2GNotOk;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->IsUsedL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), result); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed: %d - end", result);
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_removeChild
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::RemoveChild method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aChildElementHandle child element pointer
+ * @param aHandle Handle to removed element.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1removeChild(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jint aChildElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild - begin");
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err ,aProxy->RemoveChildL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle), handle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild: %d - end", handle);
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setColorTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetColorTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aAttributeTypeId -
+ * @param aColorData -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setColorTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jint aRed, jint aGreen, jint aBlue)
+{
+ M2G_DEBUG_3("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: R=%d, G=%d, B=%d - begin", aRed, aGreen, aBlue);
+ TM2GColorData color;
+ color[ 0 ] = aRed;
+ color[ 1 ] = aGreen;
+ color[ 2 ] = aBlue;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->SetColorTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ color); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: %d - end", err);
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setEnumTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetEnumTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aAttributeTypeId -
+ * @param aValue
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setEnumTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jshort aValue)
+{
+ M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait: type=%d, value=%d - begin", aAttributeTypeId, aValue);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->SetEnumTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ aValue); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setFloatTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetFloatTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element pointer.
+ * @param aAttributeTypeId -
+ * @param aValue -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setFloatTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloat aValue)
+{
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: %f - begin", aValue);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->SetFloatTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ aValue); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setMatrixTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetMatrixTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aMatrixData -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setMatrixTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloatArray aMatrixComponents)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setMatrixTrait - begin");
+ TInt err = KM2GNotOk;
+ TM2GMatrixData matrix;
+ // Init matrix object
+ jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents,0);
+ TInt count = aJni->GetArrayLength(aMatrixComponents);
+ for (TInt index = 0; index < count; index++)
+ {
+ matrix[ index ] = components[ index ];
+ }
+ // Release data source
+ aJni->ReleaseFloatArrayElements(aMatrixComponents, components, JNI_ABORT);
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->SetMatrixTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ matrix); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_6("JNI ( M2GSVGElement ) _setMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setPathTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetPathTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aMatrixData -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setPathTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jint aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err,aProxy->SetPathTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setRectTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetRectTraitL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aMatrixData -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setRectTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jfloat aX, jfloat aY, jfloat aWidth, jfloat aHeight)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setRectTrait - begin");
+ TM2GRectData rect;
+ rect[ 0 ] = aX;
+ rect[ 1 ] = aY;
+ rect[ 2 ] = aWidth;
+ rect[ 3 ] = aHeight;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+
+ TRAP(err, aProxy->SetRectTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ rect); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGElement::_setStringTrait
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetStringTraitL method.
+ * @since Series S60 3.0
+ * @param aElementHandle Element handle
+ * @param aAttributeTypeId Attribute type id
+ * @param aString -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGElement__1setStringTrait(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aElementHandle,
+ jshort aAttributeTypeId,
+ jstring aValue)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - begin");
+ RJString str(*aJni, aValue);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TPtrC16 lValue=STATIC_CAST(TPtrC16, str);
+
+ TRAP(err, aProxy->SetStringTraitL(
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
+ STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
+ lValue); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - end");
+}
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGImage.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGImage.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_dispatchMouseEvent
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::DispatchMouseEventL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle.
+ * @param aX X coordinate.
+ * @param aY Y coordinate
+ * @param aElementHandle Target element handle
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1dispatchMouseEvent(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle, jint aX, jint aY)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent - begin");
+
+ TInt elementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->DispatchMouseEventL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ aX, aY, elementHandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent: %d - end", elementHandle);
+ return elementHandle;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOn
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::FocusOnL method.
+ * @since Series S60 3.1
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle.
+ * @param aElementHandle Target element handle
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOn(
+ JNIEnv* /* aJni */,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle, jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn - begin");
+
+ // TInt elementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->FocusOnL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); );
+ }
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err);
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOut
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::FocusOutL method.
+ * @since Series S60 3.1
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle.
+ * @param aElementHandle Target element handle
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOut(
+ JNIEnv* /* aJni */,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle, jint aElementHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin");
+ TInt err = KM2GNotOk;
+
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err,aProxy->FocusOutL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); );
+ }
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err);
+
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
+// EXTENSION
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetExternalListItemL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aIndex External item index.
+ * @param aItem External item
+ * @throws Exception if not ok
+ * JNI method
+ */
+JNIEXPORT jstring JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListItem(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jint aIndex)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin");
+ TPtrC16 lItem;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetExternalListItemL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ aIndex,
+ lItem); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0))
+ {
+ return CreateJavaString(*aJni, lItem);
+ }
+
+ return NULL;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListSize
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetExternalListItemL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle.
+ * @param aListSz List size to be returned.
+ */
+JNIEXPORT TInt JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListSize(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin");
+
+ // TInt elementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+ TInt listSz = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetExternalListSizeL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz);
+ return listSz;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetExternalListItemL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document pointer.
+ * @param aIndex Index.
+ * @param aStrBuf Returns a string
+ * @throws Exception if not ok
+ * JNI method
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGImage__1initViewport(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin");
+ // TInt elementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->InitViewportL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle)); );
+ }
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err);
+
+}
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGPath.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,405 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGPath.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_addClose
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AddCloseL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1addClose(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->AddCloseL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_addCurve
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AddCurveTo method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aPathCurveData Curve parameters
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1addCurveTo(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle,
+ jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2, jfloat aX3, jfloat aY3 )
+{
+ M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo: X1=%f, Y1=%f, X2=%f, Y2=%f, X3=%f, Y3=%f - begin", aX1, aY1, aX2, aY2, aX3, aY3);
+ TInt err = KM2GNotOk;
+
+ TM2GPathCurveData curve;
+ curve[ 0 ] = STATIC_CAST(TReal32, aX1);
+ curve[ 1 ] = STATIC_CAST(TReal32, aY1);
+ curve[ 2 ] = STATIC_CAST(TReal32, aX2);
+ curve[ 3 ] = STATIC_CAST(TReal32, aY2);
+ curve[ 4 ] = STATIC_CAST(TReal32, aX3);
+ curve[ 5 ] = STATIC_CAST(TReal32, aY3);
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->AddCurveToL(
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle),
+ curve); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_addLineTo
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AddLineToL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aX -
+ * @param aY -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1addLineTo(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle,
+ jfloat aX, jfloat aY )
+{
+ M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo: X=%f, Y=%f - begin", aX, aY);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->AddLineToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), *(REINTERPRET_CAST(TReal32*, &aX)), *(REINTERPRET_CAST(TReal32*, &aY))); );
+
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo - end");
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_addMoveTo
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AddMoveToL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aX -
+ * @param aY -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1addMoveTo(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle,
+ jfloat aX,
+ jfloat aY)
+{
+ M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo: X=%f, Y=%f - begin", aX, aY);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->AddMoveToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aX, aY) );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_addQuadTo
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::AddQuadToL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aX1 -
+ * @param aY1 -
+ * @param aX2 -
+ * @param aY2 -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1addQuadTo(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle,
+ jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2)
+{
+ M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo: X1=%f, Y1=%f, X2=%f, Y2=%f - begin", aX1, aY1, aX2, aY2);
+ // TInt elementHandle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->AddQuadToL(
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle),aX1, aY1, aX2, aY2); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_createPath
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::CreatePathL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Path handle
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1createPath(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath - begin");
+
+ TInt err = KM2GNotOk;
+ TInt pathHandle = M2G_INVALID_HANDLE;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->CreatePathL(pathHandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath: %d - end", pathHandle);
+ return STATIC_CAST(jint, pathHandle);
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_destroyPath
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::DestroyPathL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1destroyPath(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle)
+{
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath: %d - begin", aPathHandle);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->DestroyPathL(
+ STATIC_CAST(TM2GSvgPathHandle, STATIC_CAST(TM2GSvgPathHandle, aPathHandle))); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_getNumberOfSegments
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetNumberOfSegments method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @return Number of segments
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1getNumberOfSegments(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments - begin");
+ TInt err = KM2GNotOk;
+ TInt numberOfSegments = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->GetNumberOfSegmentsL(
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle),
+ numberOfSegments); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments: %d - end", numberOfSegments);
+ return STATIC_CAST(jint, numberOfSegments);
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentParameter
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetSegmentParameterL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aSegmentIndex -
+ * @param aParamIndex -
+ * @param aSegmentParam Segment parameter
+ */
+JNIEXPORT jfloat JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentParameter(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aPathHandle, jint aSegmentIndex, jint aParamIndex)
+{
+ M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: seg index=%d, param index=%d - begin", aSegmentIndex, aParamIndex);
+ TInt err = KM2GNotOk;
+ TReal32 segmentParam = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->GetSegmentParameterL(
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aSegmentIndex,aParamIndex, segmentParam); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: %f - end", segmentParam);
+ return STATIC_CAST(jfloat, segmentParam);
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentType
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetSegmentTypeL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aPathHandle Svg path handle
+ * @param aSegmentIndex -
+ * @param aSegmentType Segment type to be returned
+ */
+JNIEXPORT jshort JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentType(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ TInt aPathHandle,
+ jint aIndex)
+{
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: index=%d - begin", aIndex);
+ TInt err = KM2GNotOk;
+ TInt16 aSegmentType = 0;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
+ TRAP(err, aProxy->GetSegmentTypeL(
+ STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aIndex,aSegmentType); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: %d - end", aSegmentType);
+ return STATIC_CAST(jshort, aSegmentType);
+}
+
+M2G_NS_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGSVGElement.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGSVGElement.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_getMediaTime
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetMediaTimeL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aSeconds Media time to be returned.
+ */
+JNIEXPORT jfloat JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1getMediaTime(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle)
+{
+ M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _getMediaTime - begin");
+ TReal32 seconds = 0;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->GetMediaTimeL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),seconds); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _getMediaTime: %f - end", seconds);
+ return STATIC_CAST(jfloat, seconds);
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_setMediaTime
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetMediaTimeL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aSeconds Media time
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1setMediaTime(
+ JNIEnv* aJni,
+ jclass,
+ jint aSvgProxyHandle,
+ jint aDocumentHandle,
+ jfloat aSeconds
+)
+{
+ M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _setMediaTime - begin");
+ TInt err = KM2GNotOk;
+
+ TReal32* lseconds = REINTERPRET_CAST(TReal32*, &aSeconds);
+
+ M2G_DO_LOCK
+ if (aSvgProxyHandle)
+ {
+ MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+ TRAP(err, aProxy->SetMediaTimeL(
+ STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+ *lseconds); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _setMediaTime: %f - end", aSeconds);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GScalableGraphics.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GScalableGraphics.h"
+#include "CM2GRenderContext.h"
+#include "MM2GSVGProxy.h" // TM2GRenderRect
+#include <graphics.h>
+
+M2G_NS_START
+
+#include "M2GUtils.h"
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_bind
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::BindL method.
+ * @since Series S60 3.0
+ * @param aRenderContextHandle Render context handle.
+ * @param aTargetHandle Target graphics handle
+ * @throws exception if not ok
+
+LOCAL_C void DoBindL(TInt aRenderContextHandle, TInt aTargetHandle, TBool aUiToolkit)
+{
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ rc->BindL(aTargetHandle, aUiToolkit);
+}
+*/
+/**
+ * JNI method
+
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind(
+ JNIEnv* aJni,
+ jobject,
+ jint aEventSourceHandle,
+ jint aRenderContextHandle,
+ jint aTargetHandle,
+ jboolean aUiToolkit)
+ */
+
+
+
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle,
+ jint aTargetHandle )
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind - begin");
+
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aRenderContextHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->BindL(aTargetHandle););
+ }
+
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind: %d - end", err);
+
+ return err;
+}
+
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_createRenderContext
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::NewL method.
+ * @since Series S60 3.0
+ * @param aSvgProxyHandle Proxy instance.
+ * @param aHandle Render context handle.
+ * @throws exception if not ok
+ */
+
+
+
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1createRenderContext(
+ JNIEnv* aJni,
+ jobject,
+ jint aSvgProxyHandle )
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext - begin");
+ TInt handle = M2G_INVALID_HANDLE;
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aSvgProxyHandle)
+ {
+ TRAP(err, MM2GRenderContext* rchandle = CM2GRenderContext::NewL(JavaUnhand<MM2GSVGProxy> (aSvgProxyHandle)); handle = JavaMakeHandle(rchandle); );
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err);
+
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext: %d - end", handle);
+
+
+
+ return handle;
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_deleteRenderContext
+// -----------------------------------------------------------------------------
+/**
+ * Class: com_nokia_microedition_m2g_M2GScalableGraphics
+ * Method: deleteRenderContext
+ * Signature:
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1deleteRenderContext(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - begin");
+
+ M2G_DO_LOCK
+
+ if (aRenderContextHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ delete rc;
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_release
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::ReleaseL method.
+ * @since Series S60 3.0
+ * @param aRenderContextHandle Context handle
+ * @return KM2GOk if ok
+ */
+
+
+/**
+ * JNI method
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1release(
+ JNIEnv* aJni,
+ jobject,
+ jint aSurfaceHandle,
+ jint aRenderContextHandle)
+{
+
+ // Release used target surface
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _release - begin");
+ TInt err = KM2GNotOk;
+ M2G_DO_LOCK
+
+ if (aRenderContextHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->ReleaseL(););
+
+ }
+ M2G_DO_UNLOCK(aJni)//TODO Check for M2G_DO_LOCK M2G_DO_UNLOCK
+
+ Java::GFX::WindowSurface* surf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle);
+ surf->release(); //TODO check This windows surface call detected from Graphics3d.inl
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ return err;
+
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_render
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::RenderL method.
+ * @since Series S60 3.0
+ * @param aRenderContextHandle Context handle
+ * @param aDocumentHandle Document handle.
+ * @param aSvgW Svg width.
+ * @param aSvgH Svg heigth.
+ * @param aCurrentTime Current time.
+ * @throws Exception if not ok
+ */
+
+
+/**
+ * JNI method
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderLCDUI(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle,
+ jint aDocumentHandle,
+ jint aX, jint aY,
+ jint aClipX, jint aClipY, jint aClipW, jint aClipH,
+ jint aSvgW, jint aSvgH,
+ jfloat aCurrentTime)
+{
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime);
+
+ TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH);
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aRenderContextHandle && aDocumentHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->RenderLCDUIL(aDocumentHandle, aCurrentTime, aSvgW, aSvgH, rr););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err);
+ return err;
+}
+
+
+JNIEXPORT jintArray JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderESWT(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle,
+ jint aDocumentHandle,
+ jint aX, jint aY,
+ jint aClipX, jint aClipY, jint aClipW, jint aClipH,
+ jint aSvgW, jint aSvgH,
+ jfloat aCurrentTime,
+ jint aUseNativeClear
+)
+{
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime);
+ TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH);
+ TInt err = KM2GNotOk;
+ jintArray returnDataJava = aJni->NewIntArray(10);
+
+ M2G_DO_LOCK
+
+ TInt returnData[10];
+
+ if (aRenderContextHandle && aDocumentHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->RenderESWTL(aDocumentHandle,aCurrentTime,aSvgW,aSvgH,rr,aUseNativeClear,returnData););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+
+ if (returnDataJava != NULL)
+ aJni->SetIntArrayRegion(returnDataJava, 0, 10, const_cast<TInt*>(returnData));
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+ M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err);
+ return returnDataJava;
+}
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setRenderingQuality
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::SetRenderingQuality method.
+ * @since Series S60 3.0
+ * @param aRenderContextHandle Context handle
+ * @param aMode
+ * @throws Exception if not ok
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1setRenderingQuality(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle, jint aMode)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if ( aRenderContextHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->SetRenderingQualityL(aMode););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - end");
+}
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setTransparency
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GRenderContext::SetTransparency method.
+ * @since Series S60 3.0
+ * @param aRenderContextHandle Context handle
+ * @param aAplha -
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GScalableGraphics__1setTransparency(
+ JNIEnv* aJni,
+ jobject,
+ jint aRenderContextHandle,
+ jfloat aAlpha)
+{
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - begin");
+ TInt err = KM2GNotOk;
+
+ M2G_DO_LOCK
+
+ if (aRenderContextHandle)
+ {
+ MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
+ TRAP(err,rc->SetTransparency( (TReal32)aAlpha ););
+ }
+ M2G_DO_UNLOCK(aJni)
+
+ M2GGeneral::CheckErrorCode(aJni, err);
+
+ M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - end");
+}
+
+M2G_NS_END
+
+
+
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationframepositioningcontrol.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements FramePositioningControl for animation
-*
-*/
-
-
-#ifndef CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
-#define CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
-
-// INTERNAL INCLUDES
-#include "cmmaanimationplayer.h"
-#include "cmmaframepositioningcontrol.h" // base class
-
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class MIHLImageViewer;
-
-// CLASS DECLARATION
-/**
-* This class implements FramePositioningControl for video player
-*/
-NONSHARABLE_CLASS(CMMAAnimationFramePositioningControl) :
- public CMMAFramePositioningControl
-{
-public:
- static CMMAAnimationFramePositioningControl* NewL(CMMAAnimationPlayer* aPlayer);
-
- /**
- * Destructor.
- */
- ~CMMAAnimationFramePositioningControl();
-
-protected:
- /**
- * Constructor.
- */
- CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer);
-
- void ConstructL(CMMAAnimationPlayer* aPlayer);
-
-public: // From CMMAFramePositioningControl
- TInt SeekL(TInt aFrameNumber);
- TInt SkipL(TInt aFramesToSkip);
- void MapFrameToTimeL(TInt aFrameNumber, TInt64* aMediaTime);
- TInt MapTimeToFrameL(TInt64* aMediaTime);
-
-private: // New methods
- TInt FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber);
-
-private: // Data
- CMMAAnimationPlayer* iPlayer;
-
-};
-
-
-#endif // CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayer.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for playing animated images.
-*
-*/
-
-
-#ifndef CMMAANIMATIONPLAYER_H
-#define CMMAANIMATIONPLAYER_H
-
-// INCLUDES
-#include <w32std.h>
-#include "cmmaplayer.h"
-#include "mmmaguiplayer.h"
-#include "mmmasnapshot.h"
-#include "rmmatempfile.h"
-#include "MIHLViewerObserver.h"
-#include "MIHLImageViewer.h"
-
-// FORWARD DECLARATIONS
-class MMAFunctionServer;
-class CMMAAnimationWindow;
-class MIHLFileImage;
-class MIHLBitmap;
-class CFbsBitmap;
-
-// CONSTANTS
-_LIT(KMMAVideoPlayer, "VideoPlayer");
-
-NONSHARABLE_CLASS(MMMAAnimationObserver)
-{
-public: // new methods
- /**
- * Listener for animation advancing
- * @param aFrame current frame
- * @param aMediaTime current media time
- */
- virtual void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime) = 0;
-};
-
-// CLASS DECLARATION
-/**
-* This class is used for playing animated images.
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationPlayer): public CMMAPlayer,
- public MMMAGuiPlayer,
- public MMMASnapshot,
- public MIHLViewerObserver
-{
-public: // Construction
- static CMMAAnimationPlayer* NewLC();
- static CMMAAnimationPlayer* NewLC(const TDesC& aFileName);
-
- // Destructor
- ~CMMAAnimationPlayer();
-
-protected:
- // C++ constructor
- CMMAAnimationPlayer();
- void ConstructL();
-
-public: // from CMMAPlayer
- void SetPlayerListenerObjectL(jobject aListenerObject,
- JNIEnv* aJni,
- MMMAEventPoster* aEventPoster);
- void RealizeL();
- void PrefetchL();
- void StartL();
- void StopL(TBool aPostEvent);
- void DeallocateL();
- void GetDuration(TInt64* aDuration);
- const TDesC& Type();
- void SetMediaTimeL(TInt64* aTime);
- void GetMediaTime(TInt64* aMediaTime);
-
-public: // from CMMAPlayer/MMMASourceStreamListener
- void ReadCompletedL(TInt aStatus, const TDesC8& aData);
-
-public: // new methods
- void PrefetchFileL();
- void PrefetchDataL(const TDesC8& aData);
-
- /**
- * Check whether this player is playing from a file locator
- * @return ETrue if is a file player, EFalse otherwise
- */
- TBool IsFilePlayer();
-
- // Finds current frame for given media time
- TInt FindFrame(TInt64 aTime);
-
- // Calculates media time for specified frame
- TInt64 MediaTimeForFrame(TInt aFrameIndex);
-
- // Frame duration of specified frame
- TTimeIntervalMicroSeconds32 FrameDuration(TInt aFrameIndex);
-
- MIHLImageViewer* Viewer();
-
- // Setter for frame listener, used for stop time control
- void SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver);
-
- /**
- * @param aRate Rate to set in "milli-percentage"..
- * @return Actual rate set.
- */
- TInt SetRateL(TInt aRate);
-
- /**
- * @return The current playback rate in "milli-percentage".
- */
- TInt RateL();
-
-private: // new methods
- void PrepareViewerL();
- void ProcessCurrentFrameL();
-
-public: // From MMMAGuiPlayer
- void SetDisplayL(MMMADisplay* aDisplay);
- TSize SourceSize();
- void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
- const TDesC& aStringEventData);
-
- MMMASnapshot* SnapshoterL();
-
-public: // From MMMASnapshot
- MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
- const TSize& aSize,
- const CMMAImageSettings& aSettings);
- CFbsBitmap* SnapshotBitmap();
- HBufC8* SnapshotEncoded();
-
-public: // From MIHLViewerObserver
- virtual void ViewerBitmapChangedL();
- virtual void ViewerError(TInt aError);
-
- private: // Data
-
- /**
- * Display to draw animation.
- */
- MMMADisplay* iDisplay;
-
- /**
- * Window to draw animation.
- */
- CMMAAnimationWindow* iWindow;
-
- /**
- * Dimensions of animation.
- */
- TSize iSourceSize;
-
- /**
- * Animated image to play. Owned.
- */
- MIHLFileImage* iImage;
-
- /**
- * Destination bitmap for animation. Owned.
- */
- MIHLBitmap* iBitmap;
-
- /**
- * Animation viewer. Owned.
- */
- MIHLImageViewer* iViewer;
-
- /**
- * Bitmap for snapshot. Ownership is transferred for
- * snapshot requester, but owned if not null.
- */
- CFbsBitmap* iSnapshotBitmap;
-
- /**
- * File system session for IHL interfacing
- */
- RFs iFSession;
-
- /**
- * Animation frame count. Held locally for optimization.
- */
- TInt iFrameCount;
-
- /**
- * Possible file name, owned
- */
- HBufC* iFileName;
-
- /**
- * Current Media Time
- */
- TInt64 iMediaTime;
-
- /**
- * Animation listener
- */
- MMMAAnimationObserver* iAnimationObserver;
-
- /**
- * Current rate
- */
- TInt iCurrentRate;
-
- /**
- * Hold the information whether playback should be started
- * from beginning on next start or from current position
- */
- TBool iEndReached;
-
- /**
- * EndOfMedia will be delivered when next frame arrives if
- * iSendEndOfMediaOnNextFrame is true
- */
- TBool iSendEndOfMediaOnNextFrame;
-};
-
-#endif // CMMAANIMATIONPLAYER_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayerfactory.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for creating animation player
-*
-*/
-
-
-#ifndef CMMAANIMATIONPLAYERFACTORY_H
-#define CMMAANIMATIONPLAYERFACTORY_H
-
-// INCLUDES
-#include "mmmaplayerfactory.h"
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class CMMAAnimationPlayer;
-
-// CLASS DECLARATION
-/**
-* This class is used for creating animation player.
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationPlayerFactory): public MMMAPlayerFactory
-{
-public: // Constructor and destructor
- static CMMAAnimationPlayerFactory* NewLC();
- ~CMMAAnimationPlayerFactory();
-
-private: // Constructor
- CMMAAnimationPlayerFactory();
-
-public: // From MMMAPlayerFactory
-
- // Creates new player according to a content type.
- virtual CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
-
- // Creates new player according to a locator
- virtual CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
- const TDesC& aMiddlePart,
- const TDesC& aParameters);
-
- // Creates new player according to a header data
- virtual CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
-
- // Gets player's supported content types.
- virtual void GetSupportedContentTypesL(const TDesC& aProtocol,
- CDesC16Array& aMimeTypeArray);
-
- // Gets player's supported protocols for the content type.
- virtual void GetSupportedProtocolsL(const TDesC& aContentType,
- CDesC16Array& aProtocolArray);
-
-private:
- // Create instance of animation player with sufficient controls
- CMMAAnimationPlayer* CreateAnimationPlayerL();
-
- // Create instance of animation player with sufficient controls, with specified file
- CMMAAnimationPlayer* CreateAnimationPlayerL(const TDesC& aFileName);
-
- // Add animation controls to player
- void AddControlsL(CMMAAnimationPlayer* aPlayer);
-
-};
-
-#endif // CMMAANIMATIONPLAYERFACTORY_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationratecontrol.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements AnimationRateControl functionality.
-*
-*/
-
-
-#ifndef CMMAANIMATIONRATECONTROL_H
-#define CMMAANIMATIONRATECONTROL_H
-
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-#include "cmmaratecontrol.h" // base class
-
-// CONSTANTS
-
-class CMMAAnimationPlayer;
-
-// CLASS DECLARATION
-/**
-* This class implements AnimationRateControl interface.
-*
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationRateControl): public CMMARateControl
-{
-public:
- /**
- * Creates new CMMAAnimationRateControl.
- *
- * @param aPlayer Player that plays the content.
- */
- static CMMAAnimationRateControl* NewL(CMMAAnimationPlayer* aPlayer);
-
- /**
- * Destructor.
- */
- ~CMMAAnimationRateControl();
-protected:
- /**
- * Constructor.
- * @param aPlayer Player that plays the content.
- */
- CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer);
-
- /**
- * Initializes this control.
- */
- void ConstructL();
-
-public: // From CMMARateControl
- /**
- * @param aRate Rate to set in "milli-percentage"..
- * @return Actual rate set.
- */
- TInt SetRateL(TInt aRate);
-
- /**
- * @return The current playback rate in "milli-percentage".
- */
- TInt RateL();
-
-private: // Data
- /**
- * Used to control animation.
- */
- CMMAAnimationPlayer* iPlayer;
-
-};
-
-
-#endif // CMMAANIMATIONRATECONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationstoptimecontrol.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for stoptime controlling for animation player
-*
-*/
-
-
-#ifndef CMMAANIMATIONSTOPTIMECONTROL_H
-#define CMMAANIMATIONSTOPTIMECONTROL_H
-
-// INCLUDES
-#include "cmmaanimationplayer.h"
-#include "cmmastoptimecontrol.h"
-
-// CLASS DECLARATION
-/**
-* This class is used for stoptime controlling for animation
-*
-*
-*/
-
-NONSHARABLE_CLASS(CMMAAnimationStopTimeControl): public CMMAStopTimeControl,
- public MMMAAnimationObserver
-{
-public:
- static CMMAAnimationStopTimeControl* NewL(CMMAAnimationPlayer* aPlayer);
- ~CMMAAnimationStopTimeControl();
-
-protected:
- CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer);
-
-public: // from CMMAStopTimeControl
- void SetStopTimeL(const TInt64& aTime);
-
-public: // from MMMAAnimationObserver
- void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime);
-};
-
-#endif // CMMAANIMATIONSTOPTIMECONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationwindow.h Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This abstract class implements MMMADisplayWindow functionality
-* in CFbsBitmap based displays.
-*
-*/
-
-
-#ifndef CMMAANIMATIONWINDOW_H
-#define CMMAANIMATIONWINDOW_H
-
-// INCLUDES
-#include <MIHLImageViewer.h>
-//#include "MMMADisplayWindow.h"
-#include "cmmabitmapwindow.h"
-#include "mmafunctionserver.h"
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-//class CFbsBitmap;
-
-
-// CLASS DECLARATION
-/**
-* This abstract class implements MMMADisplayWindow functionality in
-* CFbsBitmap based displays.
-*
-*
-*/
-
-
-NONSHARABLE_CLASS(CMMAAnimationWindow): public CMMABitmapWindow
-{
-public: // Constructors and destructors
- ~CMMAAnimationWindow(); // Destructor ()
-
- static CMMAAnimationWindow* NewL(MMAFunctionServer* aEventSource);
-
-protected: // Constructors and destructors
- // Default constructor, protected to allow derivation
- CMMAAnimationWindow(MMAFunctionServer* aEventSource);
-
-public: // new methods
- /**
- * Setter for viewer, used for changing the size
- */
- void SetViewer(MIHLImageViewer* aViewer);
-
-public: // Methods derived from MMMADisplayWindow
- void SetDestinationBitmapL(CFbsBitmap* aBitmap);
- void DrawFrameL(const CFbsBitmap* aBitmap);
- void SetDrawRect(const TRect& aRect);
- void SetDrawRectThread(const TRect& aRect);
-
- /*private:
- static void StaticSetDrawRect(
- CMMAAnimationWindow* aWindow,
- TRect aRect,
- MMAFunctionServer* aEventSource );*/
-
-protected: // Data
- /**
- * not owned, used for switching from UI thread to MMA thread
- */
- MMAFunctionServer* iEventSource;
-
- /**
- * Pointer to bitmap context, used for BitBlt instead of
- * slow DrawRect
- */
- CBitmapContext* iBitContext;
-
- /**
- * Viewer used for setting new size, not owned
- */
- MIHLImageViewer* iViewer;
-};
-
-#endif // CMMAANIMATIONWINDOW_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationframepositioningcontrol.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements FramePositioningControl for animation
-*
-*/
-
-
-// INCLUDE FILES
-#include <logger.h>
-#include <e32base.h>
-
-#include "MIHLImageViewer.h"
-#include "cmmaanimationframepositioningcontrol.h"
-
-CMMAAnimationFramePositioningControl*
-CMMAAnimationFramePositioningControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
- CMMAAnimationFramePositioningControl* self =
- new(ELeave) CMMAAnimationFramePositioningControl(aPlayer);
- return self;
-}
-
-CMMAAnimationFramePositioningControl::
-CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer)
- : CMMAFramePositioningControl(aPlayer), iPlayer(aPlayer)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::CMMAAnimationFramePositioningControl");
-}
-
-CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl()
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl");
-}
-
-TInt CMMAAnimationFramePositioningControl::SeekL(TInt aFrameNumber)
-{
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SeekL");
- MIHLImageViewer* viewer = iPlayer->Viewer();
- if (!viewer)
- {
- return KErrNotFound;
- }
- TInt frameNumber = FindFrame(viewer, aFrameNumber);
- TInt64 mediaTime = iPlayer->MediaTimeForFrame(frameNumber);
- // adjust wanted media time to get right frame (equal value returns one too small)
- mediaTime++;
- iPlayer->SetMediaTimeL(&mediaTime);
- frameNumber = viewer->AnimationFrame();
- return frameNumber;
-}
-
-TInt CMMAAnimationFramePositioningControl::SkipL(TInt aFramesToSkip)
-{
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SkipL");
- MIHLImageViewer* viewer = iPlayer->Viewer();
- if (!viewer)
- {
- return KErrNotFound;
- }
-
- TInt frameNumber = viewer->AnimationFrame();
-
- SeekL(frameNumber + aFramesToSkip);
-
- // Calculate number of frames skipped
- return viewer->AnimationFrame() - frameNumber;
-}
-
-void CMMAAnimationFramePositioningControl::MapFrameToTimeL(
- TInt aFrameNumber,
- TInt64* aMediaTime)
-{
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapFrameToTimeL");
- MIHLImageViewer* viewer = iPlayer->Viewer();
- if (!viewer || (aFrameNumber < 0) ||
- (aFrameNumber >= viewer->AnimationFrameCount()))
- {
- *aMediaTime = KErrNotFound;
- }
- else
- {
- *aMediaTime = iPlayer->MediaTimeForFrame(aFrameNumber);
- }
-}
-TInt CMMAAnimationFramePositioningControl::MapTimeToFrameL(
- TInt64* aMediaTime)
-{
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapTimeToFrameL");
- MIHLImageViewer* viewer = iPlayer->Viewer();
- TInt64 duration;
- iPlayer->GetDuration(&duration);
- if (!viewer || (*aMediaTime < 0) ||
- (duration == KErrNotFound))
- {
- return KErrNotFound;
- }
- return iPlayer->FindFrame(*aMediaTime);
-}
-
-TInt CMMAAnimationFramePositioningControl::FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber)
-{
- TInt frame = 0;
- TInt count = aViewer->AnimationFrameCount();
- if (aFrameNumber >= count)
- {
- frame = count - 1;
- }
- else if (aFrameNumber > 0)
- {
- frame = aFrameNumber;
- }
- return frame;
-}
-
-// END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayer.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,621 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for playing animated images.
-*
-*/
-
-
-// INCLUDE FILES
-#include <logger.h>
-
-// For Image Handling Library (IHL)
-#include "IHLImageFactory.h"
-#include "MIHLFileImage.h"
-#include "IHLViewerFactory.h"
-#include "MIHLImageViewer.h"
-#include "MIHLBitmap.h"
-#include "IHLBitmapUtil.h"
-
-// MMAPI includes
-#include "mmmadisplay.h"
-
-// Class header
-#include "cmmaanimationplayer.h"
-#include "cmmaanimationwindow.h"
-
-namespace
-{
-const TInt64 KMMATimeUnknown = -1;
-_LIT(KMMAAnimationContentType, "image/gif");
-
-// Approximated minimum showing time of each frame is 0.12s
-// this value basically depends on how fast device can load frames
-// it is not quaranteed anyway that the media time is equal to
-// clock time, so this needed to be only somewhat close
-
-_LIT(KVideoControlName, "VideoControl");
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::NewLC");
- CMMAAnimationPlayer* self = new(ELeave) CMMAAnimationPlayer();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC(const TDesC& aFileName)
-{
- CMMAAnimationPlayer* self = NewLC();
- self->iFileName = aFileName.AllocL();
- return self;
-}
-
-CMMAAnimationPlayer::~CMMAAnimationPlayer()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer +");
- if (iViewer && iViewer->IsPlaying())
- {
- iViewer->Stop();
- }
- delete iWindow;
- delete iSnapshotBitmap;
- delete iViewer;
- // viewer has reference to iImage,
- // thus deletion order is important.
- delete iBitmap;
- delete iImage;
-
- delete iFileName;
-
- iFSession.Close();
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer -");
-}
-
-CMMAAnimationPlayer::CMMAAnimationPlayer()
- : iFrameCount(0), iMediaTime(KMMATimeUnknown), iEndReached(EFalse),
- iSendEndOfMediaOnNextFrame(EFalse)
-{
-}
-
-void CMMAAnimationPlayer::ConstructL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL +");
- CMMAPlayer::ConstructL();
- HBufC* contentType = KMMAAnimationContentType().AllocL();
- SetContentType(contentType);
-
- // Connect to file session, needed also when playing from data
- User::LeaveIfError(iFSession.Connect());
-
- // File session must be share protected for IHL
- User::LeaveIfError(iFSession.ShareProtected());
-
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL -");
-}
-
-void CMMAAnimationPlayer::SetPlayerListenerObjectL(
- jobject aListenerObject,
- JNIEnv* aJni,
- MMMAEventPoster* aEventPoster)
-{
- CMMAPlayer::SetPlayerListenerObjectL(aListenerObject,
- aJni,
- aEventPoster);
-
- // this method must be called only ones
- __ASSERT_DEBUG(!iWindow, User::Invariant());
-
- // create window for animationplayer
- // event poster is always MMAFunctionServer type.
- iWindow = CMMAAnimationWindow::NewL(
- static_cast< MMAFunctionServer* >(iEventPoster));
-}
-
-void CMMAAnimationPlayer::RealizeL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::RealizeL");
- // For file locator file must be prefetched here because
- // FramePositioningControl must know duration of media
- // in realized state
- if (iFileName)
- {
- TRAPD(err, PrefetchFileL());
- if (err != KErrNone)
- {
- User::Leave(err);
- }
- }
- CMMAPlayer::RealizeL();
-}
-
-void CMMAAnimationPlayer::PrefetchL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL +");
- __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant());
-
- if (iFileName)
- {
- // file data is already fetched in when realizing
-
- // If initDisplayMode was called before prefetch,
- // then the display must notified about source size.
- if (iDisplay)
- {
- iDisplay->SourceSizeChanged(iSourceSize);
- NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
- }
-
- // ChangeState(EPrefetched);
- // PostActionCompleted(KErrNone);
- // we can go to prefetched state immediately
- PostActionCompletedFile();
- ChangeState(EPrefetched);
- }
- else
- {
- // Using TDes -- load the whole animation
- iSourceStreams[ 0 ]->ReadAllL();
- }
-
- // CMMASourceStream will notify with ReadCompleted
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL -");
-}
-
-void CMMAAnimationPlayer::StartL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL +");
-
- // If end of media has been reached, then
- // start from beginning
- if (iEndReached)
- {
- iEndReached = EFalse;
- iViewer->SetAnimationFrame(0);
- iMediaTime = 0;
- }
- PostLongEvent(CMMAPlayerEvent::EStarted, iMediaTime);
-
- // process current frame
- ProcessCurrentFrameL();
-
- // progress to next frame (start playback) only if rate is not zero
- if (iCurrentRate > 0)
- {
- iViewer->Play();
- }
- ChangeState(EStarted);
- PostActionCompletedStart();
- // PostActionCompleted(KErrNone); // java start return
-
-
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL -");
-}
-
-void CMMAAnimationPlayer::ProcessCurrentFrameL()
-{
- if (iSendEndOfMediaOnNextFrame)
- {
- iSendEndOfMediaOnNextFrame = EFalse;
- // we are reached the end
- if (!iRepeatForever)
- {
- iRepeatCount++;
- if (iRepeatCount >= iRepeatNumberOfTimes)
- {
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reached repeat count, Stopping");
- // end looping, do not send stopped event
- StopL(EFalse);
- iViewer->SetAnimationFrame(iFrameCount - 1);
- SetLoopCount(iRepeatNumberOfTimes); // reset loop count
-
- // Signal that end of media has been reached so on next
- // start playback will be started from beginning. This is needed
- // because if user sets media time to end of media, then start
- // should not start from beginning but just deliver end of media.
- // After that, the next start should start from beginning.
- iEndReached = ETrue;
- }
- }
- PostLongEvent(CMMAPlayerEvent::EEndOfMedia, iMediaTime);
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: sent END_OF_MEDIA");
-
- // Prevents this frame from being viewed if playback has terminated
- // (e.g. not looping)
- if (iEndReached)
- {
- return;
- }
- }
-
- // draw current frame to display if we have it
- if (iDisplay)
- {
- const CFbsBitmap& bitmap = iBitmap->Bitmap();
- iDisplay->DrawFrameL(&bitmap);
- }
-
- TInt currentFrame = iViewer->AnimationFrame();
- if (currentFrame == 0)
- {
- LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reset mediatime");
- // reset media time when looping
- iMediaTime = 0;
- }
- iMediaTime += FrameDuration(currentFrame).Int();
-
- // Media time has gone over duration if user has
- // set media time explicitely to duration.
- if (iMediaTime > iDuration)
- {
- iMediaTime = iDuration;
- }
-
- if (currentFrame == (iFrameCount - 1))
- {
- // End has been reached, so EndOfMedia is sent when
- // duration of last frame has passed
- iSendEndOfMediaOnNextFrame = ETrue;
- }
-
- // inform observer
- if (iAnimationObserver)
- {
- iAnimationObserver->AnimationAdvancedL(iViewer->AnimationFrame(), iMediaTime);
- }
-}
-
-void CMMAAnimationPlayer::StopL(TBool aPostEvent)
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL +");
- iViewer->Stop();
- // adjust mediatime
- if (aPostEvent)
- {
- PostLongEvent(CMMAPlayerEvent::EStopped, iMediaTime);
- }
- ChangeState(EPrefetched);
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL -");
-}
-
-void CMMAAnimationPlayer::DeallocateL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL +");
- // If player is in starte state when deallocate is called,
- // player is stopped from java side -> state is changed to
- // prefetched.
- if (iViewer)
- {
- if (iViewer->IsPlaying())
- iViewer->Stop();
-
- delete iViewer;
- iViewer = NULL;
- }
-
- if (iState == EPrefetched)
- {
- ResetSourceStreams();
- iEndReached = EFalse;
- iSendEndOfMediaOnNextFrame = EFalse;
- ChangeState(ERealized);
- }
- LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL -");
-}
-
-void CMMAAnimationPlayer::GetDuration(TInt64* aDuration)
-{
- *aDuration = iDuration;
-}
-
-TInt CMMAAnimationPlayer::FindFrame(TInt64 aTime)
-{
- __ASSERT_DEBUG(iImage, User::Invariant());
-
- // if we are out of bounds
- if (aTime > iDuration)
- {
- return KErrNotFound;
- }
-
- TInt64 time = 0;
- TInt fIndex = 0;
- while ((time < aTime) && (fIndex < iFrameCount))
- {
- time += FrameDuration(fIndex++).Int();
- }
-
- // adjust to previous frame
- if (fIndex > 0)
- {
- fIndex--;
- }
-
- return fIndex;
-}
-
-TInt64 CMMAAnimationPlayer::MediaTimeForFrame(TInt aFrameIndex)
-{
- __ASSERT_DEBUG((aFrameIndex <= iFrameCount) && (aFrameIndex >= 0),
- User::Invariant());
-
- TInt64 time = 0;
- for (TInt fIndex = 0; fIndex < aFrameIndex; fIndex++)
- {
- time += FrameDuration(fIndex).Int();
- }
- return time;
-}
-
-TTimeIntervalMicroSeconds32 CMMAAnimationPlayer::FrameDuration(TInt aFrameIndex)
-{
- __ASSERT_DEBUG(iImage, User::Invariant());
- TTimeIntervalMicroSeconds32 fDur = iImage->AnimationFrameDelay(aFrameIndex);
- const TTimeIntervalMicroSeconds32 KMMAMinimumFrameTime = 120000;
-
- if (fDur < KMMAMinimumFrameTime)
- {
- fDur = KMMAMinimumFrameTime;
- }
- return fDur;
-}
-
-void CMMAAnimationPlayer::SetMediaTimeL(TInt64* aTime)
-{
- if (!iImage && !iViewer)
- {
- // not yet prefetched
- *aTime = KErrNotSupported;
- }
- else
- {
- // Media time of last frame is not the same as duration of
- // media, so if media time of duration is requested, then it must
- // be given out altough media time of last frame is lower than that.
- if (*aTime >= iDuration)
- {
- User::LeaveIfError(iViewer->SetAnimationFrame(iFrameCount - 1));
- iMediaTime = iDuration;
- }
- else
- {
- TInt frame = FindFrame(*aTime);
- User::LeaveIfError(iViewer->SetAnimationFrame(frame));
- iMediaTime = MediaTimeForFrame(frame);
- }
- *aTime = iMediaTime;
- iEndReached = EFalse;
- iSendEndOfMediaOnNextFrame = EFalse;
- }
-
-}
-
-void CMMAAnimationPlayer::GetMediaTime(TInt64* aMediaTime)
-{
- *aMediaTime = iMediaTime;
-}
-
-const TDesC& CMMAAnimationPlayer::Type()
-{
- return KMMAVideoPlayer;
-}
-
-void CMMAAnimationPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
-{
- if (aStatus < KErrNone)
- {
- PostActionCompleted(aStatus);
- }
- else
- {
- TRAPD(err, PrefetchDataL(aData));
- if (err == KErrNone)
- {
- ChangeState(EPrefetched);
- }
- PostActionCompleted(err);
- }
-}
-
-void CMMAAnimationPlayer::PrefetchFileL()
-{
- iImage = IHLImageFactory::OpenFileImageL(iFSession, *iFileName);
- PrepareViewerL();
-}
-
-void CMMAAnimationPlayer::PrefetchDataL(const TDesC8& aData)
-{
- LOG1(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchDataL aData size %d",
- aData.Size());
-
- // Create source image from data
- iImage = IHLImageFactory::OpenBufferedFileImageL(iFSession, aData);
- PrepareViewerL();
-}
-
-TBool CMMAAnimationPlayer::IsFilePlayer()
-{
- if (iFileName != NULL)
- {
- return ETrue;
- }
- return EFalse;
-}
-
-void CMMAAnimationPlayer::PrepareViewerL()
-{
- // Non-animated gifs are not supported
- if (!(iImage->IsAnimation()))
- {
- User::Leave(KErrNotSupported);
- }
-
- // Store image dimensions
- iSourceSize = iImage->Size();
-
- // Create destination bitmap
- iBitmap = IHLBitmap::CreateL();
- User::LeaveIfError(iBitmap->Create(iSourceSize, iImage->DisplayMode()));
-
- // Create image viewer
- iViewer = IHLViewerFactory::CreateImageViewerL(
- iSourceSize,
- *iImage, // source
- *iBitmap, // destination
- *this); // reference to MIHLViewerObserver
-
- // Set viewer for window
- iWindow->SetViewer(iViewer);
-
- // Store animation frame count locally
- iFrameCount = iViewer->AnimationFrameCount();
-
- // calculate duration
- iDuration = MediaTimeForFrame(iFrameCount);
-
- // set media time to begin
- iMediaTime = 0;
-
- // If init has been already done
- if (iDisplay)
- {
- iDisplay->SourceSizeChanged(iSourceSize);
- NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
- }
-}
-
-MIHLImageViewer* CMMAAnimationPlayer::Viewer()
-{
- return iViewer;
-}
-
-void CMMAAnimationPlayer::SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver)
-{
- iAnimationObserver = aAnimationObserver;
-}
-
-TInt CMMAAnimationPlayer::SetRateL(TInt aRate)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::SetRateL");
- if ((iState == EStarted) && (iCurrentRate != aRate))
- {
- if (aRate <= 0)
- {
- iViewer->Stop();
- }
- else
- {
- iViewer->Play();
- }
- }
- iCurrentRate = aRate;
- return iCurrentRate;
-}
-
-TInt CMMAAnimationPlayer::RateL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::RateL");
- return iCurrentRate;
-}
-
-void CMMAAnimationPlayer::SetDisplayL(MMMADisplay* aDisplay)
-{
- // now it is ready to draw
- iDisplay = aDisplay;
- iDisplay->SetWindowL(iWindow);
-
- // if state < prefeteched then we dont know actual source size yet
- // and it will be set after prefetch
- if (iState >= EPrefetched ||
- (iFileName && iState == ERealized))
- {
- iDisplay->SourceSizeChanged(iSourceSize);
- NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
- }
-}
-
-TSize CMMAAnimationPlayer::SourceSize()
-{
- return iSourceSize;
-}
-
-void CMMAAnimationPlayer::NotifyWithStringEvent(
- CMMAPlayerEvent::TEventType aEventType,
- const TDesC& aStringEventData)
-{
- PostStringEvent(aEventType, aStringEventData);
-}
-
-MMMASnapshot* CMMAAnimationPlayer::SnapshoterL()
-{
- return this;
-}
-
-MMMASnapshot::TEncoding CMMAAnimationPlayer::TakeSnapshotL(TRequestStatus* aStatus,
- const TSize& /*aSize*/,
- const CMMAImageSettings& /*aSettings*/)
-{
- if (iBitmap)
- {
- // Bitmap has to be copied to get ownership of the bitmap instance.
- iSnapshotBitmap = IHLBitmapUtil::CopyBitmapL(iBitmap->Bitmap());
- }
- else
- {
- // When content comes from a stream, iBitmap is not available
- // until prefetched state is entered. In this case an empty bitmap
- // is returned instead.
- iSnapshotBitmap = new(ELeave) CFbsBitmap();
- }
- // notify the caller, error code or KErrNone
- User::RequestComplete(aStatus, KErrNone);
-
- // Return raw bitmap encoding and thus SnapshotEncoded() should not
- // get called later on.
- return EBitmap;
-}
-
-CFbsBitmap* CMMAAnimationPlayer::SnapshotBitmap()
-{
- CFbsBitmap* bitmap = iSnapshotBitmap;
- // ownership is transferred to caller
- iSnapshotBitmap = NULL;
- return bitmap;
-}
-
-HBufC8* CMMAAnimationPlayer::SnapshotEncoded()
-{
- // This method should never be called.
- // Asserted in debug build to be sure.
- __ASSERT_DEBUG(EFalse, User::Invariant());
-
- return NULL;
-}
-
-void CMMAAnimationPlayer::ViewerBitmapChangedL()
-{
- if (iState == EStarted)
- {
- ProcessCurrentFrameL();
- }
-}
-
-void CMMAAnimationPlayer::ViewerError(TInt /*aError*/)
-{
- // Not implemented currently because
- // not implemented by IHL either.
-}
-
-// END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayerfactory.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for creating animation player.
-*
-*/
-
-
-// INCLUDE FILES
-#include <logger.h>
-
-#include "cmmavideocontrol.h"
-#include "cmmaanimationratecontrol.h"
-#include "cmmaanimationstoptimecontrol.h"
-#include "cmmaanimationframepositioningcontrol.h"
-#include "cmmaanimationplayer.h"
-#include "cmmaanimationplayerfactory.h"
-
-// Animation type info
-_LIT(KMMAAnimationMimeTypeGIF, "image/gif");
-_LIT(KMMAAnimationSuffixGIF, "gif");
-
-// header data and length
-_LIT8(KMMAAnimationGIFVersion, "GIF89a");
-const TUint8 KMMAGifVersionLength = 6;
-
-CMMAAnimationPlayerFactory* CMMAAnimationPlayerFactory::NewLC()
-{
- CMMAAnimationPlayerFactory* pFactory =
- new(ELeave) CMMAAnimationPlayerFactory();
- CleanupStack::PushL(pFactory);
- return pFactory;
-}
-
-CMMAAnimationPlayerFactory::CMMAAnimationPlayerFactory()
-{
-}
-
-
-CMMAAnimationPlayerFactory::~CMMAAnimationPlayerFactory()
-{
-}
-
-// Creates new player according to a content type.
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
- const TDesC& aContentType)
-{
- CMMAPlayer* player = NULL;
- if (aContentType == KMMAAnimationMimeTypeGIF)
- {
- player = CreateAnimationPlayerL();
- }
- return player;
-}
-
-// Creates new player according to a locator
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
- const TDesC& aProtocol,
- const TDesC& aMiddlePart,
- const TDesC& /*aParameters*/)
-{
- CMMAPlayer* player = NULL;
- if (aProtocol == KMMAFileProtocol)
- {
- // filename ends to gif suffix
- if (aMiddlePart.Right(KMMAAnimationSuffixGIF().Length()) ==
- KMMAAnimationSuffixGIF())
- {
- player = CreateAnimationPlayerL(aMiddlePart);
- }
- else
- {
- // try to recognize from headerdata
- RFs fs;
- CleanupClose< RFs >::PushL(fs);
- User::LeaveIfError(fs.Connect());
-
- RFile file;
- CleanupClose< RFile >::PushL(file);
-
- User::LeaveIfError(file.Open(fs, aMiddlePart, EFileRead));
-
- TBuf8< KMMAGifVersionLength > header;
- User::LeaveIfError(file.Read(header));
-
- CleanupStack::PopAndDestroy(2); // fs, file
-
- if (header == KMMAAnimationGIFVersion())
- {
- player = CreateAnimationPlayerL(aMiddlePart);
- }
- }
- }
-
- return (CMMAPlayer*) player;
-}
-
-// Creates new player according to a header data
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
- const TDesC8& aHeaderData)
-{
- CMMAPlayer* player = NULL;
- TPtrC8 header = aHeaderData.Left(KMMAAnimationGIFVersion().Length());
- if (header == KMMAAnimationGIFVersion())
- {
- player = CreateAnimationPlayerL();
- }
- return player;
-}
-
-// Gets player's supported content types.
-void CMMAAnimationPlayerFactory::GetSupportedContentTypesL(
- const TDesC& aProtocol,
- CDesC16Array& aMimeTypeArray)
-{
- if (aProtocol == KNullDesC ||
- aProtocol == KMMAHttpProtocol ||
- aProtocol == KMMAHttpsProtocol ||
- aProtocol == KMMAFileProtocol)
- {
- aMimeTypeArray.AppendL(KMMAAnimationMimeTypeGIF);
- }
-}
-
-// Gets player's supported protocols for the content type.
-void CMMAAnimationPlayerFactory::GetSupportedProtocolsL(
- const TDesC& aContentType,
- CDesC16Array& aProtocolArray)
-{
- if (aContentType == KNullDesC ||
- aContentType == KMMAAnimationMimeTypeGIF)
- {
- aProtocolArray.AppendL(KMMAHttpProtocol);
- aProtocolArray.AppendL(KMMAHttpsProtocol);
- aProtocolArray.AppendL(KMMAFileProtocol);
- }
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL(const TDesC& aFileName)
-{
- CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC(aFileName);
- AddControlsL(player);
- CleanupStack::Pop(); // player
- return player;
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL()
-{
- CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC();
- AddControlsL(player);
- CleanupStack::Pop(); // player
- return player;
-}
-
-void CMMAAnimationPlayerFactory::AddControlsL(CMMAAnimationPlayer* aPlayer)
-{
- CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(aPlayer);
- CleanupStack::PushL(videoControl);
- aPlayer->AddControlL(videoControl);
- CleanupStack::Pop(videoControl);
-
- CMMAAnimationStopTimeControl* stopTimeControl =
- CMMAAnimationStopTimeControl::NewL(aPlayer);
- CleanupStack::PushL(stopTimeControl);
- aPlayer->AddControlL(stopTimeControl);
- CleanupStack::Pop(stopTimeControl);
-
- // Own RateControl
- CMMAAnimationRateControl* rateControl =
- CMMAAnimationRateControl::NewL(aPlayer);
- CleanupStack::PushL(rateControl);
- aPlayer->AddControlL(rateControl);
- CleanupStack::Pop(rateControl);
-
- // FramePositioningControl is only supported for file locator
- if (aPlayer->IsFilePlayer())
- {
- CMMAAnimationFramePositioningControl* animationFramePositioningControl =
- CMMAAnimationFramePositioningControl::NewL(aPlayer);
- CleanupStack::PushL(animationFramePositioningControl);
- aPlayer->AddControlL(animationFramePositioningControl);
- CleanupStack::Pop(animationFramePositioningControl);
- }
-
-}
-// END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationratecontrol.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// INCLUDE FILES
-#include <logger.h>
-#include <e32base.h>
-
-#include "cmmaanimationratecontrol.h"
-#include "cmmaanimationplayer.h"
-
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CMMAAnimationRateControl* CMMAAnimationRateControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
- CMMAAnimationRateControl* self = new(ELeave) CMMAAnimationRateControl(aPlayer);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::CMMAAnimationRateControl
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CMMAAnimationRateControl::CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::CMMAAnimationRateControl");
- iPlayer = aPlayer;
-}
-
-// Destructor
-CMMAAnimationRateControl::~CMMAAnimationRateControl()
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::~CMMAAnimationRateControl");
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CMMAAnimationRateControl::ConstructL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::ConstructL");
- iPlayer->SetRateL(KMMADefaultRate);
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::SetRateL
-// Set rate to minimum or default rate depending on parameter. Informs player
-// that rate has changed. Returns set rate.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt CMMAAnimationRateControl::SetRateL(TInt aRate)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::SetRateL");
- TInt rate = aRate;
-
- if (rate <= KMMAMinRate)
- {
- rate = KMMAMinRate;
- }
- else
- {
- rate = KMMADefaultRate;
- }
- return iPlayer->SetRateL(rate);
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::RateL
-// Returns current rate.
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt CMMAAnimationRateControl::RateL()
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::RateL");
- return iPlayer->RateL();
-}
-
-// END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationstoptimecontrol.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class is used for stoptime controlling
-*
-*/
-
-
-// INCLUDE FILES
-#include <logger.h>
-#include <e32std.h>
-
-#include "cmmaanimationstoptimecontrol.h"
-#include "cmmaplayer.h"
-
-CMMAAnimationStopTimeControl* CMMAAnimationStopTimeControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::NewL");
- CMMAAnimationStopTimeControl* control =
- new(ELeave) CMMAAnimationStopTimeControl(aPlayer);
- aPlayer->SetAnimationObserver(control);
- return control;
-}
-
-
-CMMAAnimationStopTimeControl::~CMMAAnimationStopTimeControl()
-{
-}
-
-
-CMMAAnimationStopTimeControl::CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer)
- : CMMAStopTimeControl(aPlayer)
-{
-}
-
-void CMMAAnimationStopTimeControl::SetStopTimeL(const TInt64& aTime)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::SetStopTimeL");
- iStopTime = aTime;
-}
-
-void CMMAAnimationStopTimeControl::AnimationAdvancedL(TInt /*aFrame*/, TInt64 aMediaTime)
-{
- LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::AnimationAdvancedL");
- if (aMediaTime > iStopTime)
- {
- iPlayer->StopL(EFalse);
- iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, aMediaTime);
- iStopTime = iNoTimer;
- }
-}
-
-
-
-
-// END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationwindow.cpp Fri Jul 09 16:35:45 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This abstract class implements MMMADisplayWindow functionality
-* in CFbsBitmap based displays.
-*
-*/
-
-
-// Include Files
-#include <logger.h>
-#include <bitdev.h>
-#include "cmmaanimationwindow.h"
-
-// Destructor (virtual by CBase)
-CMMAAnimationWindow::~CMMAAnimationWindow()
-{
- delete iBitContext;
-}
-
-CMMAAnimationWindow* CMMAAnimationWindow::NewL(
- MMAFunctionServer* aEventSource)
-{
- CMMAAnimationWindow* self =
- new(ELeave)CMMAAnimationWindow(aEventSource);
- return self;
-}
-
-CMMAAnimationWindow::CMMAAnimationWindow(MMAFunctionServer* aEventSource):
- iEventSource(aEventSource)
-{
-}
-
-void CMMAAnimationWindow::SetViewer(MIHLImageViewer* aViewer)
-{
- iViewer = aViewer;
-}
-
-void CMMAAnimationWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
-{
- CMMABitmapWindow::SetDestinationBitmapL(aBitmap);
- User::LeaveIfError(iBitmapDevice->CreateBitmapContext(iBitContext));
-}
-
-void CMMAAnimationWindow::DrawFrameL(const CFbsBitmap* aBitmap)
-{
- if (iBitmap)
- {
- iBitContext->BitBlt(iDrawRect.iTl, aBitmap);
- }
-}
-
-// Local wrapper function to SetDrawRect method
-LOCAL_C void StaticSetDrawRect(
- CMMAAnimationWindow* aWindow,
- const TRect* aRect)
-{
- aWindow->SetDrawRect(*aRect);
-}
-
-void CMMAAnimationWindow::SetDrawRect(const TRect& aRect)
-{
- iDrawRect = aRect;
- if (iViewer)
- {
- TReal zoomRatio = 1.0;
- if ((iViewer->SourceSize().iWidth - aRect.Width()) >
- (iViewer->SourceSize().iHeight - aRect.Height()))
- {
- // calculate zoom ratio from width
- zoomRatio = (TReal)aRect.Width() / (TReal)iViewer->SourceSize().iWidth;
- }
- else
- {
- // calculate zoom ratio from height
- zoomRatio = (TReal)aRect.Height() / (TReal)iViewer->SourceSize().iHeight;
- }
-
- iViewer->SetViewerSize(iDrawRect.Size());
- iViewer->SetZoomRatio(zoomRatio);
- }
-}
-
-void CMMAAnimationWindow::SetDrawRectThread(const TRect& aRect)
-{
- iEventSource->ExecuteV(&StaticSetDrawRect,
- this,
- &aRect);
-}
-
-// END OF FILE
--- a/javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h Fri Jul 23 12:27:20 2010 +0300
@@ -65,7 +65,8 @@
EResetSurfaceParameters,
ESetChangedSurfaceParameters,
ECleanVideoDisplay,
- EDestroyWindow
+ EDestroyWindow,
+ EChangeVisibility
};
private:
@@ -158,6 +159,7 @@
const TRect& WindowRect();
void ContainerDestroyed();
void ContainerSet();
+ void DoSetVisibleL();
/*
public: // from base class MUiEventConsumer
void MdcDSAResourcesCallback(RWsSession &aWs,
--- a/javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h Fri Jul 23 12:27:20 2010 +0300
@@ -246,6 +246,10 @@
virtual void UICallback( TInt /*aCallbackId*/ )
{
}
+
+ virtual void DoSetVisibleL()
+ {
+ }
};
#endif // MMMADISPLAYWINDOW_H
--- a/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java Fri Jul 23 12:27:20 2010 +0300
@@ -469,24 +469,28 @@
InternalPlayer player =null;
/// Implementation done for java ui 3.x req
// in case of AnimationPlayer file protocol, we won't be using the ProtocolFactory class.
- // We need to do this kind of work out, only if it is file protocol
- if (new Locator(aLocator).getProtocol().equals("file")) {
- Enumeration plugins = iPlugIns.elements();
- AnimationPlayerFactory apf = null;
- while (plugins.hasMoreElements() && (player == null)) {
- PlugIn temp = (PlugIn) plugins.nextElement();
- if (temp instanceof AnimationPlayerFactory) {
- apf = (AnimationPlayerFactory) temp;
- break;
- }
- }
- if (apf != null) {
- player = apf.createPlayer(aLocator);
- }
- }
+ // We need to do this kind of work out, only if it is file protocol
+ if (new Locator(aLocator).getProtocol().equals("file"))
+ {
+ Enumeration plugins = iPlugIns.elements();
+ AnimationPlayerFactory apf = null;
+ while (plugins.hasMoreElements() && (player == null))
+ {
+ PlugIn temp = (PlugIn) plugins.nextElement();
+ if (temp instanceof AnimationPlayerFactory)
+ {
+ apf = (AnimationPlayerFactory) temp;
+ break;
+ }
+ }
+ if (apf != null)
+ {
+ player = apf.createPlayer(aLocator);
+ }
+ }
////////////////////////////////////////////////////////
// if player is still null, try to create the native player
- System.out.println("ManagerImpl::createPlayer(String locator )locator is "+aLocator );
+ System.out.println("ManagerImpl::createPlayer(String locator )locator is "+aLocator);
if (player==null)
player =iProtocolFactory.createPlayer(
new Locator(aLocator));
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java Fri Jul 23 12:27:20 2010 +0300
@@ -114,8 +114,9 @@
/**
*
* @param ds DataSource which contains the data to be displayed
+ * @throws MediaException
*/
- public AnimationPlayer(DataSource ds)
+ public AnimationPlayer(DataSource ds) throws MediaException
{
iPlayerListenerImpl= new PlayerListenerImpl(this);
//TODO check if we can do it in better way
@@ -128,7 +129,14 @@
if (is!=null)
{
ImageLoader imageLoader= new ImageLoader();
+
+ // If it is any other format other than the image(jpeg, png and gif),
+ // following line will throw the SWT exception
iImageData=imageLoader.load(is);
+ // If the image is loaded properly, we need to check whether it is GIF image or not.
+ // It can be PNG and JPEG as well
+ if (iImageData[0].type!=SWT.IMAGE_GIF)
+ throw new MediaException("Could not create player");
try
{
is.close();
@@ -150,12 +158,17 @@
* @param locator
* @throws SWTException
*/
- public AnimationPlayer(String locator) throws SWTException
+ public AnimationPlayer(String locator) throws SWTException, MediaException
{
+ ImageLoader imageLoader= new ImageLoader();
+ // If it is any other format other than the image(jpeg, png and gif),
+ // following line will throw the SWT exception
+ iImageData=imageLoader.load(locator);
+ // If the image is loaded properly, we need to check whether it is GIF image or not.
+ // It can be PNG and JPEG as well
+ if (iImageData[0].type!=SWT.IMAGE_GIF)
+ throw new MediaException("Could not create player");
iPlayerListenerImpl= new PlayerListenerImpl(this);
- ImageLoader imageLoader= new ImageLoader();
- // Following line may throw SWTException
- iImageData=imageLoader.load(locator);
iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
iCurrentVideoDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
iBackgroundPixel= imageLoader.backgroundPixel;
@@ -305,7 +318,7 @@
public void run()
{
// For out of memory issue in case of full screen, we are scaling the image
- // while displaying it.
+ // while displaying it.
ImageData tempImageData =iImageData[iFrameIndex] ;
if (iSourceDimension.x!=iCurrentVideoDimension.x || iSourceDimension.x!=iCurrentVideoDimension.x)
{
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java Fri Jul 23 12:27:20 2010 +0300
@@ -96,7 +96,7 @@
* @return InternalPlayer object
* @throws IOException if it is not possible to read the file from location specified
*/
- public InternalPlayer createPlayer(String locator) throws IOException
+ public InternalPlayer createPlayer(String locator) throws IOException, MediaException
{
final String DEBUG_STR="AnimationPlayerFactory::createPlayer(String locator )";
Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"+");
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java Fri Jul 23 12:27:20 2010 +0300
@@ -219,6 +219,17 @@
}
return rect;
}
+
+ public Rectangle getFullScreenBounds()
+ {
+ //return new Rectangle(0,0,0,0);
+ org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ Rectangle temp = disp.getBounds();
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo," getBounds returns width = "+temp.width+"height= "+temp.height);
+ temp = disp.getClientArea();
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo," getBounds returns width = "+temp.width+"height= "+temp.height);
+ return temp;
+ }
// abstract functions implemented by concrete class
protected abstract void setDisplaySize(int aWidth, int aHeight);
protected abstract void setDisplayFullScreen(final boolean aFullScreenMode);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java Fri Jul 23 12:27:20 2010 +0300
@@ -368,10 +368,18 @@
}
- public void setContainerVisibilityToNative(boolean active)
+ public void setContainerVisibilityToNative(final boolean active)
{
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative + ");
- _setContainerVisible(nativeDisplayHandle,active);
+ new Thread()
+ {
+ public void run()
+ {
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+ _setContainerVisible(iEventSourceHandle,nativeDisplayHandle,active);
+ }
+ } .start();
+ //_setContainerVisible(nativeDisplayHandle,active);
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative - ");
}
@@ -504,7 +512,7 @@
private native void _setVisible(int nativeDisplayHandle,
boolean value);
- private native void _setContainerVisible(int nativeDisplayHandle,
+ private native void _setContainerVisible(int iEventSourceHandle,int nativeDisplayHandle,
boolean value);
private native void _setFullScreenMode(int nativeDisplayHandle, boolean value);
private native void _setWindowToNative(int nativeDisplayHandle,int qwidgetHandle);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java Fri Jul 23 12:27:20 2010 +0300
@@ -229,20 +229,16 @@
{
final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
-
- //display.syncExec(new Runnable() {
- //public void run() {
- iControl.setBounds(display.getClientArea());
- System.out.println("enetr in to the full screen mode setDisplayFullScreen %d"+iControl.getBounds());
-// new MobileShell(display).setFullScreenMode(aFullScreenMode);
- //((MobileShell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
- // new Shell(display).setFullScreenMode(aFullScreenMode);
- //((Shell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
- //TODO
- // instruct native to switch to full screen mode
- //_setFullScreenMode(nativeDisplayHandle, aFullScreenMode);
- //}
- //});
+ if (iControl.getParent() instanceof MobileShell)
+ {
+ System.out.println("is instance of MobileShell");
+ MobileShell mobileShell = (MobileShell) iControl.getParent();
+ mobileShell.setFullScreenMode(aFullScreenMode);
+ }
+ else
+ {
+ System.out.println("is not instance of MobileShell");
+ }
}
catch (Exception e)
{
@@ -361,9 +357,9 @@
public void run()
{
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setVisible() inside asyncExec run()");
- //eswtCanvasControl.setVisible(visible);
+ iControl.setVisible(visible);
// call native side to set the visibiity
- _setVisible(nativeDisplayHandle, visible);
+ //_setVisible(nativeDisplayHandle, visible);
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: _setVisible() native call completed");
}
});
@@ -421,10 +417,27 @@
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getCallbackSourceSizeChanged() +");
}
- public void setContainerVisibilityToNative(boolean active)
+ public void setContainerVisibilityToNative(final boolean active)
{
- // TODO Auto-generated method stub
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative + ");
+ new Thread()
+ {
+ public void run()
+ {
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+ _setContainerVisible(nativeDisplayHandle,active);
+ }
+ } .start();
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative - ");
+
+ }
+
+ public Rectangle getFullScreenBounds()
+ {
+
+ final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+ return display.getClientArea();
}
private native void _setVisible(int nativeDisplayHandle, boolean value);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java Fri Jul 23 12:27:20 2010 +0300
@@ -24,6 +24,7 @@
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Item;
import com.nokia.microedition.media.NativeError;
+import com.nokia.mj.impl.utils.Logger;
//import com.symbian.midp.runtime.MIDletExecutor;
import com.nokia.mj.impl.media.PlayerPermission;
@@ -44,6 +45,7 @@
import com.nokia.microedition.media.control.ItemDisplay;
import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.*;
import javax.microedition.lcdui.*;
import org.eclipse.ercp.swt.mobile.MobileShell;
@@ -102,6 +104,11 @@
// class name used to check if eswt is included
private static String ESWT_CONTROL = ".control";
+ //Contants for display type
+ private static final int DISPLAY_CANVAS = 0;
+ private static final int DISPLAY_VIDEOITEM = 1;
+ private static final int DISPLAY_ESWT = 2;
+
protected int iStatus = NOT_INITIALIZED;
// Needed for getting native handle from lcdui components
@@ -110,6 +117,7 @@
private VideoItem iVideoItem;
private Canvas iVideoCanvas;
private Item iItem ;
+ private int iGuiType;
BaseDisplay iDisplay;
// private MIDletInstance iMIDletInstance;
@@ -125,6 +133,11 @@
// for midlet foreground statelistening
//ToolkitInvoker iTlkitInvoker;
+ //ESWT
+ private org.eclipse.swt.widgets.Display eswtDisplay;
+ private Control iControl;
+ private ESWTProxyControl control;
+
private Finalizer mFinalizer = new Finalizer()
{
public void finalizeImpl()
@@ -191,24 +204,26 @@
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplaySize()");
+ //canvasdisplay.setDisplaySize( aWidth, aHeight);
+ //iDisplay.setDisplaySize(aWidth, aHeight);
- //canvasdisplay.setDisplaySize( aWidth, aHeight);
- iDisplay.setDisplaySize(aWidth, aHeight);
-
- /*
+ if (iGuiType == DISPLAY_ESWT)
+ {
+ //iDisplay.setDisplaySize(aWidth, aHeight);
+ }
int ret = setDisplayProperty(aWidth, aHeight, SET_DISPLAY_SIZE);
if (ret < 0)
{
throw new MediaException("setDisplaySize() failed, SymbianOS error: "
- + ret);
+ + ret);
}
if (iStatus == USE_GUI_PRIMITIVE &&
iVideoItem != null) // with dynamic display mode item can be null
{
- iVideoItem.privateInvalidate();
+ //iVideoItem.privateInvalidate();
}
- */
+
}
/**
@@ -217,17 +232,25 @@
*/
public void setDisplayFullScreen(boolean aFullScreenMode) throws MediaException
{
- // checkState();
+ checkState();
+
if (iStatus == NOT_INITIALIZED)
{
throw new IllegalStateException(
"VideoControl.initDisplayMode() not called yet");
}
- /*
+
int ret;
if (aFullScreenMode)
{
- ret = setDisplayProperty(SET_DISPLAY_FULLSCREEN_TRUE);
+ if (iGuiType == DISPLAY_ESWT)
+ {
+ iDisplay.setDisplayFullScreen(aFullScreenMode);
+ }
+ //Rectangle fullscreenRect = iDisplay.getFullScreenBounds();
+ Rectangle fullscreenRect = iDisplay.getBounds();
+ System.out.println("MMAPI: setDisplayFullscreen size width = " + fullscreenRect.width + " height = " + fullscreenRect.height);
+ ret = setDisplayProperty(fullscreenRect.width, fullscreenRect.height, SET_DISPLAY_FULLSCREEN_TRUE);
}
else
{
@@ -239,10 +262,10 @@
throw new MediaException();
}
- */
+
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplayFullScreen()");
//canvasdisplay.setDisplayFullScreen( aFullScreenMode);
- iDisplay.setDisplayFullScreen(aFullScreenMode);
+// iDisplay.setDisplayFullScreen(aFullScreenMode);
}
@@ -253,7 +276,7 @@
*/
public void setDisplayLocation(int aX, int aY)
{
- // checkState();
+ checkState();
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoControl.java :: setDisplayLocation x, y = " + aX + ","+ aY);
if (iStatus == USE_GUI_PRIMITIVE)
{
@@ -265,14 +288,14 @@
// This method only works when the USE_DIRECT_VIDEO mode is set.
throw new IllegalStateException();
}
- /*
- // cannot fail -> ignore return value
- setDisplayProperty(aX, aY, SET_DISPLAY_LOCATION);
- */
+
+ // cannot fail -> ignore return value
+ setDisplayProperty(aX, aY, SET_DISPLAY_LOCATION);
+
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setDisplayLocation()");
//canvasdisplay.setDisplayLocation( aX , aY);
- iDisplay.setDisplayLocation(aX , aY);
+ //iDisplay.setDisplayLocation(aX , aY);
}
@@ -288,11 +311,11 @@
throw new IllegalStateException(
"VideoControl.initDisplayMode() not called yet");
}
- /*if (aVisible)
+ if (aVisible)
{
// Update the foreground or background state of the midlet before
// setting the visibility of the control
- updateForeground();
+ //updateForeground();
// cannot fail -> ignore return value
setDisplayProperty(SET_DISPLAY_VISIBLE_TRUE);
}
@@ -301,12 +324,12 @@
// cannot fail -> ignore return value
setDisplayProperty(SET_DISPLAY_VISIBLE_FALSE);
}
- */
+
Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
" before iDisplay.setVisible()");
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"inside setVisible()");
- // canvasdisplay.setVisible( aVisible );
- iDisplay.setVisible(aVisible);
+
+ //iDisplay.setVisible(aVisible);
Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
"after iDisplay.setVisible()");
@@ -320,18 +343,14 @@
*/
public int getDisplayWidth()
{
- /*
- checkState();
- if (iStatus == NOT_INITIALIZED)
- {
- throw new IllegalStateException(
- "VideoControl.initDisplayMode() not called yet");
- }
- int width = getControlProperty(PROPERTY_DISPLAY_WIDTH);
- return width;
- */
- //return canvasdisplay.getDisplayWidth( );
- return iDisplay.getDisplayWidth();
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ int width = getControlProperty(PROPERTY_DISPLAY_WIDTH);
+ return width;
}
/**
@@ -340,17 +359,17 @@
*/
public int getDisplayHeight()
{
- /* checkState();
- if (iStatus == NOT_INITIALIZED)
- {
- throw new IllegalStateException(
- "VideoControl.initDisplayMode() not called yet");
- }
- int height = getControlProperty(PROPERTY_DISPLAY_HEIGHT);
- return height;
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ int height = getControlProperty(PROPERTY_DISPLAY_HEIGHT);
+ return height;
- */
- return iDisplay.getDisplayHeight();
+
+ //return iDisplay.getDisplayHeight();
}
/**
@@ -359,15 +378,15 @@
*/
public int getDisplayX()
{
- /* checkState();
- if (iStatus == NOT_INITIALIZED)
- {
- return UNDEFINED_RETURN_VALUE;
- }
- int x = getControlProperty(PROPERTY_DISPLAY_X);
- return x;
- */
- return iDisplay.getDisplayX();
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return UNDEFINED_RETURN_VALUE;
+ }
+ int x = getControlProperty(PROPERTY_DISPLAY_X);
+ return x;
+
+ //return iDisplay.getDisplayX();
}
/**
@@ -376,7 +395,7 @@
*/
public int getDisplayY()
{
- /*
+
checkState();
if (iStatus == NOT_INITIALIZED)
{
@@ -385,8 +404,8 @@
int y = getControlProperty(PROPERTY_DISPLAY_Y);
return y;
- */
- return iDisplay.getDisplayY();
+
+ // return iDisplay.getDisplayY();
}
/**
@@ -395,16 +414,16 @@
*/
public int getSourceWidth()
{
- /* checkState();
- int width = getControlProperty(PROPERTY_SOURCE_WIDTH);
- if (width <= 0)
- {
- width = 1;
- }
- return width;
+ checkState();
+ int width = getControlProperty(PROPERTY_SOURCE_WIDTH);
+ if (width <= 0)
+ {
+ width = 1;
+ }
+ return width;
- */
- return iDisplay.getSourceWidth();
+
+ //return 0;//iDisplay.getSourceWidth();
}
/**
@@ -413,15 +432,15 @@
*/
public int getSourceHeight()
{
- /*checkState();
+ checkState();
int height = getControlProperty(PROPERTY_SOURCE_HEIGHT);
if (height <= 0)
{
height = 1;
}
return height;
- */
- return iDisplay.getSourceHeight();
+
+ //return 0;//iDisplay.getSourceHeight();
}
@@ -492,6 +511,14 @@
"initDisplayMode() already called successfully");
}
+ if (aArg != null && aArg.equals(Control.class.getName()))
+ {
+ eswtDisplay = org.eclipse.swt.widgets.Display.getDefault();
+ }
+ else
+ {
+ eswtDisplay = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ }
if (aMode == USE_GUI_PRIMITIVE)
{
Object guiObject = null;
@@ -508,6 +535,20 @@
else // try load dynamic display mode
{
guiObject = initDynamicDisplayMode(aArg);
+
+ iControl = (Control)guiObject;
+
+ iDisplay = new MMAeSWTDisplay(iEventSource, iControl);
+ int handle = initNativeDisplay(iControl, iDisplay, iGuiType);
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: initDisplayMode(): nativeDisplayHandle = " + handle);
+ iDisplay.setNativeHandle(handle);
+ ESWTProxyControl proxyControl = (ESWTProxyControl)iControl;
+ proxyControl.seteSWTDisplay(iDisplay);
+ proxyControl.setNativeDisplayHandle(handle);
+ //display.setWindowResources();
+
+ iStatus = USE_GUI_PRIMITIVE;
+ return iControl;
}
}
@@ -521,7 +562,7 @@
Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
"VideoControl : creation of ItemDisplay");
- int handle = initNativeDisplay(iVideoItem, iDisplay, true);
+ int handle = initNativeDisplay(iVideoItem, iDisplay, DISPLAY_VIDEOITEM);
// here actual listener is added to iDisplay
iDisplay.setNativeHandle(handle);
iVideoItem.setNativeHandle(handle);
@@ -548,13 +589,14 @@
"For USE_DIRECT_VIDEO mode argument should not be null");
}
iVideoCanvas = (Canvas)aArg;
+ iGuiType = DISPLAY_CANVAS;
// MMAPI UI 3.x req.
iDisplay = new MMACanvasDisplay(iEventSource , iVideoCanvas);
Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"VideoControl.java: after eswt control got from canvas has added observer");
- int handle = initNativeDisplay(iVideoCanvas, iDisplay, false);
+ int handle = initNativeDisplay(iVideoCanvas, iDisplay, DISPLAY_CANVAS);
// here actual listener is added to iDisplay
iDisplay.setNativeHandle(handle);
// Window resource initialization is done to the native video player
@@ -593,7 +635,7 @@
* Initializes native display.
*
*/
- private int initNativeDisplay(Object aGuiObject, Object mmadisplay, boolean aGuiType)
+ private int initNativeDisplay(Object aGuiObject, Object mmadisplay, int aGuiType)
{
int handle = _initDisplayMode(iControlHandle,
iEventSource,
@@ -613,7 +655,8 @@
{
return _getControlProperty(iControlHandle,
iEventSource,
- aPropertyType);
+ aPropertyType,
+ iGuiType);
}
/**
@@ -629,7 +672,8 @@
iEventSource,
aParamA,
aParamB,
- aPropertyType);
+ aPropertyType,
+ iGuiType);
}
/**
@@ -643,7 +687,8 @@
iEventSource,
0,
0,
- aPropertyType);
+ aPropertyType,
+ iGuiType);
}
/**
@@ -669,13 +714,23 @@
*/
private Object initDynamicDisplayMode(Object aMode)
{
- MMAGUIFactory guiFactory = null;
+ //MMAGUIFactory guiFactory = null;
try
{
- String className = ((String)aMode).toLowerCase() +
- GUI_FACTORY_CLASS_NAME;
- Class guiClass = Class.forName(className);
- guiFactory = (MMAGUIFactory)guiClass.newInstance();
+ // String className = ((String)aMode).toLowerCase();
+ //GUI_FACTORY_CLASS_NAME;*/
+ Class guiClass = Class.forName((String)aMode);
+ //guiFactory = (MMAGUIFactory)guiClass.newInstance();
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: After loading class");
+ eswtDisplay.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: Before creating ESWTProxyControl.");
+ control = new ESWTProxyControl();
+ Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: VideoControl.java: ESWTProxyControl created.");
+ }
+ });
}
catch (ClassNotFoundException cnfe)
{
@@ -684,19 +739,19 @@
"Mode not supported or invalid, " +
"valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
}
- catch (IllegalAccessException iae)
- {
- // if the class or initializer is not accessible
- throw new IllegalArgumentException("Mode: " + aMode +
- " caused " + iae);
- }
- catch (InstantiationException ie)
- {
- // if an application tries to instantiate an abstract class or an
- // interface, or if the instantiation fails for some other reason
- throw new IllegalArgumentException("Mode: " + aMode +
- " caused " + ie);
- }
+ /* catch (IllegalAccessException iae)
+ {
+ // if the class or initializer is not accessible
+ throw new IllegalArgumentException("Mode: " + aMode +
+ " caused " + iae);
+ }
+ catch (InstantiationException ie)
+ {
+ // if an application tries to instantiate an abstract class or an
+ // interface, or if the instantiation fails for some other reason
+ throw new IllegalArgumentException("Mode: " + aMode +
+ " caused " + ie);
+ }*/
catch (ClassCastException cce)
{
// Thrown to indicate that the code has attempted to cast an
@@ -705,12 +760,13 @@
" caused " + cce);
}
- Object guiObject = guiFactory.initDisplayMode();
+ //Object guiObject = guiFactory.initDisplayMode();
// initNativeDisplay return handle MMMADirectContainer, 0 parameter
// indicates that dynamic display will be used
// MMAPI UI 3.x req.
// guiFactory.setContentHandle(initNativeDisplay(guiObject, 0));
- return guiObject;
+ iGuiType = DISPLAY_ESWT;
+ return control;
}
/**
@@ -871,13 +927,15 @@
private native int _getControlProperty(int aControlHandle,
int aEventSourceHandle,
- int aPropertyType);
+ int aPropertyType,
+ int aGuiType);
private native int _setDisplayProperty(int aControlHandle,
int aEventSourceHandle,
int aParamA,
int aParamB,
- int aPropertyType);
+ int aPropertyType,
+ int aGuiType);
private native int _getSnapshot(int aControlHandle,
int aEventSourceHandle,
@@ -887,7 +945,7 @@
int aEventSourceHandle,
Object aJavaDisplay,
Object aJavaDisplayObject,
- boolean aGuiTYpe);
+ int aGuiTYpe);
private native int _setForeground(int aControlHandle,
int aEventSourceHandle,
int aIsForeground);
--- a/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -70,9 +70,9 @@
void CMMASurfaceWindow::SetDrawRectThread(const TRect& aRect)
{
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRectThread TL %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetDrawRectThread TL %d %d",
aRect.iTl.iX, aRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRectThread BR %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetDrawRectThread BR %d %d",
aRect.iBr.iX, aRect.iBr.iY);
iContentRect = aRect;
@@ -80,16 +80,16 @@
TInt error = StaticRedrawVideo(*this);
if (KErrNone != error)
{
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::SetDrawRectThread, StaticRedrawVideo error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::SetDrawRectThread, StaticRedrawVideo error = %d", error);
}
}
void CMMASurfaceWindow::SetRWindowRect(const TRect& aRect,
MMMADisplay::TThreadType aThreadType)
{
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetRWindowRect TL %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetRWindowRect TL %d %d",
aRect.iTl.iX, aRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetRWindowRect BR %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetRWindowRect BR %d %d",
aRect.iBr.iX, aRect.iBr.iY);
if (iRWindowRect == aRect)
@@ -122,14 +122,14 @@
TInt error = SetClipRect();
if (KErrNone != error)
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect, error = %d", error);
+ LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetRWindowRect, error = %d", error);
}
}
}
TInt CMMASurfaceWindow::SetClipRect()
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetClipRect");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetClipRect");
// CMediaClientVideoDisplay expects client to RemoveDisplayWindow
// and AddDisplayWindow again everytime when RWindow rect changes
@@ -170,7 +170,7 @@
EVerticalAlignCenter,
(RWindow*)iWindow));
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetClipRect -");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetClipRect -");
return error;
}
return KErrNone;
@@ -178,13 +178,13 @@
void CMMASurfaceWindow::SetDrawRect(const TRect& aRect)
{
- LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect TL %d %d",
+ LOG2(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect TL %d %d",
aRect.iTl.iX, aRect.iTl.iY);
- LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect BR %d %d",
+ LOG2(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect BR %d %d",
aRect.iBr.iX, aRect.iBr.iY);
iContentRect = aRect;
- LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect aRect size = (%d,%d) ",iContentRect.Height(),iContentRect.Width());
+ LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect aRect %d",iContentRect);
if (iDisplay)
{
// iDisplay->UIGetCallback( *this,
@@ -199,13 +199,13 @@
{
iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
}
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
}
}
TInt CMMASurfaceWindow::StaticRedrawVideo(CMMASurfaceWindow& aSurfaceWindow)
{
- LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::RedrawVideoL +");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::StaticRedrawVideo +");
TRAPD(error, aSurfaceWindow.RedrawVideoL());
LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::RedrawVideoL - error = %d",error);
return error;
@@ -216,7 +216,7 @@
LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL +");
if (!iMediaClientVideoDisplay)
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -");
return;
}
//iVisible = true;
@@ -225,49 +225,49 @@
TRect contentRect;
if (iVisible)
{
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: if visible true iContentRect = %d X %d",iContentRect.Width(),iContentRect.Height());
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: if visible true iContentRect = %d X %d",iContentRect.Width(),iContentRect.Height());
contentRect = iContentRect;
// ScaleVideoL(contentRect);
}
else
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL - if visible false");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL - if visible false");
TRect emptyRect(0,0,0,0);
contentRect = emptyRect;
}
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before intersection contentRect = %d X %d",contentRect.Width(),contentRect.Height());
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before intersection contentRect = %d X %d",contentRect.Width(),contentRect.Height());
// align parent rect with respect to RWindow
TRect relativeParentRect;
relativeParentRect = iParentRect;
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iTL = %d X %d",iRWindowRect.iTl.iX,iRWindowRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iBr = %d X %d\n\n",iRWindowRect.iBr.iX,iRWindowRect.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iTL = %d X %d",iRWindowRect.iTl.iX,iRWindowRect.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iBr = %d X %d\n\n",iRWindowRect.iBr.iX,iRWindowRect.iBr.iY);
relativeParentRect.Move(-iRWindowRect.iTl);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -after moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iTL = %d X %d",contentRect.iTl.iX,contentRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iBr = %d X %d",contentRect.iBr.iX,contentRect.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -after moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iTL = %d X %d",contentRect.iTl.iX,contentRect.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iBr = %d X %d",contentRect.iBr.iX,contentRect.iBr.iY);
// setting video draw rect and adjusting it to window
TRect drawRect = contentRect;
drawRect.Move(relativeParentRect.iTl);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect = %d X %d",drawRect.Width(),drawRect.Height());
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iTL = %d X %d",drawRect.iTl.iX,drawRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iBr = %d X %d",drawRect.iBr.iX,drawRect.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect = %d X %d",drawRect.Width(),drawRect.Height());
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iTL = %d X %d",drawRect.iTl.iX,drawRect.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iBr = %d X %d",drawRect.iBr.iX,drawRect.iBr.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iTL = %d X %d",iVideoCropRegion.iTl.iX,iVideoCropRegion.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iBr = %d X %d\n\n",iVideoCropRegion.iBr.iX,iVideoCropRegion.iBr.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iTL = %d X %d",iVideoCropRegion.iTl.iX,iVideoCropRegion.iTl.iY);
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iBr = %d X %d\n\n",iVideoCropRegion.iBr.iX,iVideoCropRegion.iBr.iY);
/*TRect temp1(TPoint(127,8),TPoint(255,104));
TRect temp2(TPoint(0,0),TPoint(128,96));
@@ -281,7 +281,7 @@
LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawvideoL() - after setVideoExtentL");
- //LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - areaRect = %d X %d",areaRect.Width(),areaRect.Height() );
+ //LOG2( EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - areaRect = %d X %d",areaRect.Width(),areaRect.Height() );
iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::RedrawvideoL() - after redrawWindows");
@@ -310,35 +310,40 @@
TInt error = StaticRedrawVideo(*this);
if (KErrNone != error)
{
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::SetPosition, StaticRedrawVideo error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::SetPosition, StaticRedrawVideo error = %d", error);
}
}
TBool CMMASurfaceWindow::IsVisible() const
{
- LOG1(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::IsVisible %d ", iVisible);
+ LOG1(EJavaMMAPI, EInfo, "CMMASurfaceWindow::IsVisible %d ", iVisible);
return iVisible;
}
void CMMASurfaceWindow::SetVisible(TBool aVisible, TBool aUseEventServer)
{
- LOG1(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible aVisible %d", aVisible);
+ LOG1(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetVisible aVisible %d", aVisible);
RPointerArray< CMMAPlayer > players = iEventSource->Players();
if (players.Find(iPlayer) != KErrNotFound)
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible : Player found");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetVisible : Player found");
if (aVisible != iVisible)
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible: Changed visibility");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetVisible: Changed visibility");
iVisible = aVisible;
if (aUseEventServer)
{
- TInt error = StaticRedrawVideo(*this);
+ /*TInt error = StaticRedrawVideo(*this);
if (KErrNone != error)
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+ LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+ }*/
+ TRAPD(error,DoSetVisibleL());
+ if (error != KErrNone)
+ {
+ LOG1(EJavaMMAPI, EInfo,"CMMASurfaceWindow::SetVisible,DoSetVisibleL error = %d", error);
}
}
else
@@ -346,9 +351,10 @@
if (iDisplay)
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,calling GetCallbackInUiThread");
- iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,after GetCallbackInUiThread");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible,calling GetCallbackInUiThread");
+ //iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EChangeVisibility);
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible,after GetCallbackInUiThread");
}
@@ -357,11 +363,65 @@
}
}
+void CMMASurfaceWindow::DoSetVisibleL()
+{
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible +");
+ if (iVisible)
+ {
+ TRect contentRect;
+ if (iVisible)
+ {
+ contentRect = iContentRect;
+ }
+ else
+ {
+ TRect emptyRect(0,0,0,0);
+ contentRect = emptyRect;
+ }
+
+ // align parent rect with respect to RWindow
+ TRect relativeParentRect;
+ relativeParentRect = iParentRect;
+ relativeParentRect.Move(-iRWindowRect.iTl);
+
+ // setting video draw rect and adjusting it to window
+ TRect drawRect = contentRect;
+ drawRect.Move(relativeParentRect.iTl);
+
+ TRect clipRect(0,0,iRWindowRect.Width(),iRWindowRect.Height());
+ //iWindow->SetExtentErr(TPoint(127,8),TSize(128,96));
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible:: AddDisplayWindowL");
+ if (iMediaClientVideoDisplay)
+ {
+ iMediaClientVideoDisplay->AddDisplayWindowL(iWindow,
+ clipRect,
+ iVideoCropRegion,
+ drawRect, // video extent
+ 0.0f, // ignore
+ 0.0f, // ignore
+ EVideoRotationNone,
+ EAutoScaleBestFit,
+ EHorizontalAlignCenter,
+ EVerticalAlignCenter,
+ (RWindow*)iWindow);
+ }
+ RedrawVideoL();
+ }
+ else
+ {
+ if (iWindow && iMediaClientVideoDisplay)
+ {
+ iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
+ }
+ }
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible -");
+}
+
void CMMASurfaceWindow::SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType /*aThreadType*/)
{
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetWindowRect aRect TL %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetWindowRect aRect TL %d %d",
aRect.iTl.iX, aRect.iTl.iY);
- LOG2(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetWindowRect aRect BR %d %d",
+ LOG2(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetWindowRect aRect BR %d %d",
aRect.iBr.iX, aRect.iBr.iY);
iParentRect = aRect;
@@ -386,7 +446,7 @@
void CMMASurfaceWindow::SetDisplay(MMMADisplay *aDisplay)
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDisplay +");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetDisplay +");
if (iDisplay != aDisplay)
{
@@ -419,12 +479,12 @@
*/
}
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDisplay -");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::SetDisplay -");
}
void CMMASurfaceWindow::ContainerSet()
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ContainerSet");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ContainerSet");
// We are in UI thread now
// Container was probably not set when
@@ -439,7 +499,7 @@
void CMMASurfaceWindow::Destroy()
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::Destroy");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::Destroy");
// Delete itself
delete this;
}
@@ -451,19 +511,19 @@
iWs = aWs;
iScreenDevice = aScreenDevice;
iWindow = aWindow;
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget");
switch (iVideoDisplayInitState)
{
case EUIResourcesAndSurfaceParametersNotSet:
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -8");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -8");
iVideoDisplayInitState =
EUIResourcesSetAndSurfaceParametersNotSet;
}
break;
case ESurfaceParametersSetAndUIResourcesNotSet:
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -9");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -9");
iVideoDisplayInitState =
EUIResourcesAndSurfaceParametersSet;
}
@@ -473,7 +533,7 @@
case EUIResourcesAndSurfaceParametersSet:
default:
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -10");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -10");
__ASSERT_DEBUG(EFalse, User::Invariant());
}
break;
@@ -481,12 +541,12 @@
if (iVideoDisplayInitState == EUIResourcesAndSurfaceParametersSet)
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -11");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -11");
TRAPD(error, InitVideoDisplayL());
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -12");
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -12");
if (KErrNone != error)
{
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
}
}
@@ -497,7 +557,7 @@
CWsScreenDevice &aScreenDevice,
RWindowBase &aWindow )
{
- LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback" );
+ LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::MdcDSAResourcesCallback" );
// We are in UI thread context now.
iWs = &aWs;
@@ -533,7 +593,7 @@
TRAPD(error, InitVideoDisplayL());
if ( KErrNone != error )
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+ LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
}
}
}
@@ -541,7 +601,7 @@
void CMMASurfaceWindow::UICallback(TInt aCallbackId)
{
// We are in UI thread context now.
- LOG1(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::MdcUICallback CallbackId = %d", aCallbackId);
+ LOG1(EJavaMMAPI, EInfo, "CMMASurfaceWindow::UICallback CallbackId = %d", aCallbackId);
TInt error = KErrNone;
switch (aCallbackId)
@@ -549,25 +609,25 @@
case ESetClipRect:
{
error = SetClipRect();
- LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::MdcUICallback,SetClipRect error = %d", error);
+ LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::UICallback,SetClipRect error = %d", error);
}
break;
case ERemoveSurface:
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::MdcUICallback, ERemoveSurface ");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::UICallback, ERemoveSurface ");
DoRemoveSurface();
}
break;
case ESetDrawRect:
{
error = StaticRedrawVideo(*this);
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,StaticRedrawVideo error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::UICallback,StaticRedrawVideo error = %d", error);
}
break;
case EInitVideoDisplay:
{
TRAP(error, InitVideoDisplayL());
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,InitVideoDisplayL error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::UICallback,InitVideoDisplayL error = %d", error);
}
break;
case ESetChangedSurfaceParameters:
@@ -590,6 +650,15 @@
Destroy();
}
break;
+ case EChangeVisibility:
+ {
+ TRAPD(error,DoSetVisibleL());
+ if (error != KErrNone)
+ {
+ LOG1(EJavaMMAPI, EInfo,"CMMASurfaceWindow::UICallback,DoSetVisibleL error = %d", error);
+ }
+ }
+ break;
default:
{
__ASSERT_DEBUG(EFalse, User::Invariant());
@@ -711,9 +780,9 @@
LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() +");
if (iMediaClientVideoDisplay)
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Removing Surface");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoRemoveSurface, Removing Surface");
iMediaClientVideoDisplay->RemoveSurface();
- LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
}
LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() -");
@@ -731,7 +800,7 @@
iPixelAspectRatio,
iVideoCropRegion);
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::DoResetSurfaceParameters,SurfaceCreated error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::DoResetSurfaceParameters,SurfaceCreated error = %d", error);
iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
}
@@ -745,7 +814,7 @@
iCropRect,
iPixelAspectRatio);
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::DoSetChangedSurfaceParameters,SurfaceParametersChanged, error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::DoSetChangedSurfaceParameters,SurfaceParametersChanged, error = %d", error);
iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
}
@@ -789,7 +858,7 @@
iPixelAspectRatio,
iVideoCropRegion);
- ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::InitVideoDisplayL error = %d", error);
+ ELOG1(EJavaMMAPI, "CMMASurfaceWindow::InitVideoDisplayL error = %d", error);
User::LeaveIfError(error);
TRect contentRect;
@@ -833,7 +902,7 @@
void CMMASurfaceWindow::CleanVideoDisplay()
{
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::CleanVideoDisplay +");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::CleanVideoDisplay +");
SetVisible(EFalse, ETrue);
if (iMediaClientVideoDisplay)
@@ -851,7 +920,7 @@
iWs = NULL;
}
- LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::CleanVideoDisplay -");
+ LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::CleanVideoDisplay -");
}
--- a/javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -103,7 +103,7 @@
// *this, CMMACameraWindow::EShowViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EShowViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread - EShowViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : after GetCallbackInUiThread - EShowViewFinder");
}
else
{
@@ -111,7 +111,7 @@
// *this, CMMACameraWindow::EHideViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EHideViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread - EHideViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : after GetCallbackInUiThread - EHideViewFinder");
}
}
}
@@ -150,7 +150,7 @@
//MMAPI UI 3.x req.
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread +");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EDeleteViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread -");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : after GetCallbackInUiThread -");
}
// Set the new Display
@@ -212,7 +212,7 @@
//iDisplay->UIGetCallback(*this, CMMACameraWindow::EResetViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread + EResetViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EResetViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread - EResetViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : after GetCallbackInUiThread - EResetViewFinder");
}
}
@@ -308,7 +308,7 @@
// *this, CMMACameraWindow::EShowViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EShowViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EShowViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : after GetCallbackInUiThread - EShowViewFinder");
}
else
{
@@ -316,7 +316,7 @@
// *this, CMMACameraWindow::EHideViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EHideViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EHideViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : after GetCallbackInUiThread - EHideViewFinder");
}
}
}
@@ -352,7 +352,7 @@
// *this, CMMACameraWindow::EResetViewFinder);
LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread + EResetViewFinder");
iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
- LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread - EResetViewFinder");
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : after GetCallbackInUiThread - EResetViewFinder");
}
}
--- a/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -170,24 +170,31 @@
iFullScreen = aFullScreen;
if (iContainerVisible)
{
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL widht=%d height=%d", iFullScreenSize.iWidth,
+ iFullScreenSize.iHeight);
RemoveClippingRegion();
-
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL widht=%d height=%d", iFullScreenSize.iWidth,
+ iFullScreenSize.iHeight);
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL::iSourceSize widht=%d height=%d", iSourceSize.iWidth,
+ iSourceSize.iHeight);
if (aFullScreen)
{
// use new scaled rect
// iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
- iWindow->SetDrawRectThread(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL - true scale to fullscreen");
+ iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
}
else
{
// use size set from java
- //iWindow->SetDrawRect(iUserRect);
- iWindow->SetDrawRectThread(iUserRect);
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL - false - draw the user rect set previously");
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL iUserRect = (%d,%d) ",iUserRect.Width(),iUserRect.Height());
+ iWindow->SetDrawRect(iUserRect);
}
AddClippingRegion();
}
- LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL +");
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL -");
}
void CMMACanvasDisplay::SetWindowL(MMMADisplayWindow* aWindow)
@@ -270,7 +277,7 @@
TPoint topleft(xcoordinate,ycoordinate);
TSize rectsize(width,height);
TRect boundRect(topleft,rectsize);
- iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr, JNI_COMMIT);
+ iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr,0);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect -");
return boundRect;
}
--- a/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -50,16 +50,59 @@
iFullScreen(EFalse),
iContainerVisible(ETrue),
iIsForeground(ETrue),
- iResetDrawRect(EFalse)
+ iResetDrawRect(EFalse),
+ iIseSWT(EFalse)
{
}
-void CMMADisplay::Construct(MMAFunctionServer* eventSource , jobject javadisplayref)
+void CMMADisplay::Construct(MMAFunctionServer* eventSource ,JNIEnv* aJni, jobject javadisplayref)
{
iEventSource = eventSource;
- iJni = iEventSource->getValidJniEnv();
+ iJavadisplayref = javadisplayref;
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct=%d",iIseSWT);
+ if (iIseSWT)
+ {
+ iJni = aJni;
+ }
+ else
+ {
+ iJni = iEventSource->getValidJniEnv();
+ }
iJavaDisplayObject = iJni->NewGlobalRef(javadisplayref);
iJavaDisplayClass = iJni->GetObjectClass(iJavaDisplayObject);
+
+ setRectID = iJni->GetMethodID(iJavaDisplayClass,
+ "setRect",
+ "()V");
+ iRectDimensionField = iJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
+
+ redrawControlID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "redrawControl",
+ "()V");
+
+ removeContentBoundID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "removeContentBound",
+ "()V");
+
+ setContentBoundID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "setContentBound",
+ "()V");
+
+ getCallBackMethodID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "GetCallbackInUiThread",
+ "(I)V");
+
+ getBoundRectID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getBoundRect",
+ "()V");
+
+ iDisplayboundarrField = iJni->GetFieldID(iJavaDisplayClass, "displayboundarr", "[I");
+
// Components must have direct content.
/* __ASSERT_LOG(EJavaMMAPI,EInfo,"aDirectContainer, User::Invariant());
@@ -69,8 +112,8 @@
// Get component visibility. Later visibility changes will
// be informed through MDirectContent observer.
iContainerVisible = iDirectContainer->MdcContainerVisibility();
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iVisible = %d", iVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iVisible = %d", iVisible);
// Add this MDirectContent to the MDirectContainer. Cannot fail.
iDirectContainer->MdcAddContent(this);
@@ -123,6 +166,7 @@
}
drawRect.Move(position);
+ LOG2(EJavaMMAPI, EInfo, "CMMADisplay::ScaleToFullScreen::drawRect.Width=%d, drawRect.Height=%d",drawRect.Width(), drawRect.Height());
LOG(EJavaMMAPI,EInfo,"CMMADisplay::ScaleToFullScreen() -");
return drawRect;
}
@@ -158,6 +202,7 @@
{
LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: Removing old rect");
//iDirectContainer->MdcRemoveContentBounds(iClipRect);
+ RemoveContentBoundFromJavaControl(iClipRect);
iClipRect.SetRect(0, 0, 0, 0);
refreshScreen = ETrue;
}
@@ -243,12 +288,15 @@
// from MMMADisplay
TSize CMMADisplay::DisplaySize()
{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize +");
if (iWindow && iFullScreen)
{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize if loop ");
return iWindow->DrawRect().Size();
}
else
{
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize else loop %d",iUserRect.Size().iHeight);
return iUserRect.Size();
}
}
@@ -258,21 +306,21 @@
{
// user rect contains size set from java.
iUserRect.SetSize(aSize);
- LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect = %d X %d", iUserRect.Width() ,iUserRect.Height());
// Size change has no effect if fullscreen mode is on.
// New size could be used when fullscreen is turned off.
if (iContainerVisible && !iFullScreen && iWindow)
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
RemoveClippingRegion();
- LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after removingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect after removingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
iWindow->SetDrawRect(iUserRect);
AddClippingRegion();
- LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after AddingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect after AddingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
}
else
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
iResetDrawRect = ETrue;
}
}
@@ -283,11 +331,11 @@
iVisible = aValue;
// Window may be set visible only if container is on screen,
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible iVisible = %d", iVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible iVisible = %d", iVisible);
if (!iIsForeground)
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible - iIsForeground = 0");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible - iIsForeground = 0");
return;
}
// if not it can not be set visible.
@@ -295,9 +343,17 @@
{
// iWindow->SetVisible(aValue, EFalse);
//MMAPI UI 3.x req. (had to comment above line and add below line which excutes in FS thread)
- iWindow->SetVisible(aValue, ETrue);
+ if (iIseSWT == true)
+ {
+ iWindow->SetVisible(aValue, ETrue);
+ }
+ else
+ {
+ iWindow->SetVisible(aValue, EFalse);
+ }
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible after iWindow->SetVisible()");
SetClippingRegion();
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible -");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible -");
}
}
@@ -328,8 +384,8 @@
TBool CMMADisplay::IsVisible()
{
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible);
- LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iVisible = %d", iVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::IsVisible iVisible = %d", iVisible);
// display is visible if container is on screen and
// java side has set it visible
return iVisible && iContainerVisible;
@@ -366,33 +422,36 @@
if (aVisible != iWindow->IsVisible())
{
// Allow
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged Allow ");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged Allow ");
}
else if (iContainerVisible == aVisible)
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible ");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible ");
// if state is not changed, we do not need to do it again
return;
}
}
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged After condition2");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged After condition2");
if (iWindow)
{
- LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iWindow is valid ");
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged iWindow is valid ");
// change is only needed if java side has set display visible or
// if container loses focus
if (!iContainerVisible || iVisible)
{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged container is invisible and window is visible");
if (iResetDrawRect && aVisible && !iFullScreen)
{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged resetdrawrect is true");
iWindow->SetDrawRectThread(iUserRect);
iResetDrawRect = EFalse;
}
if (iIsForeground)
{
- iWindow->SetVisible(aVisible);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged container foreground is true");
+ iWindow->SetVisible(aVisible,false);
}
SetClippingRegion();
}
@@ -468,21 +527,31 @@
void CMMADisplay::GetCallbackInUiThread(TInt placeholder)
{
+ JNIEnv* validJni = iEventSource->getValidJniEnv();
+ jobject javaDisplayObject;
+ jclass javaDisplayClass;
LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread +");
-
-
-
-
-
-
-
-
- jmethodID getCallBackMethodID = iJni->GetMethodID(
- iJavaDisplayClass,
- "GetCallbackInUiThread",
- "(I)V");
- // LOG1(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
- iJni->CallVoidMethod(iJavaDisplayObject,getCallBackMethodID,placeholder);
+ /**
+ * In case of eSWT iJavaDisplayClass and iJavaDisplayObject were initialized with JNI
+ * in UI Thread. Since this function is called from FunctionServer Thread so we need to get
+ * valid JNI for FunctionServer Thread and need to initialize iJavaDisplayClass and iJavaDisplayObject
+ * again for FunctionServer Thread rather than using the one that was created in Constructor(UI Thread).
+ */
+ if (iIseSWT)
+ {
+ javaDisplayObject = validJni->NewGlobalRef(iJavadisplayref);
+ javaDisplayClass = validJni->GetObjectClass(iJavaDisplayObject);
+ }
+ else
+ {
+ javaDisplayObject = iJavaDisplayObject;
+ javaDisplayClass = iJavaDisplayClass;
+ }
+ getCallBackMethodID = validJni->GetMethodID(javaDisplayClass,
+ "GetCallbackInUiThread",
+ "(I)V");
+ LOG1(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
+ validJni->CallVoidMethod(javaDisplayObject,getCallBackMethodID,placeholder);
LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread -");
}
@@ -514,6 +583,7 @@
return;
}
iWindow->ProcureWindowResourcesFromQWidget(iWs,iScreenDevice,window);
+ iWindow->SetVisible(ETrue,ETrue);
LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources -");
}
@@ -629,27 +699,28 @@
void CMMADisplay::ResetJavaRectObject(const TRect& aRect)
{
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject +");
- JNIEnv* validJni = iEventSource->getValidJniEnv();
- jmethodID setRectID = validJni->GetMethodID(
- iJavaDisplayClass,
- "setRect",
- "()V");
-
+ //TRect rect = aRect;
+ JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
+ /*jmethodID setRectID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "setRect",
+ "()V");
+ */
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --1");
// set the value to java,so that we can access those from array
- jfieldID field = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
- if (field == NULL)
+
+ //jfieldID iRectDimensionField = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
+ if (iRectDimensionField == NULL)
{
// handle error
}
/* Write to the instance fields */
- jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, field);
+ jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, iRectDimensionField);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --2");
jint* nativeRectDimensionArr = validJni->GetIntArrayElements(javaDimensionarr, NULL);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --3");
if (!nativeRectDimensionArr)
- {
- // inputBuffer was already allocated
+ { // inputBuffer was already allocated
validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_ABORT);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject Error in resetting rect dimension to java");
return;
@@ -659,9 +730,10 @@
nativeRectDimensionArr[2] = aRect.Width();
nativeRectDimensionArr[3] = aRect.Height();
// Now the dimension array in java is updated hence reset the java rect
+
+ validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, 0);
validJni->CallVoidMethod(iJavaDisplayObject,setRectID);
- validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_COMMIT);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject -");
}
@@ -669,13 +741,14 @@
void CMMADisplay::SetContentBoundToJavaControl(const TRect& aRect)
{
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl +");
- JNIEnv* validJni = iEventSource->getValidJniEnv();
+ JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
// Reset the java rect
ResetJavaRectObject(aRect);
- jmethodID setContentBoundID = validJni->GetMethodID(
- iJavaDisplayClass,
- "setContentBound",
- "()V");
+ /*jmethodID setContentBoundID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "setContentBound",
+ "()V");
+ */
// call java function
validJni->CallVoidMethod(iJavaDisplayObject,setContentBoundID);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl -");
@@ -684,13 +757,14 @@
void CMMADisplay::RemoveContentBoundFromJavaControl(const TRect& aRect)
{
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl +");
- JNIEnv* validJni = iEventSource->getValidJniEnv();
+ JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();
// Reset the java rect
ResetJavaRectObject(aRect);
- jmethodID removeContentBoundID = validJni->GetMethodID(
+ /*jmethodID removeContentBoundID = validJni->GetMethodID(
iJavaDisplayClass,
"removeContentBound",
- "()V");
+ "()V");
+ */
// call java function
validJni->CallVoidMethod(iJavaDisplayObject,removeContentBoundID);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl -");
@@ -699,16 +773,26 @@
void CMMADisplay::RefreshJavaControl()
{
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl +");
- JNIEnv* validJni = iEventSource->getValidJniEnv();
+ JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
// Reset the java rect
//ResetJavaRectObject(aRect);
- jmethodID redrawControlID = validJni->GetMethodID(
- iJavaDisplayClass,
- "redrawControl",
- "()V");
+ /*jmethodID redrawControlID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "redrawControl",
+ "()V");
+ */
// call java function
validJni->CallVoidMethod(iJavaDisplayObject,redrawControlID);
LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl -");
}
+TBool CMMADisplay::iseSWT()
+{
+ return iIseSWT;
+}
+
+void CMMADisplay::SetFullscreenSize(TSize &aFullscreenSize)
+{
+ iFullScreenSize = aFullscreenSize;
+}
// END OF FILE
--- a/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -334,7 +334,7 @@
case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE:
{
TSize displaySize(aPropertyA, aPropertyB);
- LOG2(EJavaMMAPI, EInfo, "CMMAVideoControl::statepropertyl %d , %d",displaySize.iHeight,displaySize.iWidth);
+ LOG1(EJavaMMAPI, EInfo, "CMMAVideoControl::statepropertyl %d",displaySize);
display->SetDisplaySizeL(displaySize);
LOG(EJavaMMAPI, EInfo, "CMMAVideoControl::SetDisplayProperty:: setDisplaySizeL Completed");
// inform java side
@@ -370,27 +370,25 @@
aPropertyA);
LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d",
aPropertyB);
- //TSize fullscreenSize(aPropertyA, aPropertyB);
- //display->SetFullscreenSize(fullscreenSize);
- //display->SetDisplaySizeL(fullscreenSize);
- //display->SetFullScreenL(ETrue);
- display->SourceSizeChanged(aPropertyA, aPropertyB,0,0,TRect(0,0,0,0));
+ TSize fullscreenSize(aPropertyA, aPropertyB);
+ display->SetFullscreenSize(fullscreenSize);
+ //display->SetDisplaySizeL(fullsclreenSize);
+ display->SetFullScreenL(ETrue);
+ //display->SourceSizeChanged(aPropertyA, aPropertyB,0,0,TRect(0,0,0,0));
break;
}
case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE:
{
- TSize fullscreenSize = aControl->iOldDisplaySize;
- display->SetFullscreenSize(fullscreenSize);
display->SetFullScreenL(EFalse);
// Send SIZE_CHANGED event when fullscreen is turned off if
// size of the video display has changed. Possible position
// change is however disregarded
- /* if (aControl->iOldDisplaySize != display->DisplaySize())
- {
- aControl->iGuiPlayer->NotifyWithStringEvent(
- CMMAPlayerEvent::ESizeChanged, KControlName);
- }*/
+ if (aControl->iOldDisplaySize != display->DisplaySize())
+ {
+ aControl->iGuiPlayer->NotifyWithStringEvent(
+ CMMAPlayerEvent::ESizeChanged, KControlName);
+ }
break;
}
--- a/javauis/mmapi_qt/baseline/src/itemdisplayjni.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/itemdisplayjni.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -37,15 +37,20 @@
LOG(EJavaMMAPI,EInfo,"ItemDisplayJni : setVisible -");
}
+LOCAL_C void LocalSetContainerVisible(CMMADisplay* display,TBool visible)
+{
+ display ->SetContainerVisibility(visible);
+}
JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_ItemDisplay__1setContainerVisible
-(JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isActive)
+(JNIEnv *, jobject, jint aEventSourceHandle,jint nativeDisplayHandle, jboolean aIsActive)
{
LOG(EJavaMMAPI,EInfo,"ItemDisplayJni : setContainerVisible +");
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
- TBool visible = (TBool)isActive;
- display ->SetContainerVisibility(visible);
- LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setContainerVisible -");
+ TBool visible = (TBool)aIsActive;
+ eventSource->ExecuteTrap(&LocalSetContainerVisible,display,visible);
+ LOG(EJavaMMAPI,EInfo,"itemdisplayjni.cpp : setContainerVisible -");
}
JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_ItemDisplay__1setFullScreenMode
@@ -96,7 +101,7 @@
TInt b = formbounds[1];
TInt w = formbounds[2];
TInt h = formbounds[3];
- aJni->ReleaseIntArrayElements(aFormArray,formbounds,JNI_COMMIT);
+ aJni->ReleaseIntArrayElements(aFormArray,formbounds,0);
TRect formRect(TPoint(a,b),TPoint(w,h));
MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
// need to call in Function server thread context because CMMADisplay's JNI pointer
--- a/javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp Fri Jul 23 12:27:20 2010 +0300
@@ -77,8 +77,8 @@
outputBufferSize, // returns readed size
&readStatus);
- aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, JNI_COMMIT);
- aJni->ReleaseIntArrayElements(aOutputBufferSize, outputBufferSize, JNI_COMMIT);
+ aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, 0);
+ aJni->ReleaseIntArrayElements(aOutputBufferSize, outputBufferSize, 0);
if (err != KErrNone)
{
--- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/build.xml Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/build.xml Fri Jul 23 12:27:20 2010 +0300
@@ -28,7 +28,7 @@
<property name="midlet.permissions" value=""/>
<property name="package.name" value="Midp_StringItem_01"/>
<property name="company.name" value="Nokia"/>
- <property name="midlet.version" value="1.1"/>
+ <property name="midlet.version" value="1.2"/>
<property name="midlet.description" value=""/>
<!-- Get settings for a basic MIDlet. -->
--- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java Fri Jul 23 12:27:20 2010 +0300
@@ -62,9 +62,11 @@
//the command to create the StringItem with the entered label and text and with focus
private Command cmdCreateHL = new Command("Create as Hyperlink", Command.SCREEN, 1);
+ private Command cmdCreateHLM = new Command("Create as Hyperlink 2 cmds", Command.SCREEN, 1);
//the command to create the StringItem with the entered label and text and with focus
private Command cmdCreateButton = new Command("Create as Button", Command.SCREEN, 1);
+ private Command cmdCreateButtonM = new Command("Create as Button 2 cmds", Command.SCREEN, 1);
//the command to unlock the Item
private Command cmdUnlock = new Command("Unlock", Command.SCREEN, 1);
@@ -97,6 +99,11 @@
private Command cmdNext = new Command("Next", Command.SCREEN, 1);
private Command cmdExit = new Command("Exit", Command.EXIT, 1);
+ // commands for the form
+ private Command cmdItemF = new Command("ItemF", Command.ITEM, 1);
+ private Command cmdOkF = new Command("OkF", Command.OK, 1);
+ private Command cmdScreenF = new Command("Add form commands", Command.SCREEN, 1);
+
static int change = -1;
public FormStringItemTests(Midp_StringItem_01 m)
@@ -118,7 +125,9 @@
append(cg);
addCommand(cmdCreate);
addCommand(cmdCreateHL);
+ addCommand(cmdCreateHLM);
addCommand(cmdCreateButton);
+ addCommand(cmdCreateButtonM);
addCommand(cmdLayout);
addCommand(cmdLayoutHL);
addCommand(cmdLayoutButton);
@@ -134,6 +143,7 @@
//create StringItemForm
stringItemForm = new Form("StringItem");
stringItemForm.addCommand(cmdBack);
+ stringItemForm.addCommand(cmdScreenF);
stringItemForm.setCommandListener(this);
}
@@ -223,39 +233,27 @@
}
else if (c == cmdLayout)
{
-
layoutTest(Item.PLAIN);
-
}
else if (c == cmdLayoutHL)
{
-
layoutTest(Item.HYPERLINK);
-
}
else if (c == cmdLayoutButton)
{
-
layoutTest(Item.BUTTON);
-
}
else if (c == cmdVLayout)
{
-
verticalLayoutTest(Item.PLAIN);
-
}
else if (c == cmdVLayoutHL)
{
-
verticalLayoutTest(Item.HYPERLINK);
-
}
else if (c == cmdVLayoutButton)
{
-
verticalLayoutTest(Item.BUTTON);
-
}
else if (c == cmdAddListeners)
{
@@ -272,6 +270,11 @@
m.destroyApp(false);
m.notifyDestroyed();
}
+ else if (c == cmdScreenF)
+ {
+ stringItemForm.addCommand(cmdItemF);
+ stringItemForm.addCommand(cmdOkF);
+ }
else
{
String l = label.getString();
@@ -282,12 +285,12 @@
if (c == cmdCreate)
si = new StringItem(l, t);
- else if (c == cmdCreateHL)
+ else if (c == cmdCreateHL || c == cmdCreateHLM)
{
si = new StringItem(l, t, Item.HYPERLINK);
si.setDefaultCommand(cmdItem);
}
- else if (c == cmdCreateButton)
+ else if (c == cmdCreateButton || c == cmdCreateButtonM)
{
si = new StringItem(l, t, Item.BUTTON);
si.setDefaultCommand(cmdItem);
@@ -352,6 +355,10 @@
stringItemForm.addCommand(cmdRemoveCommand);
stringItemForm.addCommand(cmdRestoreCommand);
stringItemForm.addCommand(cmdRemoveItem);
+ if (c == cmdCreateButtonM || c == cmdCreateHLM)
+ {
+ si.addCommand(cmdBack);
+ }
Display.getDisplay(m).setCurrent(stringItemForm);
}
}
--- a/rom/java_3_1.iby Fri Jul 09 16:35:45 2010 +0300
+++ b/rom/java_3_1.iby Fri Jul 23 12:27:20 2010 +0300
@@ -78,8 +78,8 @@
// Launchers
file=ABI_DIR\BUILD_DIR\javalauncher.exe PROGRAMS_DIR\javalauncher.exe
-ECOM_PLUGIN(javaappschemeplugin.dll,javaappschemeplugin.rsc)
-data=ZRESOURCE\plugins\javaappschemeplugin.rsc ECOM_RESOURCE_DIR\javaappschemeplugin.rsc
+file=ABI_DIR\BUILD_DIR\javaappscheme.exe PROGRAMS_DIR\javaappscheme.exe
+file=ABI_DIR\BUILD_DIR\javaqtrequest.exe PROGRAMS_DIR\javaqtrequest.exe
#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
// Usif installer plugin