Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2001-07-10 15:50:50 -0400
committerVeronika Irvine2001-07-10 15:50:50 -0400
commit33bede9bca7b3133dd11674be462364ea93b7387 (patch)
tree9efcf37be388df3a2a4c6b7056a3983ca751744a
parent556a3bc70217dbe163baf385f4c00986a12dcb70 (diff)
downloadeclipse.platform.swt-33bede9bca7b3133dd11674be462364ea93b7387.tar.gz
eclipse.platform.swt-33bede9bca7b3133dd11674be462364ea93b7387.tar.xz
eclipse.platform.swt-33bede9bca7b3133dd11674be462364ea93b7387.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c112
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhClipHeader.java3
8 files changed, 114 insertions, 49 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
index 46fd39e656..3294570fae 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
@@ -51,6 +51,7 @@ public Object getContents(Transfer transfer) {
int ig = OS.PhInputGroup(0);
int cbdata = OS.PhClipboardPasteStart((short)ig);
+ if (cbdata == 0) return result;
try {
String[] types = transfer.getTypeNames();
int[] ids = transfer.getTypeIds();
@@ -85,7 +86,8 @@ public void setContents(Object[] data, Transfer[] transferAgents){
int status = -1;
int ig = OS.PhInputGroup(0);
- //PhClipHeader[] clips = new PhClipHeader[0];
+ byte[] clips = new byte[0];
+ int count = 0;
for (int i = 0; i < transferAgents.length; i++) {
String[] names = transferAgents[i].getTypeNames();
int[] ids = transferAgents[i].getTypeIds();
@@ -107,12 +109,20 @@ public void setContents(Object[] data, Transfer[] transferAgents){
clip.type_5 = type[5];
clip.type_6 = type[6];
clip.type_7 = type[7];
+ count++;
byte[] buffer = new byte[PhClipHeader.sizeof];
OS.memmove(buffer, clip, PhClipHeader.sizeof);
- status = OS.PhClipboardCopy((short)ig, 1, buffer);
+ byte[] newClips = new byte[clips.length + buffer.length];
+ System.arraycopy(clips, 0, newClips, 0, clips.length);
+ System.arraycopy(buffer, 0, newClips, clips.length, buffer.length);
+ clips = newClips;
}
}
+ if (count > 0){
+ status = OS.PhClipboardCopy((short)ig, count, clips);
+ }
+
if (status != 0)
DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
}
@@ -147,8 +157,6 @@ public String[] getAvailableTypeNames() {
System.arraycopy(types, 0, newTypes, 0, types.length);
newTypes[types.length] = new String (unicode);
types = newTypes;
-System.out.println("pClipHeader = "+pClipHeader);
-System.out.println("clipHeader.data = "+clipHeader.data);
}
} finally {
OS.PhClipboardPasteFinish(cbdata);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
index 54044a03f1..89d54947b3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
@@ -8,7 +8,7 @@ package org.eclipse.swt.dnd;
public class FileTransfer extends ByteArrayTransfer {
private static FileTransfer _instance = new FileTransfer();
- private static final String TYPENAME = "text/uri-list\0";
+ private static final String TYPENAME = "files";
private static final int TYPEID = registerType(TYPENAME);
private FileTransfer() {}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
index d36e6562b0..2a44359fb5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
@@ -1,5 +1,6 @@
package org.eclipse.swt.dnd;
+import org.eclipse.swt.internal.Converter;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved
@@ -8,12 +9,8 @@ package org.eclipse.swt.dnd;
public class RTFTransfer extends ByteArrayTransfer {
private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
+ private static final String TYPENAME = "RTF";
+ private static final int TYPEID = registerType(TYPENAME);
private RTFTransfer() {
}
@@ -22,21 +19,21 @@ public static RTFTransfer getInstance () {
}
public void javaToNative (Object object, TransferData transferData){
if (object == null || !(object instanceof String)) return;
-
- String text = (String)object;
- super.javaToNative(text.getBytes(), transferData);
+ byte [] buffer = Converter.wcsToMbcs (null, (String)object, true);
+ super.javaToNative(buffer, transferData);
}
public Object nativeToJava(TransferData transferData){
- // get byte array from super
+ /// get byte array from super
byte[] buffer = (byte[])super.nativeToJava(transferData);
if (buffer == null) return null;
// convert byte array to a string
- return new String(buffer);
+ char [] unicode = Converter.mbcsToWcs (null, buffer);
+ return new String (unicode);
}
protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
+ return new String[]{TYPENAME};
}
protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
+ return new int[]{TYPEID};
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
index 127581185f..c591188e6b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
@@ -12,7 +12,7 @@ public class TextTransfer extends ByteArrayTransfer {
private static TextTransfer _instance = new TextTransfer();
private static final String TYPENAME = "TEXT";
- private static final int TYPEID = 10;
+ private static final int TYPEID = registerType(TYPENAME);
private TextTransfer() {
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
index 3634d3576d..95d9283f6b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
@@ -13,6 +13,9 @@ abstract protected int[] getTypeIds();
abstract protected void javaToNative (Object object, TransferData transferData);
abstract protected Object nativeToJava(TransferData transferData);
public static int registerType(String formatName){
+ if (formatName == "TEXT") return 10;
+ if (formatName == "files") return 11;
+ if (formatName == "RTF") return 12;
return 0;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
index e65871967a..11c852870e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
@@ -6520,30 +6520,62 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgGetVideoModeInf
* Class: org_eclipse_swt_internal_photon_OS
* Method: PhClipboardCopy
* Signature: (SI[B)I
- */
+ */
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardCopy
(JNIEnv *env, jclass that, jshort ig, jint n, jbyteArray clip)
-{
- jbyte *clip1=NULL;
- jint result;
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "PhClipboardCopy\n");
-#endif
-
- if (clip) {
- clip1 = (char *)(*env)->GetByteArrayElements(env, clip, NULL);
- }
-
- result = (jint)PhClipboardCopy(ig, n, (PhClipHeader const *)clip1);
-
- if (clip) {
- (*env)->ReleaseByteArrayElements(env, clip, (jbyte *)clip1, 0);
- }
-
- return result;
-
-}
-
+{
+ jbyte *clip1;
+ jint result;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "PhClipboardCopy\n");
+#endif
+
+ if (clip) {
+ clip1 = (*env)->GetByteArrayElements(env, clip, NULL);
+ }
+
+ result = (jint)PhClipboardCopy(ig, n, (PhClipHeader const *)clip1);
+
+ if (clip) {
+ (*env)->ReleaseByteArrayElements(env, clip, clip1, 0);
+ }
+
+ return result;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_photon_OS
+ * Method: PhClipboardCopy
+ * Signature: (SILorg.eclipse.swt.internal.photon.PhClipHeader;)I
+ */
+ /*
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhClipboardCopy
+ (JNIEnv *env, jclass that, jshort ig, jint n, jobject clip)
+{
+ DECL_GLOB(pGlob)
+ PhClipHeader clip1, *lpclip1=NULL;
+ jint result;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "PhClipboardCopy\n");
+#endif
+
+ if (clip) {
+ lpclip1 = &clip1;
+ cachePhClipHeaderFids(env, clip, &PGLOB(PhClipHeaderFc));
+ getPhClipHeaderFields(env, clip, lpclip1, &PGLOB(PhClipHeaderFc));
+ }
+ result = (jint)PhClipboardCopy(ig, n, (PhClipHeader const *)lpclip1);
+
+printf("PhClipHeader size of struct is %d\n", sizeof(clip1));
+
+ if (clip) {
+ setPhClipHeaderFields(env, clip, lpclip1, &PGLOB(PhClipHeaderFc));
+ }
+ return result;
+}
+*/
/*
* Class: org_eclipse_swt_internal_photon_OS
* Method: PhClipboardPasteStart
@@ -6645,7 +6677,7 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_ecl
* Method: memmove
* Signature: ([BLorg/eclipse/swt/internal/photon/PhClipHeader;I)V
*/
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__BLorg_eclipse_swt_internal_photon_PhClipHeader_2I
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I
(JNIEnv *env, jobject that, jbyteArray dest, jobject src, jint count)
{
DECL_GLOB(pGlob)
@@ -6653,22 +6685,46 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__BLorg_ec
PhClipHeader object, *src1= NULL;
#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "memmove__BLorg_eclipse_swt_internal_photon_PhClipHeader_2I\n");
+ fprintf(stderr, "memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I\n");
#endif
if (src) {
src1=&object;
- cachePhClipHeaderFids(env, src, &pGlob(PhClipHeaderFc));
- getPhClipHeaderFields(env, src, src1, &pGlob(PhClipHeaderFc));
+ cachePhClipHeaderFids(env, src, &PGLOB(PhClipHeaderFc));
+ getPhClipHeaderFields(env, src, src1, &PGLOB(PhClipHeaderFc));
}
if (dest) {
- dest1 = (void)(*env)->GetByteArrayElements(env, dest, NULL);
+ dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
}
memmove((void *)dest1, (void *)src1, count);
- if (dest) {
+ if (dest) {
(*env)->ReleaseByteArrayElements(env, dest, (jbyte *)dest1, 0);
}
+}
+
+/*
+ * Class: org_eclipse_swt_internal_photon_OS
+ * Method: memmove
+ * Signature: (ILorg/eclipse/swt/internal/photon/PhClipHeader;I)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove___ILorg_eclipse_swt_internal_photon_PhClipHeader_2I
+ (JNIEnv *env, jobject that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ PhClipHeader object, *src1= NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove___3BLorg_eclipse_swt_internal_photon_PhClipHeader_2I\n");
+#endif
+
+ if (src) {
+ src1=&object;
+ cachePhClipHeaderFids(env, src, &PGLOB(PhClipHeaderFc));
+ getPhClipHeaderFields(env, src, src1, &PGLOB(PhClipHeaderFc));
+ }
+
+ memmove((void *)dest, (void *)src1, count);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
index 595cf5e094..fb899c3e74 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
@@ -2934,7 +2934,7 @@ public static final native void PgGetVideoMode (PgDisplaySettings_t settings);
public static final native void PgGetVideoModeInfo (short mode_number, PgVideoModeInfo_t mode_info);
public static final native void memmove (PhClipHeader dest, int src, int size);
-//public static final native void memmove (int dest, PhClipHeader src, int size);
+public static final native void memmove (int dest, PhClipHeader src, int size);
public static final native void memmove (byte[] dest, PhClipHeader src, int size);
public static final native int PhClipboardCopyString (short ig, byte [] string);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhClipHeader.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhClipHeader.java
index 45a9a577ea..4de5386f95 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhClipHeader.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhClipHeader.java
@@ -11,9 +11,10 @@ public class PhClipHeader {
public byte type_6;
public byte type_7;
public short length;
+ public short zero;
public int data;
- public static final int sizeof = 14;
+ public static final int sizeof = 16;
}

Back to the top