Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5ff8fe72
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5ff8fe72
编写于
6月 13, 2013
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8016485: Windows native print dialog does not reflect default printer settings
Reviewed-by: jgodinez, jchen
上级
fa61b182
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
53 addition
and
23 deletion
+53
-23
src/windows/classes/sun/awt/windows/WPrinterJob.java
src/windows/classes/sun/awt/windows/WPrinterJob.java
+15
-3
src/windows/classes/sun/print/Win32PrintService.java
src/windows/classes/sun/print/Win32PrintService.java
+7
-4
src/windows/native/sun/windows/WPrinterJob.cpp
src/windows/native/sun/windows/WPrinterJob.cpp
+6
-1
src/windows/native/sun/windows/awt_PrintControl.cpp
src/windows/native/sun/windows/awt_PrintControl.cpp
+25
-15
未找到文件。
src/windows/classes/sun/awt/windows/WPrinterJob.java
浏览文件 @
5ff8fe72
...
@@ -1269,11 +1269,13 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
...
@@ -1269,11 +1269,13 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
mLastFontFamily
=
null
;
mLastFontFamily
=
null
;
}
}
private
boolean
defaultCopies
=
true
;
/**
/**
* Set the number of copies to be printed.
* Set the number of copies to be printed.
*/
*/
public
void
setCopies
(
int
copies
)
{
public
void
setCopies
(
int
copies
)
{
super
.
setCopies
(
copies
);
super
.
setCopies
(
copies
);
defaultCopies
=
false
;
mAttCopies
=
copies
;
mAttCopies
=
copies
;
setNativeCopies
(
copies
);
setNativeCopies
(
copies
);
}
}
...
@@ -1529,8 +1531,9 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
...
@@ -1529,8 +1531,9 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
}
}
/* SheetCollate */
/* SheetCollate */
private
final
boolean
getCollateAttrib
()
{
private
final
int
getCollateAttrib
()
{
return
(
mAttCollate
==
1
);
// -1 means unset, 0 uncollated, 1 collated.
return
mAttCollate
;
}
}
private
void
setCollateAttrib
(
Attribute
attr
)
{
private
void
setCollateAttrib
(
Attribute
attr
)
{
...
@@ -1553,6 +1556,10 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
...
@@ -1553,6 +1556,10 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
int
orient
=
PageFormat
.
PORTRAIT
;
int
orient
=
PageFormat
.
PORTRAIT
;
OrientationRequested
orientReq
=
(
attributes
==
null
)
?
null
:
OrientationRequested
orientReq
=
(
attributes
==
null
)
?
null
:
(
OrientationRequested
)
attributes
.
get
(
OrientationRequested
.
class
);
(
OrientationRequested
)
attributes
.
get
(
OrientationRequested
.
class
);
if
(
orientReq
==
null
)
{
orientReq
=
(
OrientationRequested
)
myService
.
getDefaultAttributeValue
(
OrientationRequested
.
class
);
}
if
(
orientReq
!=
null
)
{
if
(
orientReq
!=
null
)
{
if
(
orientReq
==
OrientationRequested
.
REVERSE_LANDSCAPE
)
{
if
(
orientReq
==
OrientationRequested
.
REVERSE_LANDSCAPE
)
{
orient
=
PageFormat
.
REVERSE_LANDSCAPE
;
orient
=
PageFormat
.
REVERSE_LANDSCAPE
;
...
@@ -1573,8 +1580,12 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
...
@@ -1573,8 +1580,12 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/* Copies and Page Range. */
/* Copies and Page Range. */
private
final
int
getCopiesAttrib
()
{
private
final
int
getCopiesAttrib
()
{
if
(
defaultCopies
)
{
return
0
;
}
else
{
return
getCopiesInt
();
return
getCopiesInt
();
}
}
}
private
final
void
setRangeCopiesAttribute
(
int
from
,
int
to
,
private
final
void
setRangeCopiesAttribute
(
int
from
,
int
to
,
boolean
isRangeSet
,
boolean
isRangeSet
,
...
@@ -1584,6 +1595,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
...
@@ -1584,6 +1595,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
attributes
.
add
(
new
PageRanges
(
from
,
to
));
attributes
.
add
(
new
PageRanges
(
from
,
to
));
setPageRange
(
from
,
to
);
setPageRange
(
from
,
to
);
}
}
defaultCopies
=
false
;
attributes
.
add
(
new
Copies
(
copies
));
attributes
.
add
(
new
Copies
(
copies
));
/* Since this is called from native to tell Java to sync
/* Since this is called from native to tell Java to sync
* up with native, we don't call this class's own setCopies()
* up with native, we don't call this class's own setCopies()
...
...
src/windows/classes/sun/print/Win32PrintService.java
浏览文件 @
5ff8fe72
...
@@ -180,6 +180,9 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
...
@@ -180,6 +180,9 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
private
static
final
int
DMDUP_VERTICAL
=
2
;
private
static
final
int
DMDUP_VERTICAL
=
2
;
private
static
final
int
DMDUP_HORIZONTAL
=
3
;
private
static
final
int
DMDUP_HORIZONTAL
=
3
;
private
static
final
int
DMCOLLATE_TRUE
=
1
;
private
static
final
int
DMCOLLATE_TRUE
=
1
;
private
static
final
int
DMCOLOR_MONOCHROME
=
1
;
private
static
final
int
DMCOLOR_COLOR
=
2
;
// media sizes with indices above dmPaperToPrintService' length
// media sizes with indices above dmPaperToPrintService' length
private
static
final
int
DMPAPER_A2
=
66
;
private
static
final
int
DMPAPER_A2
=
66
;
...
@@ -1041,6 +1044,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
...
@@ -1041,6 +1044,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
int
defOrient
=
defaults
[
5
];
int
defOrient
=
defaults
[
5
];
int
defSides
=
defaults
[
6
];
int
defSides
=
defaults
[
6
];
int
defCollate
=
defaults
[
7
];
int
defCollate
=
defaults
[
7
];
int
defColor
=
defaults
[
8
];
if
(
category
==
Copies
.
class
)
{
if
(
category
==
Copies
.
class
)
{
if
(
defCopies
>
0
)
{
if
(
defCopies
>
0
)
{
...
@@ -1049,11 +1053,10 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
...
@@ -1049,11 +1053,10 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
return
new
Copies
(
1
);
return
new
Copies
(
1
);
}
}
}
else
if
(
category
==
Chromaticity
.
class
)
{
}
else
if
(
category
==
Chromaticity
.
class
)
{
int
caps
=
getPrinterCapabilities
();
if
(
defColor
==
DMCOLOR_COLOR
)
{
if
((
caps
&
DEVCAP_COLOR
)
==
0
)
{
return
Chromaticity
.
MONOCHROME
;
}
else
{
return
Chromaticity
.
COLOR
;
return
Chromaticity
.
COLOR
;
}
else
{
return
Chromaticity
.
MONOCHROME
;
}
}
}
else
if
(
category
==
JobName
.
class
)
{
}
else
if
(
category
==
JobName
.
class
)
{
return
new
JobName
(
"Java Printing"
,
null
);
return
new
JobName
(
"Java Printing"
,
null
);
...
...
src/windows/native/sun/windows/WPrinterJob.cpp
浏览文件 @
5ff8fe72
...
@@ -750,7 +750,7 @@ Java_sun_print_Win32PrintService_getCapabilities(JNIEnv *env,
...
@@ -750,7 +750,7 @@ Java_sun_print_Win32PrintService_getCapabilities(JNIEnv *env,
#define GETDEFAULT_ERROR -50
#define GETDEFAULT_ERROR -50
#define NDEFAULT
8
#define NDEFAULT
9
JNIEXPORT
jintArray
JNICALL
JNIEXPORT
jintArray
JNICALL
Java_sun_print_Win32PrintService_getDefaultSettings
(
JNIEnv
*
env
,
Java_sun_print_Win32PrintService_getDefaultSettings
(
JNIEnv
*
env
,
...
@@ -859,6 +859,11 @@ Java_sun_print_Win32PrintService_getDefaultSettings(JNIEnv *env,
...
@@ -859,6 +859,11 @@ Java_sun_print_Win32PrintService_getDefaultSettings(JNIEnv *env,
defIndices
[
7
]
=
pDevMode
->
dmCollate
;
defIndices
[
7
]
=
pDevMode
->
dmCollate
;
}
}
if
(
pDevMode
->
dmFields
&
DM_COLOR
)
{
defIndices
[
8
]
=
pDevMode
->
dmColor
;
}
GlobalFree
(
pDevMode
);
GlobalFree
(
pDevMode
);
::
ClosePrinter
(
hPrinter
);
::
ClosePrinter
(
hPrinter
);
...
...
src/windows/native/sun/windows/awt_PrintControl.cpp
浏览文件 @
5ff8fe72
...
@@ -252,7 +252,7 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls)
...
@@ -252,7 +252,7 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls)
AwtPrintControl
::
getCopiesID
=
AwtPrintControl
::
getCopiesID
=
env
->
GetMethodID
(
cls
,
"getCopiesAttrib"
,
"()I"
);
env
->
GetMethodID
(
cls
,
"getCopiesAttrib"
,
"()I"
);
AwtPrintControl
::
getCollateID
=
AwtPrintControl
::
getCollateID
=
env
->
GetMethodID
(
cls
,
"getCollateAttrib"
,
"()
Z
"
);
env
->
GetMethodID
(
cls
,
"getCollateAttrib"
,
"()
I
"
);
AwtPrintControl
::
getOrientID
=
AwtPrintControl
::
getOrientID
=
env
->
GetMethodID
(
cls
,
"getOrientAttrib"
,
"()I"
);
env
->
GetMethodID
(
cls
,
"getOrientAttrib"
,
"()I"
);
AwtPrintControl
::
getFromPageID
=
AwtPrintControl
::
getFromPageID
=
...
@@ -690,12 +690,6 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
...
@@ -690,12 +690,6 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
pd
.
Flags
=
PD_ENABLEPRINTHOOK
|
PD_RETURNDC
|
PD_USEDEVMODECOPIESANDCOLLATE
;
pd
.
Flags
=
PD_ENABLEPRINTHOOK
|
PD_RETURNDC
|
PD_USEDEVMODECOPIESANDCOLLATE
;
pd
.
lpfnPrintHook
=
(
LPPRINTHOOKPROC
)
PrintDlgHook
;
pd
.
lpfnPrintHook
=
(
LPPRINTHOOKPROC
)
PrintDlgHook
;
if
(
env
->
CallBooleanMethod
(
printCtrl
,
AwtPrintControl
::
getCollateID
))
{
pd
.
Flags
|=
PD_COLLATE
;
}
pd
.
nCopies
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getCopiesID
);
pd
.
nFromPage
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
pd
.
nFromPage
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getFromPageID
);
AwtPrintControl
::
getFromPageID
);
pd
.
nToPage
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
pd
.
nToPage
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
...
@@ -729,37 +723,52 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
...
@@ -729,37 +723,52 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
DEVMODE
*
devmode
=
(
DEVMODE
*
)
::
GlobalLock
(
pd
.
hDevMode
);
DEVMODE
*
devmode
=
(
DEVMODE
*
)
::
GlobalLock
(
pd
.
hDevMode
);
DASSERT
(
!
IsBadWritePtr
(
devmode
,
sizeof
(
DEVMODE
)));
DASSERT
(
!
IsBadWritePtr
(
devmode
,
sizeof
(
DEVMODE
)));
devmode
->
dmFields
|=
DM_COPIES
|
DM_COLLATE
|
DM_ORIENTATION
|
WORD
copies
=
(
WORD
)
env
->
CallIntMethod
(
printCtrl
,
DM_PAPERSIZE
|
DM_PRINTQUALITY
|
DM_COLOR
|
DM_DUPLEX
;
AwtPrintControl
::
getCopiesID
);
if
(
copies
>
0
)
{
devmode
->
dmCopies
=
pd
.
nCopies
;
devmode
->
dmFields
|=
DM_COPIES
;
devmode
->
dmCopies
=
copies
;
}
jint
orient
=
env
->
CallIntMethod
(
printCtrl
,
jint
orient
=
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getOrientID
);
AwtPrintControl
::
getOrientID
);
if
(
orient
==
0
)
{
if
(
orient
==
0
)
{
// PageFormat.LANDSCAPE == 0
devmode
->
dmFields
|=
DM_ORIENTATION
;
devmode
->
dmOrientation
=
DMORIENT_LANDSCAPE
;
devmode
->
dmOrientation
=
DMORIENT_LANDSCAPE
;
}
else
if
(
orient
==
1
)
{
}
else
if
(
orient
==
1
)
{
// PageFormat.PORTRAIT == 1
devmode
->
dmFields
|=
DM_ORIENTATION
;
devmode
->
dmOrientation
=
DMORIENT_PORTRAIT
;
devmode
->
dmOrientation
=
DMORIENT_PORTRAIT
;
}
}
devmode
->
dmCollate
=
(
pd
.
Flags
&
PD_COLLATE
)
?
DMCOLLATE_TRUE
// -1 means unset, so we'll accept the printer default.
:
DMCOLLATE_FALSE
;
int
collate
=
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getCollateID
);
if
(
collate
==
1
)
{
devmode
->
dmFields
|=
DM_COLLATE
;
devmode
->
dmCollate
=
DMCOLLATE_TRUE
;
}
else
if
(
collate
==
0
)
{
devmode
->
dmFields
|=
DM_COLLATE
;
devmode
->
dmCollate
=
DMCOLLATE_FALSE
;
}
int
quality
=
env
->
CallIntMethod
(
printCtrl
,
int
quality
=
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getQualityID
);
AwtPrintControl
::
getQualityID
);
if
(
quality
)
{
if
(
quality
)
{
devmode
->
dmFields
|=
DM_PRINTQUALITY
;
devmode
->
dmPrintQuality
=
quality
;
devmode
->
dmPrintQuality
=
quality
;
}
}
int
color
=
env
->
CallIntMethod
(
printCtrl
,
int
color
=
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getColorID
);
AwtPrintControl
::
getColorID
);
if
(
color
)
{
if
(
color
)
{
devmode
->
dmFields
|=
DM_COLOR
;
devmode
->
dmColor
=
color
;
devmode
->
dmColor
=
color
;
}
}
int
sides
=
env
->
CallIntMethod
(
printCtrl
,
int
sides
=
env
->
CallIntMethod
(
printCtrl
,
AwtPrintControl
::
getSidesID
);
AwtPrintControl
::
getSidesID
);
if
(
sides
)
{
if
(
sides
)
{
devmode
->
dmFields
|=
DM_DUPLEX
;
devmode
->
dmDuplex
=
(
int
)
sides
;
devmode
->
dmDuplex
=
(
int
)
sides
;
}
}
...
@@ -771,6 +780,7 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
...
@@ -771,6 +780,7 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
double
newWid
=
0.0
,
newHt
=
0.0
;
double
newWid
=
0.0
,
newHt
=
0.0
;
if
(
wid_ht
!=
NULL
&&
wid_ht
[
0
]
!=
0
&&
wid_ht
[
1
]
!=
0
)
{
if
(
wid_ht
!=
NULL
&&
wid_ht
[
0
]
!=
0
&&
wid_ht
[
1
]
!=
0
)
{
devmode
->
dmFields
|=
DM_PAPERSIZE
;
devmode
->
dmPaperSize
=
AwtPrintControl
::
getNearestMatchingPaper
(
devmode
->
dmPaperSize
=
AwtPrintControl
::
getNearestMatchingPaper
(
printName
,
printName
,
portName
,
portName
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录