summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2008-07-23 14:37:31 +0000
committerSilenio Quarti <silenio>2008-07-23 14:37:31 +0000
commit389adb00dc3aaa9a8f5a87ca149390abf76b86aa (patch)
tree9248cd7612b113eb91064976e69663e091cd4cec /bundles
parent8f175c0902b6952b9ad454b26d734bc7107ccafe (diff)
downloadeclipse.platform.swt-389adb00dc3aaa9a8f5a87ca149390abf76b86aa.tar.gz
eclipse.platform.swt-389adb00dc3aaa9a8f5a87ca149390abf76b86aa.tar.xz
eclipse.platform.swt-389adb00dc3aaa9a8f5a87ca149390abf76b86aa.zip
showing only one print dialog
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_custom.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/carbon/org/eclipse/swt/printing/PrintDialog.java119
7 files changed, 110 insertions, 61 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
index 44aafd39e8..8ef6b8a016 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
@@ -4037,6 +4037,13 @@ OS_PMSetPageRange_0=cast=(PMPrintSettings)
OS_PMSetPageRange_1=cast=(UInt32)
OS_PMSetPageRange_2=cast=(UInt32)
+OS_PMShowPrintDialogWithOptions=flags=dynamic
+OS_PMShowPrintDialogWithOptions_0=
+OS_PMShowPrintDialogWithOptions_1=
+OS_PMShowPrintDialogWithOptions_2=
+OS_PMShowPrintDialogWithOptions_3=
+OS_PMShowPrintDialogWithOptions_4=
+
OS_PMUnflattenPageFormat=
OS_PMUnflattenPageFormat_0=cast=Handle
OS_PMUnflattenPageFormat_1=cast=PMPageFormat *
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
index 2ee7906b2a..680f0a7698 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
@@ -10806,6 +10806,39 @@ JNIEXPORT jint JNICALL OS_NATIVE(PMSetPageRange)
}
#endif
+#ifndef NO_PMShowPrintDialogWithOptions
+JNIEXPORT jint JNICALL OS_NATIVE(PMShowPrintDialogWithOptions)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jbooleanArray arg4)
+{
+ jboolean *lparg4=NULL;
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, PMShowPrintDialogWithOptions_FUNC);
+ if (arg4) if ((lparg4 = (*env)->GetBooleanArrayElements(env, arg4, NULL)) == NULL) goto fail;
+/*
+ rc = (jint)PMShowPrintDialogWithOptions(arg0, arg1, arg2, arg3, lparg4);
+*/
+ {
+ static int initialized = 0;
+ static CFBundleRef bundle = NULL;
+ typedef jint (*FPTR)(jint, jint, jint, jint, jboolean *);
+ static FPTR fptr;
+ rc = 0;
+ if (!initialized) {
+ if (!bundle) bundle = CFBundleGetBundleWithIdentifier(CFSTR(PMShowPrintDialogWithOptions_LIB));
+ if (bundle) fptr = (FPTR)CFBundleGetFunctionPointerForName(bundle, CFSTR("PMShowPrintDialogWithOptions"));
+ initialized = 1;
+ }
+ if (fptr) {
+ rc = (jint)(*fptr)(arg0, arg1, arg2, arg3, lparg4);
+ }
+ }
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseBooleanArrayElements(env, arg4, lparg4, 0);
+ OS_NATIVE_EXIT(env, that, PMShowPrintDialogWithOptions_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_PMUnflattenPageFormat
JNIEXPORT jint JNICALL OS_NATIVE(PMUnflattenPageFormat)
(JNIEnv *env, jclass that, jint arg0, jintArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_custom.h
index 380efbee05..c94b2fb581 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_custom.h
@@ -30,4 +30,5 @@
#define HIShapeReplacePathInCGContext_LIB "com.apple.Carbon"
#define AXUIElementGetDataBrowserItemInfo_LIB "com.apple.Carbon"
#define AXUIElementCreateWithDataBrowserAndItemInfo_LIB "com.apple.Carbon"
-#define PMPrinterGetOutputResolution_LIB "com.apple.Carbon" \ No newline at end of file
+#define PMPrinterGetOutputResolution_LIB "com.apple.Carbon"
+#define PMShowPrintDialogWithOptions_LIB "com.apple.Carbon"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
index 7ad75cc234..718a746dee 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 973;
-int OS_nativeFunctionCallCount[973];
+int OS_nativeFunctionCount = 974;
+int OS_nativeFunctionCallCount[974];
char * OS_nativeFunctionNames[] = {
"AECoerceDesc",
"AECountItems",
@@ -752,6 +752,7 @@ char * OS_nativeFunctionNames[] = {
"PMSetJobNameCFString",
"PMSetLastPage",
"PMSetPageRange",
+ "PMShowPrintDialogWithOptions",
"PMUnflattenPageFormat",
"PMUnflattenPrintSettings",
"PickColor",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
index ae5fa85d81..3bfebe0f2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
@@ -760,6 +760,7 @@ typedef enum {
PMSetJobNameCFString_FUNC,
PMSetLastPage_FUNC,
PMSetPageRange_FUNC,
+ PMShowPrintDialogWithOptions_FUNC,
PMUnflattenPageFormat_FUNC,
PMUnflattenPrintSettings_FUNC,
PickColor_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
index 101e4675ed..2d07ab8a31 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
@@ -750,6 +750,8 @@ public class OS extends C {
public static final int kPMDestinationPreview = 4;
public static final int kPMDestinationPrinter = 1;
public static final int kPMPrintAllPages = 2147483647;
+ public static final int kPMShowDefaultInlineItems = 1 << 15;
+ public static final int kPMShowPageAttributesPDE = 1 << 8;
public static final int kQDUseCGTextMetrics = (1 << 2);
public static final int kQDUseCGTextRendering = (1 << 1);
public static final int kScrapFlavorTypeUnicode = ('u'<<24) + ('t'<<16) + ('x'<<8) + 't';
@@ -1773,6 +1775,7 @@ public static final native int PMSetFirstPage(int printSettings, int first, bool
public static final native int PMSetJobNameCFString(int printSettings, int name);
public static final native int PMSetLastPage(int printSettings, int last, boolean lock);
public static final native int PMSetPageRange(int printSettings, int minPage, int maxPage);
+public static final native int PMShowPrintDialogWithOptions(int printSession, int printSettings, int pageFormat, int printDialogOptions, boolean[] accepted);
public static final native int PMUnflattenPageFormat(int flatFormat, int[] pageFormat);
public static final native int PMUnflattenPrintSettings(int flatSettings, int[] printSettings);
public static final native boolean PtInRect(Point pt, Rect r);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/carbon/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/carbon/org/eclipse/swt/printing/PrintDialog.java
index 5b47739071..98cafd7de6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/carbon/org/eclipse/swt/printing/PrintDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/carbon/org/eclipse/swt/printing/PrintDialog.java
@@ -142,65 +142,68 @@ public PrinterData open() {
OS.PMSetPageRange(printSettings, 1, OS.kPMPrintAllPages);
}
boolean[] accepted = new boolean [1];
- OS.PMSessionPageSetupDialog(printSession, pageFormat, accepted);
- if (accepted[0]) {
- OS.PMSessionPrintDialog(printSession, printSettings, pageFormat, accepted);
- if (accepted[0]) {
- short[] destType = new short[1];
- OS.PMSessionGetDestinationType(printSession, printSettings, destType);
- String name = Printer.getCurrentPrinterName(printSession);
- String driver = Printer.DRIVER;
- switch (destType[0]) {
- case OS.kPMDestinationFax: driver = Printer.FAX_DRIVER; break;
- case OS.kPMDestinationFile: driver = Printer.FILE_DRIVER; break;
- case OS.kPMDestinationPreview: driver = Printer.PREVIEW_DRIVER; break;
- case OS.kPMDestinationPrinter: driver = Printer.PRINTER_DRIVER; break;
- }
- PrinterData data = new PrinterData(driver, name);
- if (destType[0] == OS.kPMDestinationFile) {
- data.printToFile = true;
- OS.PMSessionCopyDestinationLocation(printSession, printSettings, buffer);
- int fileName = OS.CFURLCopyFileSystemPath(buffer[0],OS.kCFURLPOSIXPathStyle);
- OS.CFRelease(buffer[0]);
- data.fileName = Printer.getString(fileName);
- OS.CFRelease(fileName);
- }
- OS.PMGetCopies(printSettings, buffer);
- data.copyCount = buffer[0];
- OS.PMGetFirstPage(printSettings, buffer);
- data.startPage = buffer[0];
- OS.PMGetLastPage(printSettings, buffer);
- data.endPage = buffer[0];
- OS.PMGetPageRange(printSettings, null, buffer);
- if (data.startPage == 1 && data.endPage == OS.kPMPrintAllPages) {
- data.scope = PrinterData.ALL_PAGES;
- } else {
- data.scope = PrinterData.PAGE_RANGE;
- }
- boolean[] collate = new boolean[1];
- OS.PMGetCollate(printSettings, collate);
- data.collate = collate[0];
-
- /* Serialize settings */
- int[] flatSettings = new int[1];
- OS.PMFlattenPrintSettings(printSettings, flatSettings);
- int[] flatFormat = new int[1];
- OS.PMFlattenPageFormat(pageFormat, flatFormat);
- int settingsLength = OS.GetHandleSize (flatSettings[0]);
- int formatLength = OS.GetHandleSize (flatFormat[0]);
- byte[] otherData = data.otherData = new byte[settingsLength + formatLength + 8];
- int offset = 0;
- offset = Printer.packData(flatSettings[0], otherData, offset);
- offset = Printer.packData(flatFormat[0], otherData, offset);
- OS.DisposeHandle(flatSettings[0]);
- OS.DisposeHandle(flatFormat[0]);
-
- scope = data.scope;
- startPage = data.startPage;
- endPage = data.endPage;
- printToFile = data.printToFile;
- return data;
+ if (OS.VERSION >= 0x1050) {
+ int printDialogOptions = OS.kPMShowDefaultInlineItems | OS.kPMShowPageAttributesPDE;
+ OS.PMShowPrintDialogWithOptions(printSession, printSettings, pageFormat, printDialogOptions, accepted);
+ } else {
+ OS.PMSessionPageSetupDialog(printSession, pageFormat, accepted);
+ if (accepted[0]) OS.PMSessionPrintDialog(printSession, printSettings, pageFormat, accepted);
+ }
+ if (accepted[0]) {
+ short[] destType = new short[1];
+ OS.PMSessionGetDestinationType(printSession, printSettings, destType);
+ String name = Printer.getCurrentPrinterName(printSession);
+ String driver = Printer.DRIVER;
+ switch (destType[0]) {
+ case OS.kPMDestinationFax: driver = Printer.FAX_DRIVER; break;
+ case OS.kPMDestinationFile: driver = Printer.FILE_DRIVER; break;
+ case OS.kPMDestinationPreview: driver = Printer.PREVIEW_DRIVER; break;
+ case OS.kPMDestinationPrinter: driver = Printer.PRINTER_DRIVER; break;
+ }
+ PrinterData data = new PrinterData(driver, name);
+ if (destType[0] == OS.kPMDestinationFile) {
+ data.printToFile = true;
+ OS.PMSessionCopyDestinationLocation(printSession, printSettings, buffer);
+ int fileName = OS.CFURLCopyFileSystemPath(buffer[0],OS.kCFURLPOSIXPathStyle);
+ OS.CFRelease(buffer[0]);
+ data.fileName = Printer.getString(fileName);
+ OS.CFRelease(fileName);
+ }
+ OS.PMGetCopies(printSettings, buffer);
+ data.copyCount = buffer[0];
+ OS.PMGetFirstPage(printSettings, buffer);
+ data.startPage = buffer[0];
+ OS.PMGetLastPage(printSettings, buffer);
+ data.endPage = buffer[0];
+ OS.PMGetPageRange(printSettings, null, buffer);
+ if (data.startPage == 1 && data.endPage == OS.kPMPrintAllPages) {
+ data.scope = PrinterData.ALL_PAGES;
+ } else {
+ data.scope = PrinterData.PAGE_RANGE;
}
+ boolean[] collate = new boolean[1];
+ OS.PMGetCollate(printSettings, collate);
+ data.collate = collate[0];
+
+ /* Serialize settings */
+ int[] flatSettings = new int[1];
+ OS.PMFlattenPrintSettings(printSettings, flatSettings);
+ int[] flatFormat = new int[1];
+ OS.PMFlattenPageFormat(pageFormat, flatFormat);
+ int settingsLength = OS.GetHandleSize (flatSettings[0]);
+ int formatLength = OS.GetHandleSize (flatFormat[0]);
+ byte[] otherData = data.otherData = new byte[settingsLength + formatLength + 8];
+ int offset = 0;
+ offset = Printer.packData(flatSettings[0], otherData, offset);
+ offset = Printer.packData(flatFormat[0], otherData, offset);
+ OS.DisposeHandle(flatSettings[0]);
+ OS.DisposeHandle(flatFormat[0]);
+
+ scope = data.scope;
+ startPage = data.startPage;
+ endPage = data.endPage;
+ printToFile = data.printToFile;
+ return data;
}
OS.PMRelease(pageFormat);
}