Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2014-09-04 18:47:00 +0000
committerLakshmi Shanmugam2014-09-04 18:47:00 +0000
commit22d8845db15635689e0089ba86e6b85e569dd7f6 (patch)
tree0292404466af2ee9dbc3f58e32051b123c4ebd5e
parent418f8414b42761e68fafc14f5b560d137139645c (diff)
downloadeclipse.platform.swt-22d8845db15635689e0089ba86e6b85e569dd7f6.tar.gz
eclipse.platform.swt-22d8845db15635689e0089ba86e6b85e569dd7f6.tar.xz
eclipse.platform.swt-22d8845db15635689e0089ba86e6b85e569dd7f6.zip
Modified fix for Bug 400478 - Print doesn't have a "print selection"
option on osx Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java19
7 files changed, 31 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index 8f67e96e69..5937973642 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -4999,18 +4999,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintScalingFactor)
}
#endif
-#ifndef NO_NSPrintSelectionOnly
-JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintSelectionOnly)
- (JNIEnv *env, jclass that)
-{
- jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, NSPrintSelectionOnly_FUNC);
- rc = (jintLong)NSPrintSelectionOnly;
- OS_NATIVE_EXIT(env, that, NSPrintSelectionOnly_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_NSPrintSpoolJob
JNIEXPORT jintLong JNICALL OS_NATIVE(NSPrintSpoolJob)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 3132afbe11..606a685969 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -377,7 +377,6 @@ char * OS_nativeFunctionNames[] = {
"NSPrintSaveJob",
"NSPrintSavePath",
"NSPrintScalingFactor",
- "NSPrintSelectionOnly",
"NSPrintSpoolJob",
"NSRTFPboardType",
"NSRange_1sizeof",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index 8f9a688dec..9e39704af5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -387,7 +387,6 @@ typedef enum {
NSPrintSaveJob_FUNC,
NSPrintSavePath_FUNC,
NSPrintScalingFactor_FUNC,
- NSPrintSelectionOnly_FUNC,
NSPrintSpoolJob_FUNC,
NSRTFPboardType_FUNC,
NSRange_1sizeof_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 3e08ad24c1..6e4b1b125d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -2387,6 +2387,9 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true" swt_java_type="NSPrintInfo"></retval>
</method>
+ <method selector="isSelectionOnly" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="jobDisposition" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
@@ -2407,6 +2410,10 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method selector="setSelectionOnly:" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="setUpPrintOperationDefaultValues" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
@@ -4679,7 +4686,6 @@
<constant name="NSPrintSaveJob" swt_gen="true"></constant>
<constant name="NSPrintSavePath" swt_gen="true"></constant>
<constant name="NSPrintScalingFactor" swt_gen="true"></constant>
- <constant name="NSPrintSelectionOnly" swt_gen="true"></constant>
<constant name="NSPrintSpoolJob" swt_gen="true"></constant>
<constant name="NSRTFPboardType" swt_gen="true"></constant>
<constant name="NSSpellingStateAttributeName" swt_gen="true"></constant>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java
index 9c152fa0d4..2ab8681065 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPrintInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,6 +53,10 @@ public NSPrintInfo initWithDictionary(NSDictionary attributes) {
return result == this.id ? this : (result != 0 ? new NSPrintInfo(result) : null);
}
+public boolean isSelectionOnly() {
+ return OS.objc_msgSend_bool(this.id, OS.sel_isSelectionOnly);
+}
+
public NSString jobDisposition() {
long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_jobDisposition);
return result != 0 ? new NSString(result) : null;
@@ -82,6 +86,10 @@ public void setPrinter(NSPrinter printer) {
OS.objc_msgSend(this.id, OS.sel_setPrinter_, printer != null ? printer.id : 0);
}
+public void setSelectionOnly(boolean selectionOnly) {
+ OS.objc_msgSend(this.id, OS.sel_setSelectionOnly_, selectionOnly);
+}
+
public void setUpPrintOperationDefaultValues() {
OS.objc_msgSend(this.id, OS.sel_setUpPrintOperationDefaultValues);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index b6a7b87293..a205c2a1a7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -1465,6 +1465,7 @@ public static final long /*int*/ sel_isPlanar = sel_registerName("isPlanar");
public static final long /*int*/ sel_isResting = sel_registerName("isResting");
public static final long /*int*/ sel_isRowSelected_ = sel_registerName("isRowSelected:");
public static final long /*int*/ sel_isRunning = sel_registerName("isRunning");
+public static final long /*int*/ sel_isSelectionOnly = sel_registerName("isSelectionOnly");
public static final long /*int*/ sel_isSeparatorItem = sel_registerName("isSeparatorItem");
public static final long /*int*/ sel_isSessionOnly = sel_registerName("isSessionOnly");
public static final long /*int*/ sel_isSheet = sel_registerName("isSheet");
@@ -2016,6 +2017,7 @@ public static final long /*int*/ sel_setSelectedItemIdentifier_ = sel_registerNa
public static final long /*int*/ sel_setSelectedRange_ = sel_registerName("setSelectedRange:");
public static final long /*int*/ sel_setSelectedSegment_ = sel_registerName("setSelectedSegment:");
public static final long /*int*/ sel_setSelectedTextAttributes_ = sel_registerName("setSelectedTextAttributes:");
+public static final long /*int*/ sel_setSelectionOnly_ = sel_registerName("setSelectionOnly:");
public static final long /*int*/ sel_setServicesMenu_ = sel_registerName("setServicesMenu:");
public static final long /*int*/ sel_setShouldAntialias_ = sel_registerName("setShouldAntialias:");
public static final long /*int*/ sel_setShowsHelp_ = sel_registerName("setShowsHelp:");
@@ -3063,9 +3065,6 @@ public static final NSString NSPrintSavePath = new NSString(NSPrintSavePath());
public static final native long /*int*/ NSPrintScalingFactor();
public static final NSString NSPrintScalingFactor = new NSString(NSPrintScalingFactor());
/** @method flags=const */
-public static final native long /*int*/ NSPrintSelectionOnly();
-public static final NSString NSPrintSelectionOnly = new NSString(NSPrintSelectionOnly());
-/** @method flags=const */
public static final native long /*int*/ NSPrintSpoolJob();
public static final NSString NSPrintSpoolJob = new NSString(NSPrintSpoolJob());
/** @method flags=const */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
index 922ba2a90a..792d56637c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java
@@ -184,7 +184,11 @@ public PrinterData open() {
dict.setValue(NSNumber.numberWithInt(printerData.startPage), OS.NSPrintFirstPage);
dict.setValue(NSNumber.numberWithInt(printerData.endPage), OS.NSPrintLastPage);
}
- dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.SELECTION), OS.NSPrintSelectionOnly);
+ // NSPrintSelectionOnly is not available in version 10.5
+ // dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.SELECTION), OS.NSPrintSelectionOnly);
+ if (OS.VERSION >= 0x1060) {
+ printInfo.setSelectionOnly (printerData.scope == PrinterData.SELECTION);
+ }
panel.setOptions(OS.NSPrintPanelShowsPageSetupAccessory | OS.NSPrintPanelShowsPrintSelection | panel.options());
Shell parent = getParent();
@@ -218,11 +222,14 @@ public PrinterData open() {
NSString filename = new NSString(dict.objectForKey(OS.NSPrintSavePath));
data.fileName = filename.getString();
}
- data.scope = new NSNumber(dict.objectForKey(OS.NSPrintSelectionOnly)).intValue() != 0 ? PrinterData.SELECTION :
- new NSNumber(dict.objectForKey(OS.NSPrintAllPages)).intValue() != 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE;
- if (data.scope == PrinterData.PAGE_RANGE) {
- data.startPage = new NSNumber(dict.objectForKey(OS.NSPrintFirstPage)).intValue();
- data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue();
+ if (OS.VERSION >= 0x1060 && printInfo.isSelectionOnly ()) {
+ data.scope = PrinterData.SELECTION;
+ } else {
+ data.scope = new NSNumber(dict.objectForKey(OS.NSPrintAllPages)).intValue() != 0 ? PrinterData.ALL_PAGES : PrinterData.PAGE_RANGE;
+ if (data.scope == PrinterData.PAGE_RANGE) {
+ data.startPage = new NSNumber(dict.objectForKey(OS.NSPrintFirstPage)).intValue();
+ data.endPage = new NSNumber(dict.objectForKey(OS.NSPrintLastPage)).intValue();
+ }
}
data.collate = new NSNumber(dict.objectForKey(OS.NSPrintMustCollate)).intValue() != 0;
data.collate = false; //TODO: Only set to false if the printer does the collate internally (most printers do)

Back to the top