Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6124a027
Commit
6124a027
authored
May 20, 2003
by
Huw Davies
Committed by
Alexandre Julliard
May 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CUPS uses the ppd file to store the default paper size, so we'll read
it from here. If the ppd doesn't contain an explicit resolution then default to 300dpi.
parent
9747a103
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
5 deletions
+51
-5
init.c
dlls/wineps/init.c
+11
-0
ppd.c
dlls/wineps/ppd.c
+39
-5
psdrv.h
dlls/wineps/psdrv.h
+1
-0
No files found.
dlls/wineps/init.c
View file @
6124a027
...
@@ -588,6 +588,10 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -588,6 +588,10 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
goto
closeprinter
;
goto
closeprinter
;
}
}
/* Some gimp-print ppd files don't contain a DefaultResolution line
set it to 300 if it's not specified */
if
(
pi
->
ppd
->
DefaultResolution
==
0
)
pi
->
ppd
->
DefaultResolution
=
300
;
if
(
using_default_devmode
)
{
if
(
using_default_devmode
)
{
DWORD
papersize
;
DWORD
papersize
;
...
@@ -604,6 +608,13 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -604,6 +608,13 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
REG_BINARY
,
(
LPBYTE
)
pi
->
Devmode
,
sizeof
(
DefaultDevmode
)
);
REG_BINARY
,
(
LPBYTE
)
pi
->
Devmode
,
sizeof
(
DefaultDevmode
)
);
}
}
if
(
pi
->
ppd
->
DefaultPageSize
)
{
/* We'll let the ppd override the devmode */
PSDRV_DEVMODEA
dm
;
memset
(
&
dm
,
0
,
sizeof
(
dm
));
dm
.
dmPublic
.
dmFields
=
DM_PAPERSIZE
;
dm
.
dmPublic
.
u1
.
s1
.
dmPaperSize
=
pi
->
ppd
->
DefaultPageSize
->
WinPage
;
PSDRV_MergeDevmodes
(
pi
->
Devmode
,
&
dm
,
pi
);
}
/*
/*
* This is a hack. The default paper size should be read in as part of
* This is a hack. The default paper size should be read in as part of
...
...
dlls/wineps/ppd.c
View file @
6124a027
...
@@ -355,9 +355,13 @@ static BOOL PSDRV_PPDGetSymbolValue(char *pos, PPDTuple *tuple)
...
@@ -355,9 +355,13 @@ static BOOL PSDRV_PPDGetSymbolValue(char *pos, PPDTuple *tuple)
*/
*/
static
BOOL
PSDRV_PPDGetNextTuple
(
FILE
*
fp
,
PPDTuple
*
tuple
)
static
BOOL
PSDRV_PPDGetNextTuple
(
FILE
*
fp
,
PPDTuple
*
tuple
)
{
{
char
line
[
257
],
*
opt
=
NULL
,
*
cp
,
*
trans
,
*
endkey
;
char
line
[
257
],
*
opt
,
*
cp
,
*
trans
,
*
endkey
;
BOOL
gotoption
=
TRUE
;
BOOL
gotoption
;
start:
gotoption
=
TRUE
;
opt
=
NULL
;
memset
(
tuple
,
0
,
sizeof
(
*
tuple
));
memset
(
tuple
,
0
,
sizeof
(
*
tuple
));
do
{
do
{
...
@@ -369,7 +373,7 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
...
@@ -369,7 +373,7 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
if
(
line
[
strlen
(
line
)
-
1
]
!=
'\n'
)
{
if
(
line
[
strlen
(
line
)
-
1
]
!=
'\n'
)
{
ERR
(
"Line too long.
\n
"
);
ERR
(
"Line too long.
\n
"
);
return
FALSE
;
goto
start
;
}
}
for
(
cp
=
line
;
!
isspace
(
*
cp
)
&&
*
cp
!=
':'
;
cp
++
)
for
(
cp
=
line
;
!
isspace
(
*
cp
)
&&
*
cp
!=
':'
;
cp
++
)
...
@@ -398,7 +402,8 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
...
@@ -398,7 +402,8 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
cp
=
strpbrk
(
opt
,
":/"
);
cp
=
strpbrk
(
opt
,
":/"
);
if
(
!
cp
)
{
if
(
!
cp
)
{
ERR
(
"Error in line '%s'?
\n
"
,
line
);
ERR
(
"Error in line '%s'?
\n
"
,
line
);
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
tuple
->
key
);
goto
start
;
}
}
tuple
->
option
=
HeapAlloc
(
PSDRV_Heap
,
0
,
cp
-
opt
+
1
);
tuple
->
option
=
HeapAlloc
(
PSDRV_Heap
,
0
,
cp
-
opt
+
1
);
if
(
!
tuple
->
option
)
return
FALSE
;
if
(
!
tuple
->
option
)
return
FALSE
;
...
@@ -410,7 +415,9 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
...
@@ -410,7 +415,9 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
cp
=
strchr
(
trans
,
':'
);
cp
=
strchr
(
trans
,
':'
);
if
(
!
cp
)
{
if
(
!
cp
)
{
ERR
(
"Error in line '%s'?
\n
"
,
line
);
ERR
(
"Error in line '%s'?
\n
"
,
line
);
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
tuple
->
option
);
HeapFree
(
GetProcessHeap
(),
0
,
tuple
->
key
);
goto
start
;
}
}
buf
=
HeapAlloc
(
PSDRV_Heap
,
0
,
cp
-
trans
+
1
);
buf
=
HeapAlloc
(
PSDRV_Heap
,
0
,
cp
-
trans
+
1
);
if
(
!
buf
)
return
FALSE
;
if
(
!
buf
)
return
FALSE
;
...
@@ -547,6 +554,7 @@ PPD *PSDRV_ParsePPD(char *fname)
...
@@ -547,6 +554,7 @@ PPD *PSDRV_ParsePPD(char *fname)
FILE
*
fp
;
FILE
*
fp
;
PPD
*
ppd
;
PPD
*
ppd
;
PPDTuple
tuple
;
PPDTuple
tuple
;
char
*
default_pagesize
=
NULL
;
TRACE
(
"file '%s'
\n
"
,
fname
);
TRACE
(
"file '%s'
\n
"
,
fname
);
...
@@ -675,6 +683,15 @@ PPD *PSDRV_ParsePPD(char *fname)
...
@@ -675,6 +683,15 @@ PPD *PSDRV_ParsePPD(char *fname)
}
}
}
}
else
if
(
!
strcmp
(
"*DefaultPageSize"
,
tuple
.
key
))
{
if
(
default_pagesize
)
{
WARN
(
"Already set default pagesize
\n
"
);
}
else
{
default_pagesize
=
tuple
.
value
;
tuple
.
value
=
NULL
;
}
}
else
if
(
!
strcmp
(
"*ImageableArea"
,
tuple
.
key
))
{
else
if
(
!
strcmp
(
"*ImageableArea"
,
tuple
.
key
))
{
PAGESIZE
*
page
;
PAGESIZE
*
page
;
page
=
PSDRV_PPDGetPageSizeInfo
(
ppd
,
tuple
.
option
);
page
=
PSDRV_PPDGetPageSizeInfo
(
ppd
,
tuple
.
option
);
...
@@ -804,6 +821,23 @@ PPD *PSDRV_ParsePPD(char *fname)
...
@@ -804,6 +821,23 @@ PPD *PSDRV_ParsePPD(char *fname)
}
}
ppd
->
DefaultPageSize
=
NULL
;
if
(
default_pagesize
)
{
PAGESIZE
*
page
;
for
(
page
=
ppd
->
PageSizes
;
page
;
page
=
page
->
next
)
{
if
(
!
strcmp
(
page
->
Name
,
default_pagesize
))
{
ppd
->
DefaultPageSize
=
page
;
TRACE
(
"DefaultPageSize: %s
\n
"
,
page
->
Name
);
break
;
}
}
HeapFree
(
PSDRV_Heap
,
0
,
default_pagesize
);
}
if
(
!
ppd
->
DefaultPageSize
)
{
ppd
->
DefaultPageSize
=
ppd
->
PageSizes
;
TRACE
(
"Setting DefaultPageSize to first in list
\n
"
);
}
{
{
FONTNAME
*
fn
;
FONTNAME
*
fn
;
PAGESIZE
*
page
;
PAGESIZE
*
page
;
...
...
dlls/wineps/psdrv.h
View file @
6124a027
...
@@ -184,6 +184,7 @@ typedef struct {
...
@@ -184,6 +184,7 @@ typedef struct {
char
*
DefaultFont
;
char
*
DefaultFont
;
FONTNAME
*
InstalledFonts
;
/* ptr to a list of FontNames */
FONTNAME
*
InstalledFonts
;
/* ptr to a list of FontNames */
PAGESIZE
*
PageSizes
;
PAGESIZE
*
PageSizes
;
PAGESIZE
*
DefaultPageSize
;
OPTION
*
InstalledOptions
;
OPTION
*
InstalledOptions
;
CONSTRAINT
*
Constraints
;
CONSTRAINT
*
Constraints
;
INPUTSLOT
*
InputSlots
;
INPUTSLOT
*
InputSlots
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment