Commit e8aa1b98 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Paper size and orientation prop sheet for wineps.

parent 196daf81
......@@ -409,7 +409,7 @@ user/libuser32.so: libgdi32.so libkernel32.so
version/libversion.so: liblz32.so libkernel32.so
win32s/libw32skrnl.so: libkernel32.so
winaspi/libwnaspi32.so: libkernel32.so
wineps/libwineps.so: libgdi32.so libkernel32.so
wineps/libwineps.so: libuser32.so libgdi32.so libkernel32.so
wininet/libwininet.so: libuser32.so libkernel32.so
winmm/joystick/libjoystick.drv.so: libwinmm.so libuser32.so
winmm/libwinmm.so: libuser32.so libkernel32.so
......
Makefile
libwineps.so.1.0
rsrc.s
wineps.spec.c
wineps16.spec.c
......@@ -5,7 +5,8 @@ VPATH = @srcdir@
MODULE = wineps
SOVERSION = 1.0
ALTNAMES = wineps16
IMPORTS = gdi32 kernel32
WRCEXTRA = -s -pwineps
IMPORTS = user32 gdi32 kernel32
C_SRCS = \
afm.c \
......@@ -25,6 +26,9 @@ C_SRCS = \
ps.c \
text.c
RC_SRCS= \
rsrc.rc
@MAKE_DLL_RULES@
### Dependencies:
......@@ -14,6 +14,8 @@
#include "debugtools.h"
#include "winuser.h"
#include "winspool.h"
#include "prsht.h"
#include "psdlg.h"
DEFAULT_DEBUG_CHANNEL(psdrv)
......@@ -144,102 +146,105 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
}
#if 0
/*******************************************************************
*
* PSDRV_NewPrinterDlgProc32
/**************************************************************
*
* PSDRV_AdvancedSetupDialog16 [WINEPS.93]
*
*/
LRESULT WINAPI PSDRV_NewPrinterDlgProc(HWND hWnd, UINT wMsg,
WPARAM wParam, LPARAM lParam)
WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
LPDEVMODEA devin, LPDEVMODEA devout)
{
switch (wMsg) {
case WM_INITDIALOG:
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
ShowWindow(hWnd, SW_SHOWNORMAL);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hWnd, TRUE);
return TRUE;
case IDCANCEL:
EndDialog(hWnd, FALSE);
return TRUE;
default:
return FALSE;
}
default:
return FALSE;
}
TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd,
hDriver, devin, devout);
return IDCANCEL;
}
LRESULT WINAPI PSDRV_AdvancedSetupDlgProc(HWND hWnd, UINT wMsg,
WPARAM wParam, LPARAM lParam)
/****************************************************************
* PSDRV_PaperDlgProc
*
* Dialog proc for 'Paper' propsheet
*/
BOOL WINAPI PSDRV_PaperDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
{
switch (wMsg) {
case WM_INITDIALOG:
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
SendDlgItemMessageA(hWnd, 99, CB_ADDSTRING, 0,
(LPARAM)"Default Tray");
ShowWindow(hWnd, SW_SHOWNORMAL);
return TRUE;
PSDRV_DLGINFO *di;
int i, Cursel = 0;
PAGESIZE *ps;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hWnd, TRUE);
return TRUE;
case IDCANCEL:
EndDialog(hWnd, FALSE);
return TRUE;
switch(msg) {
case WM_INITDIALOG:
di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam;
SetWindowLongA(hwnd, DWL_USER, (LONG)di);
for(ps = di->pi->ppd->PageSizes, i = 0; ps; ps = ps->next, i++) {
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
(LPARAM)ps->FullName);
if(di->pi->Devmode->dmPublic.u1.s1.dmPaperSize == ps->WinPage)
Cursel = i;
}
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0);
CheckRadioButton(hwnd, IDD_ORIENT_PORTRAIT, IDD_ORIENT_LANDSCAPE,
di->pi->Devmode->dmPublic.u1.s1.dmOrientation ==
DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT :
IDD_ORIENT_LANDSCAPE);
break;
case 200:
DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
SYSRES_GetResPtr( SYSRES_DIALOG_PSDRV_NEWPRINTER ),
hWnd, PSDRV_NewPrinterDlgProc, (LPARAM) NULL );
case WM_COMMAND:
di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
switch(LOWORD(wParam)) {
case IDD_PAPERS:
if(HIWORD(wParam) == LBN_SELCHANGE) {
Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), LB_GETCURSEL, 0, 0);
for(i = 0, ps = di->pi->ppd->PageSizes; i < Cursel; i++, ps = ps->next)
;
TRACE("Setting pagesize to item %d Winpage = %d\n", Cursel,
ps->WinPage);
di->dlgdm->dmPublic.u1.s1.dmPaperSize = ps->WinPage;
}
break;
case IDD_ORIENT_PORTRAIT:
case IDD_ORIENT_LANDSCAPE:
TRACE("Setting orientation to %s\n", wParam == IDD_ORIENT_PORTRAIT ?
"portrait" : "landscape");
di->dlgdm->dmPublic.u1.s1.dmOrientation = wParam == IDD_ORIENT_PORTRAIT ?
DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
break;
}
break;
case WM_NOTIFY:
{
NMHDR *nmhdr = (NMHDR *)lParam;
di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
switch(nmhdr->code) {
case PSN_APPLY:
memcpy(di->pi->Devmode, di->dlgdm, sizeof(PSDRV_DEVMODEA));
SetWindowLongA(hwnd, DWL_MSGRESULT, PSNRET_NOERROR);
return TRUE;
break;
default:
return FALSE;
break;
}
default:
break;
}
default:
return FALSE;
}
return TRUE;
}
#endif /* 0 */
/***********************************************************************
*
* PSDRV_AdvancedSetupDialog16 [WINEPS.93]
*
*/
WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
LPDEVMODEA devin, LPDEVMODEA devout)
{
TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd,
hDriver, devin, devout);
return IDCANCEL;
static void (WINAPI* pInitCommonControls) (void);
static HPROPSHEETPAGE (WINAPI* pCreatePropertySheetPage) (LPCPROPSHEETPAGEA);
static int (WINAPI* pPropertySheet) (LPCPROPSHEETHEADERA);
#if 0
return DialogBoxIndirectParamA( GetWindowLongA( hwnd, GWL_HINSTANCE ),
SYSRES_GetResPtr( SYSRES_DIALOG_PSDRV_ADVANCEDSETUP ),
hwnd, PSDRV_AdvancedSetupDlgProc, (LPARAM) NULL );
#endif
}
/***********************************************************************
/***************************************************************
*
* PSDRV_ExtDeviceMode16 [WINEPS.90]
*
......@@ -251,6 +256,7 @@ INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
LPSTR lpszProfile, WORD fwMode)
{
PRINTERINFO *pi = PSDRV_FindPrinterInfo(lpszDevice);
if(!pi) return -1;
TRACE("(hwnd=%04x, hDriver=%04x, devOut=%p, Device='%s', Port='%s', devIn=%p, Profile='%s', Mode=%04x)\n",
hwnd, hDriver, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile,
......@@ -259,17 +265,52 @@ fwMode);
if(!fwMode)
return sizeof(DEVMODEA); /* Just copy dmPublic bit of PSDRV_DEVMODE */
if(fwMode & DM_PROMPT)
FIXME("Mode DM_PROMPT not implemented\n");
if(fwMode & DM_UPDATE)
FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n");
if((fwMode & DM_MODIFY) && lpdmInput) {
TRACE("DM_MODIFY set. devIn->dmFields = %08lx\n", lpdmInput->dmFields);
PSDRV_MergeDevmodes(pi->Devmode, (PSDRV_DEVMODEA *)lpdmInput, pi);
}
if(fwMode & DM_PROMPT) {
HINSTANCE hinstComctl32, hinstWineps32 = LoadLibraryA("WINEPS");
HPROPSHEETPAGE hpsp[1];
PROPSHEETPAGEA psp;
PROPSHEETHEADERA psh;
PSDRV_DLGINFO *di;
PSDRV_DEVMODEA *dlgdm;
hinstComctl32 = LoadLibraryA("comctl32.dll");
pInitCommonControls = (void*)GetProcAddress(hinstComctl32,
"InitCommonControls");
pCreatePropertySheetPage = (void*)GetProcAddress(hinstComctl32,
"CreatePropertySheetPage");
pPropertySheet = (void*)GetProcAddress(hinstComctl32, "PropertySheet");
memset(&psp,0,sizeof(psp));
dlgdm = HeapAlloc( PSDRV_Heap, 0, sizeof(*dlgdm) );
memcpy(dlgdm, pi->Devmode, sizeof(*dlgdm));
di = HeapAlloc( PSDRV_Heap, 0, sizeof(*di) );
di->pi = pi;
di->dlgdm = dlgdm;
psp.dwSize = sizeof(psp);
psp.hInstance = hinstWineps32;
psp.u.pszTemplate = "PAPER";
psp.u2.pszIcon = NULL;
psp.pfnDlgProc = PSDRV_PaperDlgProc;
psp.lParam = (LPARAM)di;
hpsp[0] = pCreatePropertySheetPage(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = sizeof(psh);
psh.pszCaption = "Setup";
psh.nPages = 1;
psh.hwndParent = hwnd;
psh.u3.phpage = hpsp;
pPropertySheet(&psh);
}
if(fwMode & DM_UPDATE)
FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n");
if((fwMode & DM_COPY) || (fwMode & DM_UPDATE)) {
memcpy(lpdmOutput, pi->Devmode, sizeof(DEVMODEA));
}
......@@ -510,3 +551,25 @@ LPSTR lpszDevice, LPSTR lpszPort)
NULL, DM_PROMPT );
return;
}
#if 0
typedef struct {
DWORD nPages;
DWORD Unknown;
HPROPSHEETPAGE hPages[10];
} EDMPS;
INT PSDRV_ExtDeviceModePropSheet(HWND hwnd, LPSTR lpszDevice, LPSTR lpszPort,
LPVOID pPropSheet)
{
EDMPS *ps = pPropSheet;
PROPSHEETPAGE psp;
psp->dwSize = sizeof(psp);
psp->hInstance = 0x1234;
ps->nPages = 1;
}
#endif
/*
* Wine PostScript Driver Dialog IDs
*
* Copyright 1999 Huw D M Davies
*/
#ifndef __WINE_PSDLG_H
#define __WINE_PSDLG_H
#define IDD_PAPERS 100
#define IDD_ORIENT_PORTRAIT 101
#define IDD_ORIENT_LANDSCAPE 102
#endif /* __WINE_PSDLG_H */
......@@ -233,6 +233,10 @@ typedef struct {
PRINTERINFO *pi;
} PSDRV_PDEVICE;
typedef struct {
PRINTERINFO *pi;
PSDRV_DEVMODEA *dlgdm;
} PSDRV_DLGINFO;
extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
......
/*
* Top level resource file for wineps
*
*/
#include "windef.h"
#include "winuser.h"
#include "winnls.h"
#include "psdlg.h"
/*
* Everything that does not depend on language,
* like textless bitmaps etc, go into the
* neutral language. This will prevent them from
* being duplicated for each language.
*/
#include "wps_xx.rc"
/*
* Everything specific to any language goes
* in one of the specific files.
* Note that you can and may override resources
* which also have a neutral version. This is to
* get localized bitmaps for example.
*/
#include "wps_En.rc"
name wineps
type win32
init PSDRV_Init
rsrc wineps
import user32.dll
import gdi32.dll
import kernel32.dll
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
PAPER DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
CAPTION "Paper"
FONT 8, "Helv"
{
LTEXT "Paper Si&ze:", -1, 7, 6, 100, 8
LISTBOX IDD_PAPERS, 10, 15, 200, 45, LBS_STANDARD | LBS_HASSTRINGS |
WS_TABSTOP
GROUPBOX "Orientation", -1, 10, 80, 200, 50
CONTROL "&Portrait", IDD_ORIENT_PORTRAIT, "Button", BS_AUTORADIOBUTTON |
WS_TABSTOP, 20, 90, 60, 10
CONTROL "&Landscape", IDD_ORIENT_LANDSCAPE, "Button", BS_AUTORADIOBUTTON,
20, 110, 60, 10
}
/*
* Language neutral resources for wineps
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment