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
5b71f7bb
Commit
5b71f7bb
authored
Jun 21, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Jun 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineps: Add the ability to override the ppd file's default pagesize and duplex settings.
parent
a2a8a613
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
5 deletions
+31
-5
init.c
dlls/wineps.drv/init.c
+1
-1
ppd.c
dlls/wineps.drv/ppd.c
+29
-3
psdrv.h
dlls/wineps.drv/psdrv.h
+1
-1
No files found.
dlls/wineps.drv/init.c
View file @
5b71f7bb
...
...
@@ -612,7 +612,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
ppd_filename
=
get_ppd_filename
(
hPrinter
);
if
(
!
ppd_filename
)
goto
fail
;
pi
->
ppd
=
PSDRV_ParsePPD
(
ppd_filename
);
pi
->
ppd
=
PSDRV_ParsePPD
(
ppd_filename
,
hPrinter
);
if
(
!
pi
->
ppd
)
{
WARN
(
"Couldn't parse PPD file '%s'
\n
"
,
ppd_filename
);
...
...
dlls/wineps.drv/ppd.c
View file @
5b71f7bb
...
...
@@ -611,18 +611,36 @@ static BOOL PSDRV_AddSlot(PPD *ppd, LPCSTR szName, LPCSTR szFullName,
return
TRUE
;
}
static
char
*
get_ppd_override
(
HANDLE
printer
,
const
char
*
value
)
{
DWORD
err
,
type
,
needed
;
char
*
data
;
err
=
GetPrinterDataExA
(
printer
,
"PPD Overrides"
,
value
,
&
type
,
NULL
,
0
,
&
needed
);
if
(
err
!=
ERROR_MORE_DATA
||
type
!=
REG_SZ
||
needed
==
0
)
return
NULL
;
data
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
if
(
data
)
{
GetPrinterDataExA
(
printer
,
"PPD Overrides"
,
value
,
&
type
,
(
BYTE
*
)
data
,
needed
,
&
needed
);
TRACE
(
"got override %s: %s
\n
"
,
value
,
data
);
}
return
data
;
}
/***********************************************************************
*
* PSDRV_ParsePPD
*
*
*/
PPD
*
PSDRV_ParsePPD
(
char
*
fname
)
PPD
*
PSDRV_ParsePPD
(
char
*
fname
,
HANDLE
printer
)
{
FILE
*
fp
;
PPD
*
ppd
;
PPDTuple
tuple
;
char
*
default_pagesize
=
NULL
,
*
default_duplex
=
NULL
;
char
*
def_pagesize_override
=
NULL
,
*
def_duplex_override
=
NULL
;
PAGESIZE
*
page
,
*
page_cursor2
;
TRACE
(
"file '%s'
\n
"
,
fname
);
...
...
@@ -944,7 +962,10 @@ PPD *PSDRV_ParsePPD(char *fname)
}
ppd
->
DefaultPageSize
=
NULL
;
if
(
default_pagesize
)
def_pagesize_override
=
get_ppd_override
(
printer
,
"DefaultPageSize"
);
if
(
def_pagesize_override
)
ppd
->
DefaultPageSize
=
get_pagesize
(
ppd
,
def_pagesize_override
,
FALSE
);
if
(
!
ppd
->
DefaultPageSize
&&
default_pagesize
)
ppd
->
DefaultPageSize
=
get_pagesize
(
ppd
,
default_pagesize
,
FALSE
);
if
(
!
ppd
->
DefaultPageSize
)
...
...
@@ -955,10 +976,14 @@ PPD *PSDRV_ParsePPD(char *fname)
}
TRACE
(
"DefaultPageSize: %s
\n
"
,
ppd
->
DefaultPageSize
?
ppd
->
DefaultPageSize
->
Name
:
"<not set>"
);
HeapFree
(
PSDRV_Heap
,
0
,
def_pagesize_override
);
HeapFree
(
PSDRV_Heap
,
0
,
default_pagesize
);
ppd
->
DefaultDuplex
=
NULL
;
if
(
default_duplex
)
def_duplex_override
=
get_ppd_override
(
printer
,
"DefaultDuplex"
);
if
(
def_duplex_override
)
ppd
->
DefaultDuplex
=
get_duplex
(
ppd
,
def_duplex_override
);
if
(
!
ppd
->
DefaultDuplex
&&
default_duplex
)
ppd
->
DefaultDuplex
=
get_duplex
(
ppd
,
default_duplex
);
if
(
!
ppd
->
DefaultDuplex
)
...
...
@@ -969,6 +994,7 @@ PPD *PSDRV_ParsePPD(char *fname)
}
TRACE
(
"DefaultDuplex: %s
\n
"
,
ppd
->
DefaultDuplex
?
ppd
->
DefaultDuplex
->
Name
:
"<not set>"
);
HeapFree
(
PSDRV_Heap
,
0
,
def_duplex_override
);
HeapFree
(
PSDRV_Heap
,
0
,
default_duplex
);
...
...
dlls/wineps.drv/psdrv.h
View file @
5b71f7bb
...
...
@@ -458,7 +458,7 @@ extern BOOL PSDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern
void
PSDRV_MergeDevmodes
(
PSDRV_DEVMODE
*
dm1
,
PSDRV_DEVMODE
*
dm2
,
PRINTERINFO
*
pi
)
DECLSPEC_HIDDEN
;
extern
BOOL
PSDRV_GetFontMetrics
(
void
)
DECLSPEC_HIDDEN
;
extern
PPD
*
PSDRV_ParsePPD
(
char
*
fname
)
DECLSPEC_HIDDEN
;
extern
PPD
*
PSDRV_ParsePPD
(
char
*
fname
,
HANDLE
printer
)
DECLSPEC_HIDDEN
;
extern
PRINTERINFO
*
PSDRV_FindPrinterInfo
(
LPCWSTR
name
)
DECLSPEC_HIDDEN
;
extern
const
AFM
*
PSDRV_FindAFMinList
(
FONTFAMILY
*
head
,
LPCSTR
name
)
DECLSPEC_HIDDEN
;
extern
BOOL
PSDRV_AddAFMtoList
(
FONTFAMILY
**
head
,
const
AFM
*
afm
,
...
...
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