ReactOS  0.4.15-dev-4863-gba0d16f
printdlg.c File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winspool.h"
#include "winerror.h"
#include "objbase.h"
#include "commdlg.h"
#include "wine/debug.h"
#include "dlgs.h"
#include "cderr.h"
#include "cdlg.h"
Include dependency graph for printdlg.c:

Go to the source code of this file.

Classes

struct  PRINT_PTRA
 
struct  PRINT_PTRW
 
struct  pd_flags
 
struct  pagesetup_data
 
struct  callback_data
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define UPDOWN_ID   0x270f
 
#define MAX_COPIES   9999
 

Enumerations

enum  devnames_name { devnames_driver_name, devnames_device_name, devnames_output_name }
 
enum  hook_type { page_setup_hook, page_paint_hook }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
static LPWSTR strdupW (LPCWSTR p)
 
static DRIVER_INFO_3Wget_driver_infoW (HANDLE hprn)
 
static DRIVER_INFO_3Aget_driver_infoA (HANDLE hprn)
 
static PRINTER_INFO_2Wget_printer_infoW (HANDLE hprn)
 
static PRINTER_INFO_2Aget_printer_infoA (HANDLE hprn)
 
static HGLOBAL update_devmode_handleW (HGLOBAL hdm, DEVMODEW *dm)
 
static HGLOBAL update_devmode_handleA (HGLOBAL hdm, DEVMODEA *dm)
 
static DEVMODEAconvert_to_devmodeA (const DEVMODEW *dmW)
 
static BOOL PRINTDLG_OpenDefaultPrinter (HANDLE *hprn)
 
static INT PRINTDLG_SetUpPrinterListComboA (HWND hDlg, UINT id, LPCSTR name)
 
static INT PRINTDLG_SetUpPrinterListComboW (HWND hDlg, UINT id, LPCWSTR name)
 
static BOOL PRINTDLG_CreateDevNames (HGLOBAL *hmem, const char *DeviceDriverName, const char *DeviceName, const char *OutputPort)
 
static BOOL PRINTDLG_CreateDevNamesW (HGLOBAL *hmem, LPCWSTR DeviceDriverName, LPCWSTR DeviceName, LPCWSTR OutputPort)
 
static BOOL PRINTDLG_UpdatePrintDlgA (HWND hDlg, PRINT_PTRA *PrintStructures)
 
static BOOL PRINTDLG_UpdatePrintDlgW (HWND hDlg, PRINT_PTRW *PrintStructures)
 
static BOOL PRINTDLG_SetUpPaperComboBoxA (HWND hDlg, int nIDComboBox, char *PrinterName, char *PortName, LPDEVMODEA dm)
 
static BOOL PRINTDLG_SetUpPaperComboBoxW (HWND hDlg, int nIDComboBox, const WCHAR *PrinterName, const WCHAR *PortName, LPDEVMODEW dm)
 
static void PRINTDLG_UpdatePrinterInfoTextsA (HWND hDlg, const PRINTER_INFO_2A *pi)
 
static void PRINTDLG_UpdatePrinterInfoTextsW (HWND hDlg, const PRINTER_INFO_2W *pi)
 
static BOOL PRINTDLG_ChangePrinterA (HWND hDlg, char *name, PRINT_PTRA *PrintStructures)
 
static BOOL PRINTDLG_ChangePrinterW (HWND hDlg, WCHAR *name, PRINT_PTRW *PrintStructures)
 
static LRESULT check_printer_setup (HWND hDlg)
 
static LRESULT PRINTDLG_WMInitDialog (HWND hDlg, PRINT_PTRA *PrintStructures)
 
static LRESULT PRINTDLG_WMInitDialogW (HWND hDlg, PRINT_PTRW *PrintStructures)
 
static LRESULT PRINTDLG_WMCommandA (HWND hDlg, WPARAM wParam, PRINT_PTRA *PrintStructures)
 
static LRESULT PRINTDLG_WMCommandW (HWND hDlg, WPARAM wParam, PRINT_PTRW *PrintStructures)
 
static INT_PTR CALLBACK PrintDlgProcA (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK PrintDlgProcW (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static HGLOBAL PRINTDLG_GetDlgTemplateA (const PRINTDLGA *lppd)
 
static HGLOBAL PRINTDLG_GetDlgTemplateW (const PRINTDLGW *lppd)
 
static BOOL PRINTDLG_CreateDCA (LPPRINTDLGA lppd)
 
static BOOL PRINTDLG_CreateDCW (LPPRINTDLGW lppd)
 
BOOL WINAPI PrintDlgA (LPPRINTDLGA lppd)
 
BOOL WINAPI PrintDlgW (LPPRINTDLGW lppd)
 
static DWORD pagesetup_get_flags (const pagesetup_data *data)
 
static BOOL is_metric (const pagesetup_data *data)
 
static LONG tenths_mm_to_size (const pagesetup_data *data, LONG size)
 
static LONG thousandths_inch_to_size (const pagesetup_data *data, LONG size)
 
static WCHAR get_decimal_sep (void)
 
static void size2str (const pagesetup_data *data, DWORD size, LPWSTR strout)
 
static BOOL is_default_metric (void)
 
static void rotate_rect (RECT *rc, BOOL sense)
 
static void pagesetup_set_orientation (pagesetup_data *data, WORD orient)
 
static WORD pagesetup_get_orientation (const pagesetup_data *data)
 
static void pagesetup_set_papersize (pagesetup_data *data, WORD paper)
 
static WORD pagesetup_get_papersize (const pagesetup_data *data)
 
static void pagesetup_set_defaultsource (pagesetup_data *data, WORD source)
 
static WORD get_devname_offset (const DEVNAMES *dn, devnames_name which)
 
static WCHARpagesetup_get_a_devname (const pagesetup_data *data, devnames_name which)
 
static WCHARpagesetup_get_drvname (const pagesetup_data *data)
 
static WCHARpagesetup_get_devname (const pagesetup_data *data)
 
static WCHARpagesetup_get_portname (const pagesetup_data *data)
 
static void pagesetup_release_a_devname (const pagesetup_data *data, WCHAR *name)
 
static void pagesetup_set_devnames (pagesetup_data *data, LPCWSTR drv, LPCWSTR devname, LPCWSTR port)
 
static DEVMODEWpagesetup_get_devmode (const pagesetup_data *data)
 
static void pagesetup_release_devmode (const pagesetup_data *data, DEVMODEW *dm)
 
static void pagesetup_set_devmode (pagesetup_data *data, DEVMODEW *dm)
 
static POINTpagesetup_get_papersize_pt (const pagesetup_data *data)
 
static RECTpagesetup_get_margin_rect (const pagesetup_data *data)
 
static LPPAGESETUPHOOK pagesetup_get_hook (const pagesetup_data *data, hook_type which)
 
static LPARAM pagesetup_get_dlg_struct (const pagesetup_data *data)
 
static void swap_point (POINT *pt)
 
static BOOL pagesetup_update_papersize (pagesetup_data *data)
 
static BOOL pagesetup_change_printer (LPWSTR name, pagesetup_data *data)
 
static void pagesetup_init_combos (HWND hDlg, pagesetup_data *data)
 
static void pagesetup_change_printer_dialog (HWND hDlg, pagesetup_data *data)
 
static void pagesetup_change_preview (const pagesetup_data *data)
 
static LONGelement_from_margin_id (RECT *rc, WORD id)
 
static void update_margin_edits (HWND hDlg, const pagesetup_data *data, WORD id)
 
static void margin_edit_notification (HWND hDlg, const pagesetup_data *data, WORD msg, WORD id)
 
static void set_margin_groupbox_title (HWND hDlg, const pagesetup_data *data)
 
static void pagesetup_update_orientation_buttons (HWND hDlg, const pagesetup_data *data)
 
static void pagesetup_printer_properties (HWND hDlg, pagesetup_data *data)
 
static BOOL pagesetup_wm_command (HWND hDlg, WPARAM wParam, LPARAM lParam, pagesetup_data *data)
 
static UINT_PTR default_page_paint_hook (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, const pagesetup_data *data)
 
static LRESULT CALLBACK PRINTDLG_PagePaintProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK pagesetup_margin_editproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void subclass_margin_edits (HWND hDlg)
 
static INT_PTR CALLBACK pagesetup_dlg_proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static WCHARget_default_printer (void)
 
static void pagesetup_dump_dlg_struct (const pagesetup_data *data)
 
static voidpagesetup_get_template (pagesetup_data *data)
 
static BOOL pagesetup_common (pagesetup_data *data)
 
BOOL WINAPI PageSetupDlgA (LPPAGESETUPDLGA setupdlg)
 
BOOL WINAPI PageSetupDlgW (LPPAGESETUPDLGW setupdlg)
 
static void pdlgex_to_pdlg (const PRINTDLGEXW *pdlgex, PRINTDLGW *pdlg)
 
static void pdlg_to_pdlgex (const PRINTDLGW *pdlg, PRINTDLGEXW *pdlgex)
 
static UINT_PTR CALLBACK pdlgex_hook_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
HRESULT WINAPI PrintDlgExA (LPPRINTDLGEXA lppd)
 
HRESULT WINAPI PrintDlgExW (LPPRINTDLGEXW lppd)
 

Variables

static const struct pd_flags psd_flags []
 
static const struct pd_flags pd_flags []
 
static WNDPROC lpfnStaticWndProc
 
static WNDPROC edit_wndproc
 
static WCHAR wszFakeDocumentText [1024]
 
static const WCHAR pd32_collateW [] = { 'P', 'D', '3', '2', '_', 'C', 'O', 'L', 'L', 'A', 'T', 'E', 0 }
 
static const WCHAR pd32_nocollateW [] = { 'P', 'D', '3', '2', '_', 'N', 'O', 'C', 'O', 'L', 'L', 'A', 'T', 'E', 0 }
 
static const WCHAR pd32_portraitW [] = { 'P', 'D', '3', '2', '_', 'P', 'O', 'R', 'T', 'R', 'A', 'I', 'T', 0 }
 
static const WCHAR pd32_landscapeW [] = { 'P', 'D', '3', '2', '_', 'L', 'A', 'N', 'D', 'S', 'C', 'A', 'P', 'E', 0 }
 
static const WCHAR printdlg_prop [] = {'_','_','W','I','N','E','_','P','R','I','N','T','D','L','G','D','A','T','A',0}
 
static const WCHAR pagesetupdlg_prop []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 31 of file printdlg.c.

◆ MAX_COPIES

#define MAX_COPIES   9999

Definition at line 53 of file printdlg.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 33 of file printdlg.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 32 of file printdlg.c.

◆ UPDOWN_ID

#define UPDOWN_ID   0x270f

Definition at line 52 of file printdlg.c.

Enumeration Type Documentation

◆ devnames_name

Enumerator
devnames_driver_name 
devnames_device_name 
devnames_output_name 

Definition at line 2767 of file printdlg.c.

◆ hook_type

Enumerator
page_setup_hook 
page_paint_hook 

Definition at line 2956 of file printdlg.c.

2957 {
2960 } hook_type;
hook_type
Definition: printdlg.c:2956

Function Documentation

◆ check_printer_setup()

static LRESULT check_printer_setup ( HWND  hDlg)
static

Definition at line 1453 of file printdlg.c.

1454 {
1455  DWORD needed,num;
1456  WCHAR resourcestr[256],resultstr[256];
1457 
1458  EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num);
1459  if(needed == 0)
1460  {
1461  EnumPrintersW(PRINTER_ENUM_CONNECTIONS, NULL, 2, NULL, 0, &needed, &num);
1462  }
1463  if(needed > 0)
1464  return TRUE;
1465  else
1466  {
1468  LoadStringW(COMDLG32_hInstance, PD32_PRINT_TITLE,resourcestr, 255);
1469  MessageBoxW(hDlg, resultstr, resourcestr,MB_OK | MB_ICONWARNING);
1470  return FALSE;
1471  }
1472 }
#define PD32_NO_DEVICES
Definition: cdlg.h:64
#define PRINTER_ENUM_CONNECTIONS
Definition: winspool.h:897
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define TRUE
Definition: types.h:120
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONWARNING
Definition: winuser.h:780
#define FALSE
Definition: types.h:117
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PRINTER_ENUM_LOCAL
Definition: winspool.h:896
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
WINBOOL WINAPI EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define PD32_PRINT_TITLE
Definition: cdlg.h:50

Referenced by PrintDlgProcA(), and PrintDlgProcW().

◆ convert_to_devmodeA()

static DEVMODEA* convert_to_devmodeA ( const DEVMODEW dmW)
static

Definition at line 325 of file printdlg.c.

326 {
327  DEVMODEA *dmA;
328  DWORD size;
329 
330  if (!dmW) return NULL;
331  size = dmW->dmSize - CCHDEVICENAME -
332  ((dmW->dmSize > FIELD_OFFSET(DEVMODEW, dmFormName)) ? CCHFORMNAME : 0);
333 
334  dmA = HeapAlloc(GetProcessHeap(), 0, size + dmW->dmDriverExtra);
335  if (!dmA) return NULL;
336 
339 
340  if (FIELD_OFFSET(DEVMODEW, dmFormName) >= dmW->dmSize)
341  {
342  memcpy(&dmA->dmSpecVersion, &dmW->dmSpecVersion,
343  dmW->dmSize - FIELD_OFFSET(DEVMODEW, dmSpecVersion));
344  }
345  else
346  {
347  memcpy(&dmA->dmSpecVersion, &dmW->dmSpecVersion,
348  FIELD_OFFSET(DEVMODEW, dmFormName) - FIELD_OFFSET(DEVMODEW, dmSpecVersion));
351 
352  memcpy(&dmA->dmLogPixels, &dmW->dmLogPixels, dmW->dmSize - FIELD_OFFSET(DEVMODEW, dmLogPixels));
353  }
354 
355  dmA->dmSize = size;
356  memcpy((char *)dmA + dmA->dmSize, (const char *)dmW + dmW->dmSize, dmW->dmDriverExtra);
357  return dmA;
358 }
#define WideCharToMultiByte
Definition: compat.h:111
WORD dmSize
Definition: wingdi.h:1568
#define CP_ACP
Definition: compat.h:109
WORD dmDriverExtra
Definition: wingdi.h:1621
WCHAR dmFormName[CCHFORMNAME]
Definition: wingdi.h:1645
char * LPSTR
Definition: xmlstorage.h:182
BYTE dmFormName[CCHFORMNAME]
Definition: wingdi.h:1593
WORD dmLogPixels
Definition: wingdi.h:1646
WORD dmSpecVersion
Definition: wingdi.h:1566
WORD dmSpecVersion
Definition: wingdi.h:1618
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WORD dmSize
Definition: wingdi.h:1620
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1617
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CCHFORMNAME
Definition: wingdi.h:67
#define CCHDEVICENAME
Definition: ddrawi.h:63
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
WORD dmLogPixels
Definition: wingdi.h:1594
#define NULL
Definition: types.h:112
BYTE dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1565

Referenced by pagesetup_set_devmode().

◆ default_page_paint_hook()

static UINT_PTR default_page_paint_hook ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
const pagesetup_data data 
)
static

Definition at line 3457 of file printdlg.c.

3459 {
3460  LPRECT lprc = (LPRECT) lParam;
3461  HDC hdc = (HDC) wParam;
3462  HPEN hpen, holdpen;
3463  LOGFONTW lf;
3464  HFONT hfont, holdfont;
3465  INT oldbkmode;
3466  TRACE("uMsg: WM_USER+%d\n",uMsg-WM_USER);
3467  /* Call user paint hook if enable */
3469  if (pagesetup_get_hook(data, page_paint_hook)(hwndDlg, uMsg, wParam, lParam))
3470  return TRUE;
3471 
3472  switch (uMsg) {
3473  /* LPPAGESETUPDLG in lParam */
3474  case WM_PSD_PAGESETUPDLG:
3475  /* Inform about the sample page rectangle */
3476  case WM_PSD_FULLPAGERECT:
3477  /* Inform about the margin rectangle */
3478  case WM_PSD_MINMARGINRECT:
3479  return FALSE;
3480 
3481  /* Draw dashed rectangle showing margins */
3482  case WM_PSD_MARGINRECT:
3484  holdpen = SelectObject(hdc, hpen);
3486  DeleteObject(SelectObject(hdc, holdpen));
3487  return TRUE;
3488  /* Draw the fake document */
3489  case WM_PSD_GREEKTEXTRECT:
3490  /* select a nice scalable font, because we want the text really small */
3491  SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
3492  lf.lfHeight = 6; /* value chosen based on visual effect */
3493  hfont = CreateFontIndirectW(&lf);
3494  holdfont = SelectObject(hdc, hfont);
3495 
3496  /* if text not loaded, then do so now */
3497  if (wszFakeDocumentText[0] == '\0')
3502 
3503  oldbkmode = SetBkMode(hdc, TRANSPARENT);
3505  SetBkMode(hdc, oldbkmode);
3506 
3507  DeleteObject(SelectObject(hdc, holdfont));
3508  return TRUE;
3509 
3510  /* Envelope stamp */
3511  case WM_PSD_ENVSTAMPRECT:
3512  /* Return address */
3513  case WM_PSD_YAFULLPAGERECT:
3514  FIXME("envelope/stamp is not implemented\n");
3515  return FALSE;
3516  default:
3517  FIXME("Unknown message %x\n",uMsg);
3518  return FALSE;
3519  }
3520  return TRUE;
3521 }
#define WM_PSD_FULLPAGERECT
Definition: commdlg.h:189
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4445
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
#define IDS_FAKEDOCTEXT
Definition: cdlg.h:185
#define DT_WORDBREAK
Definition: winuser.h:544
LONG lfHeight
Definition: dimm.idl:59
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static HPEN hpen
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define WM_PSD_GREEKTEXTRECT
Definition: commdlg.h:192
#define DT_NOPREFIX
Definition: winuser.h:537
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define COLOR_3DSHADOW
Definition: winuser.h:925
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define FALSE
Definition: types.h:117
#define DT_LEFT
Definition: winuser.h:534
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRANSPARENT
Definition: wingdi.h:950
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define LPRECT
Definition: precomp.h:28
static HFONT hfont
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
static WCHAR wszFakeDocumentText[1024]
Definition: printdlg.c:143
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2962
#define WM_PSD_MARGINRECT
Definition: commdlg.h:191
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WM_PSD_PAGESETUPDLG
Definition: commdlg.h:188
HDC hdc
Definition: main.c:9
#define WM_PSD_YAFULLPAGERECT
Definition: commdlg.h:194
#define PS_DASH
Definition: wingdi.h:587
#define WM_USER
Definition: winuser.h:1882
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DT_TOP
Definition: winuser.h:542
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1367
#define WM_PSD_MINMARGINRECT
Definition: commdlg.h:190
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:309
LPARAM lParam
Definition: combotst.c:139
#define WM_PSD_ENVSTAMPRECT
Definition: commdlg.h:193
#define PSD_ENABLEPAGEPAINTHOOK
Definition: commdlg.h:186
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by PRINTDLG_PagePaintProc().

◆ element_from_margin_id()

static LONG* element_from_margin_id ( RECT rc,
WORD  id 
)
inlinestatic

Definition at line 3221 of file printdlg.c.

3222 {
3223  switch(id)
3224  {
3225  case edt4: return &rc->left;
3226  case edt5: return &rc->top;
3227  case edt6: return &rc->right;
3228  case edt7: return &rc->bottom;
3229  }
3230  return NULL;
3231 }
#define edt5
Definition: dlgs.h:69
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define edt4
Definition: dlgs.h:68
#define NULL
Definition: types.h:112
#define edt7
Definition: dlgs.h:71
LONG bottom
Definition: windef.h:309
#define edt6
Definition: dlgs.h:70

Referenced by margin_edit_notification(), and update_margin_edits().

◆ get_decimal_sep()

static WCHAR get_decimal_sep ( void  )
static

Definition at line 2618 of file printdlg.c.

2619 {
2620  static WCHAR sep;
2621 
2622  if(!sep)
2623  {
2624  WCHAR buf[] = {'.', 0};
2626  sep = buf[0];
2627  }
2628  return sep;
2629 }
#define LOCALE_USER_DEFAULT
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LOCALE_SDECIMAL
Definition: winnls.h:42
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by margin_edit_notification(), pagesetup_margin_editproc(), and size2str().

◆ get_default_printer()

static WCHAR* get_default_printer ( void  )
static

Definition at line 3777 of file printdlg.c.

3778 {
3779  WCHAR *name = NULL;
3780  DWORD len = 0;
3781 
3783  if(len)
3784  {
3785  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
3787  }
3788  return name;
3789 }
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1942
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by pagesetup_common().

◆ get_devname_offset()

static WORD get_devname_offset ( const DEVNAMES dn,
devnames_name  which 
)
inlinestatic

Definition at line 2775 of file printdlg.c.

2776 {
2777  switch(which)
2778  {
2779  case devnames_driver_name: return dn->wDriverOffset;
2780  case devnames_device_name: return dn->wDeviceOffset;
2781  case devnames_output_name: return dn->wOutputOffset;
2782  }
2783  ERR("Shouldn't be here\n");
2784  return 0;
2785 }
static GLenum which
Definition: wgl_font.c:159
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
#define ERR(fmt,...)
Definition: debug.h:110
WORD wOutputOffset
Definition: commdlg.h:299

Referenced by pagesetup_get_a_devname().

◆ get_driver_infoA()

static DRIVER_INFO_3A* get_driver_infoA ( HANDLE  hprn)
static

Definition at line 191 of file printdlg.c.

192 {
193  DRIVER_INFO_3A *di3 = NULL;
194  DWORD needed = 0;
195  BOOL res;
196 
197  res = GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
198  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
199  di3 = HeapAlloc(GetProcessHeap(), 0, needed);
200  res = GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)di3, needed, &needed);
201  }
202 
203  if (res)
204  return di3;
205 
206  TRACE("GetPrinterDriverA failed with %u\n", GetLastError());
207  HeapFree(GetProcessHeap(), 0, di3);
208  return NULL;
209 }
WINBOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExA().

◆ get_driver_infoW()

static DRIVER_INFO_3W* get_driver_infoW ( HANDLE  hprn)
static

Definition at line 171 of file printdlg.c.

172 {
173  DRIVER_INFO_3W *di3 = NULL;
174  DWORD needed = 0;
175  BOOL res;
176 
177  res = GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
178  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
179  di3 = HeapAlloc(GetProcessHeap(), 0, needed);
180  res = GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)di3, needed, &needed);
181  }
182 
183  if (res)
184  return di3;
185 
186  TRACE("GetPrinterDriverW failed with %u\n", GetLastError());
187  HeapFree(GetProcessHeap(), 0, di3);
188  return NULL;
189 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExW().

◆ get_printer_infoA()

static PRINTER_INFO_2A* get_printer_infoA ( HANDLE  hprn)
static

Definition at line 238 of file printdlg.c.

239 {
240  PRINTER_INFO_2A *pi2 = NULL;
241  DWORD needed = 0;
242  BOOL res;
243 
244  res = GetPrinterA(hprn, 2, NULL, 0, &needed);
245  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
246  pi2 = HeapAlloc(GetProcessHeap(), 0, needed);
247  res = GetPrinterA(hprn, 2, (LPBYTE)pi2, needed, &needed);
248  }
249 
250  if (res)
251  return pi2;
252 
253  TRACE("GetPrinterA failed with %u\n", GetLastError());
254  HeapFree(GetProcessHeap(), 0, pi2);
255  return NULL;
256 }
WINBOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2033
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExA().

◆ get_printer_infoW()

static PRINTER_INFO_2W* get_printer_infoW ( HANDLE  hprn)
static

Definition at line 218 of file printdlg.c.

219 {
220  PRINTER_INFO_2W *pi2 = NULL;
221  DWORD needed = 0;
222  BOOL res;
223 
224  res = GetPrinterW(hprn, 2, NULL, 0, &needed);
225  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
226  pi2 = HeapAlloc(GetProcessHeap(), 0, needed);
227  res = GetPrinterW(hprn, 2, (LPBYTE)pi2, needed, &needed);
228  }
229 
230  if (res)
231  return pi2;
232 
233  TRACE("GetPrinterW failed with %u\n", GetLastError());
234  HeapFree(GetProcessHeap(), 0, pi2);
235  return NULL;
236 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2504
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExW().

◆ is_default_metric()

static BOOL is_default_metric ( void  )
inlinestatic

Definition at line 2656 of file printdlg.c.

2657 {
2658  DWORD system;
2659  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
2660  (LPWSTR)&system, sizeof(system));
2661  return system == 0;
2662 }
#define LOCALE_USER_DEFAULT
#define LOCALE_IMEASURE
Definition: winnls.h:41
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
int __cdecl system(_In_opt_z_ const char *_Command)
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by pagesetup_common().

◆ is_metric()

static BOOL is_metric ( const pagesetup_data data)
inlinestatic

Definition at line 2597 of file printdlg.c.

2598 {
2600 }
#define PSD_INHUNDREDTHSOFMILLIMETERS
Definition: commdlg.h:175
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by margin_edit_notification(), set_margin_groupbox_title(), size2str(), tenths_mm_to_size(), and thousandths_inch_to_size().

◆ margin_edit_notification()

static void margin_edit_notification ( HWND  hDlg,
const pagesetup_data data,
WORD  msg,
WORD  id 
)
static

Definition at line 3248 of file printdlg.c.

3249 {
3250  switch (msg)
3251  {
3252  case EN_CHANGE:
3253  {
3254  WCHAR buf[10];
3255  LONG val = 0;
3257 
3258  if (GetDlgItemTextW(hDlg, id, buf, ARRAY_SIZE(buf)) != 0)
3259  {
3260  WCHAR *end;
3261  WCHAR decimal = get_decimal_sep();
3262 
3263  val = wcstol(buf, &end, 10);
3264  if(end != buf || *end == decimal)
3265  {
3266  int mult = is_metric(data) ? 100 : 1000;
3267  val *= mult;
3268  if(*end == decimal)
3269  {
3270  while(mult > 1)
3271  {
3272  end++;
3273  mult /= 10;
3274  if(iswdigit(*end))
3275  val += (*end - '0') * mult;
3276  else
3277  break;
3278  }
3279  }
3280  }
3281  }
3282  *value = val;
3283  return;
3284  }
3285 
3286  case EN_KILLFOCUS:
3287  update_margin_edits(hDlg, data, id);
3288  return;
3289  }
3290 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
Definition: pdh_main.c:93
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3233
#define iswdigit(_c)
Definition: ctype.h:667
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
static WCHAR get_decimal_sep(void)
Definition: printdlg.c:2618
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define EN_KILLFOCUS
Definition: winuser.h:2012
long LONG
Definition: pedump.c:60
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint end
Definition: gl.h:1545
static BOOL is_metric(const pagesetup_data *data)
Definition: printdlg.c:2597
#define ARRAY_SIZE(a)
Definition: main.h:24
static LONG * element_from_margin_id(RECT *rc, WORD id)
Definition: printdlg.c:3221
#define msg(x)
Definition: auth_time.c:54
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2951
#define EN_CHANGE
Definition: winuser.h:2009

Referenced by pagesetup_wm_command().

◆ pagesetup_change_preview()

static void pagesetup_change_preview ( const pagesetup_data data)
static

Definition at line 3190 of file printdlg.c.

3191 {
3192  LONG width, height, x, y;
3193  RECT tmp;
3194  const int shadow = 4;
3195 
3197  {
3198  width = data->rtDrawRect.right - data->rtDrawRect.left;
3200  }
3201  else
3202  {
3203  height = data->rtDrawRect.bottom - data->rtDrawRect.top;
3205  }
3206  x = (data->rtDrawRect.right + data->rtDrawRect.left - width) / 2;
3207  y = (data->rtDrawRect.bottom + data->rtDrawRect.top - height) / 2;
3208  TRACE("draw rect %s x=%d, y=%d, w=%d, h=%d\n",
3209  wine_dbgstr_rect(&data->rtDrawRect), x, y, width, height);
3210 
3211  MoveWindow(GetDlgItem(data->hDlg, rct2), x + width, y + shadow, shadow, height, FALSE);
3212  MoveWindow(GetDlgItem(data->hDlg, rct3), x + shadow, y + height, width, shadow, FALSE);
3213  MoveWindow(GetDlgItem(data->hDlg, rct1), x, y, width, height, FALSE);
3214 
3215  tmp = data->rtDrawRect;
3216  tmp.right += shadow;
3217  tmp.bottom += shadow;
3218  InvalidateRect(data->hDlg, &tmp, TRUE);
3219 }
GLint GLint GLsizei width
Definition: gl.h:1546
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2946
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1111
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2707
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define rct3
Definition: dlgs.h:149
LONG bottom
Definition: windef.h:309
#define rct1
Definition: dlgs.h:147
#define rct2
Definition: dlgs.h:148

Referenced by pagesetup_dlg_proc(), pagesetup_printer_properties(), and pagesetup_wm_command().

◆ pagesetup_change_printer()

static BOOL pagesetup_change_printer ( LPWSTR  name,
pagesetup_data data 
)
static

Definition at line 3058 of file printdlg.c.

3059 {
3060  HANDLE hprn;
3061  DWORD needed;
3062  PRINTER_INFO_2W *prn_info = NULL;
3063  DRIVER_INFO_3W *drv_info = NULL;
3064  DEVMODEW *dm = NULL;
3065  BOOL retval = FALSE;
3066 
3067  if(!OpenPrinterW(name, &hprn, NULL))
3068  {
3069  ERR("Can't open printer %s\n", debugstr_w(name));
3070  goto end;
3071  }
3072 
3073  GetPrinterW(hprn, 2, NULL, 0, &needed);
3074  prn_info = HeapAlloc(GetProcessHeap(), 0, needed);
3075  GetPrinterW(hprn, 2, (LPBYTE)prn_info, needed, &needed);
3076  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
3077  drv_info = HeapAlloc(GetProcessHeap(), 0, needed);
3078  if(!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)drv_info, needed, &needed))
3079  {
3080  ERR("GetPrinterDriverA failed for %s, fix your config!\n", debugstr_w(prn_info->pPrinterName));
3081  goto end;
3082  }
3083  ClosePrinter(hprn);
3084 
3085  needed = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
3086  if(needed == -1)
3087  {
3088  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
3089  goto end;
3090  }
3091 
3092  dm = HeapAlloc(GetProcessHeap(), 0, needed);
3094 
3096  pagesetup_set_devnames(data, drv_info->pDriverPath, prn_info->pPrinterName,
3097  prn_info->pPortName);
3098 
3099  retval = TRUE;
3100 end:
3101  HeapFree(GetProcessHeap(), 0, dm);
3102  HeapFree(GetProcessHeap(), 0, prn_info);
3103  HeapFree(GetProcessHeap(), 0, drv_info);
3104  return retval;
3105 }
#define TRUE
Definition: types.h:120
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:1153
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DM_OUT_BUFFER
Definition: windef.h:359
#define debugstr_w
Definition: kernel32.h:32
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2916
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2504
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint end
Definition: gl.h:1545
#define ERR(fmt,...)
Definition: debug.h:110
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2624
#define NULL
Definition: types.h:112
LPWSTR pPortName
Definition: winspool.h:65
Definition: name.c:38
LPWSTR pPrinterName
Definition: winspool.h:63
static void pagesetup_set_devnames(pagesetup_data *data, LPCWSTR drv, LPCWSTR devname, LPCWSTR port)
Definition: printdlg.c:2825
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by pagesetup_common(), and pagesetup_wm_command().

◆ pagesetup_change_printer_dialog()

static void pagesetup_change_printer_dialog ( HWND  hDlg,
pagesetup_data data 
)
static

Definition at line 3139 of file printdlg.c.

3140 {
3141  PRINTDLGW prnt;
3142  LPWSTR drvname, devname, portname;
3143  DEVMODEW *tmp_dm, *dm;
3144 
3145  memset(&prnt, 0, sizeof(prnt));
3146  prnt.lStructSize = sizeof(prnt);
3147  prnt.Flags = 0;
3148  prnt.hwndOwner = hDlg;
3149 
3150  drvname = pagesetup_get_drvname(data);
3151  devname = pagesetup_get_devname(data);
3152  portname = pagesetup_get_portname(data);
3153  prnt.hDevNames = 0;
3154  PRINTDLG_CreateDevNamesW(&prnt.hDevNames, drvname, devname, portname);
3155  pagesetup_release_a_devname(data, portname);
3158 
3159  tmp_dm = pagesetup_get_devmode(data);
3160  prnt.hDevMode = GlobalAlloc(GMEM_MOVEABLE, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3161  dm = GlobalLock(prnt.hDevMode);
3162  memcpy(dm, tmp_dm, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3163  GlobalUnlock(prnt.hDevMode);
3165 
3166  if (PrintDlgW(&prnt))
3167  {
3168  DEVMODEW *dm = GlobalLock(prnt.hDevMode);
3169  DEVNAMES *dn = GlobalLock(prnt.hDevNames);
3170 
3172  (WCHAR*)dn + dn->wDeviceOffset, (WCHAR *)dn + dn->wOutputOffset);
3174  GlobalUnlock(prnt.hDevNames);
3175  GlobalUnlock(prnt.hDevMode);
3176  pagesetup_init_combos(hDlg, data);
3177  }
3178 
3179  GlobalFree(prnt.hDevMode);
3180  GlobalFree(prnt.hDevNames);
3181 
3182 }
static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName, LPCWSTR DeviceName, LPCWSTR OutputPort)
Definition: printdlg.c:530
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HWND hwndOwner
Definition: commdlg.h:487
HGLOBAL hDevNames
Definition: commdlg.h:489
WORD dmDriverExtra
Definition: wingdi.h:1621
DWORD Flags
Definition: commdlg.h:491
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2810
WORD wDeviceOffset
Definition: commdlg.h:298
BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
Definition: printdlg.c:2403
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD wDriverOffset
Definition: commdlg.h:297
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2916
DWORD lStructSize
Definition: commdlg.h:486
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2892
__wchar_t WCHAR
Definition: xmlstorage.h:180
WORD dmSize
Definition: wingdi.h:1620
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3113
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2911
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2815
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static void pagesetup_set_devnames(pagesetup_data *data, LPCWSTR drv, LPCWSTR devname, LPCWSTR port)
Definition: printdlg.c:2825
WORD wOutputOffset
Definition: commdlg.h:299
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2820
#define memset(x, y, z)
Definition: compat.h:39
static WCHAR * pagesetup_get_drvname(const pagesetup_data *data)
Definition: printdlg.c:2805
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by pagesetup_wm_command().

◆ pagesetup_common()

static BOOL pagesetup_common ( pagesetup_data data)
static

Definition at line 3842 of file printdlg.c.

3843 {
3844  BOOL ret;
3845  void *tmpl;
3846 
3848  {
3850  return FALSE;
3851  }
3852 
3854 
3855  if(data->u.dlgw->lStructSize != sizeof(PAGESETUPDLGW))
3856  {
3858  return FALSE;
3859  }
3860 
3863  {
3865  return FALSE;
3866  }
3867 
3869  data->u.dlgw->Flags |= is_default_metric() ?
3871 
3872  if (!data->u.dlgw->hDevMode || !data->u.dlgw->hDevNames)
3873  {
3874  WCHAR *def = get_default_printer();
3875  if(!def)
3876  {
3878  {
3879  WCHAR errstr[256];
3881  MessageBoxW(data->u.dlgw->hwndOwner, errstr, 0, MB_OK | MB_ICONERROR);
3882  }
3884  return FALSE;
3885  }
3887  HeapFree(GetProcessHeap(), 0, def);
3888  }
3889 
3891  {
3893  return TRUE;
3894  }
3895 
3896  tmpl = pagesetup_get_template(data);
3897 
3898  ret = DialogBoxIndirectParamW(data->u.dlgw->hInstance, tmpl,
3899  data->u.dlgw->hwndOwner,
3901  return ret;
3902 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define PSD_INHUNDREDTHSOFMILLIMETERS
Definition: commdlg.h:175
#define TRUE
Definition: types.h:120
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static WCHAR * get_default_printer(void)
Definition: printdlg.c:3777
#define PSD_NOWARNING
Definition: commdlg.h:178
#define CDERR_STRUCTSIZE
Definition: cderr.h:6
#define PDERR_NODEFAULTPRN
Definition: cderr.h:26
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2974
LONG_PTR LPARAM
Definition: windef.h:208
#define PD32_NO_DEFAULT_PRINTER
Definition: cdlg.h:59
#define GetProcessHeap()
Definition: compat.h:595
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL is_default_metric(void)
Definition: printdlg.c:2656
#define CDERR_INITIALIZATION
Definition: cderr.h:7
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2962
static void pagesetup_dump_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:3791
#define PSD_INTHOUSANDTHSOFINCHES
Definition: commdlg.h:174
static void * pagesetup_get_template(pagesetup_data *data)
Definition: printdlg.c:3814
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL pagesetup_update_papersize(pagesetup_data *data)
Definition: printdlg.c:2986
#define CDERR_NOHOOK
Definition: cderr.h:16
int ret
#define MB_ICONERROR
Definition: winuser.h:781
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:128
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define PSD_RETURNDEFAULT
Definition: commdlg.h:181
static BOOL pagesetup_change_printer(LPWSTR name, pagesetup_data *data)
Definition: printdlg.c:3058
static INT_PTR CALLBACK pagesetup_dlg_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: printdlg.c:3679
const char * errstr(int errcode)
#define HeapFree(x, y, z)
Definition: compat.h:594
#define PSD_ENABLEPAGEPAINTHOOK
Definition: commdlg.h:186
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by PageSetupDlgA(), and PageSetupDlgW().

◆ pagesetup_dlg_proc()

static INT_PTR CALLBACK pagesetup_dlg_proc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 3679 of file printdlg.c.

3680 {
3682  INT_PTR res = FALSE;
3683  HWND hDrawWnd;
3684 
3685  if (uMsg == WM_INITDIALOG) { /*Init dialog*/
3686  data = (pagesetup_data *)lParam;
3687  data->hDlg = hDlg;
3688 
3689  hDrawWnd = GetDlgItem(hDlg, rct1);
3690  TRACE("set property to %p\n", data);
3692  SetPropW(hDrawWnd, pagesetupdlg_prop, data);
3693  GetWindowRect(hDrawWnd, &data->rtDrawRect); /* Calculating rect in client coordinates where paper draws */
3694  MapWindowPoints( 0, hDlg, (LPPOINT)&data->rtDrawRect, 2 );
3696  hDrawWnd,
3697  GWLP_WNDPROC,
3699 
3700  /* FIXME: Paint hook. Must it be at begin of initialization or at end? */
3701  res = TRUE;
3703  {
3704  if (!pagesetup_get_hook(data, page_setup_hook)(hDlg, uMsg, wParam,
3706  FIXME("Setup page hook failed?\n");
3707  }
3708 
3709  /* if printer button disabled */
3711  EnableWindow(GetDlgItem(hDlg, psh3), FALSE);
3712  /* if margin edit boxes disabled */
3714  {
3715  EnableWindow(GetDlgItem(hDlg, edt4), FALSE);
3716  EnableWindow(GetDlgItem(hDlg, edt5), FALSE);
3717  EnableWindow(GetDlgItem(hDlg, edt6), FALSE);
3718  EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
3719  }
3720 
3721  /* Set orientation radiobuttons properly */
3723 
3724  /* if orientation disabled */
3726  {
3729  }
3730 
3731  /* We fill them out enabled or not */
3733  {
3734  /* default is 1 inch */
3737  }
3738  update_margin_edits(hDlg, data, 0);
3739  subclass_margin_edits(hDlg);
3741 
3742  /* if paper disabled */
3744  {
3747  }
3748 
3749  /* filling combos: printer, paper, source. selecting current printer (from DEVMODEA) */
3750  pagesetup_init_combos(hDlg, data);
3752  pagesetup_set_defaultsource(data, DMBIN_FORMSOURCE); /* FIXME: This is the auto select bin. Is this correct? */
3753 
3754  /* Drawing paper prev */
3756  return TRUE;
3757  } else {
3758  data = GetPropW(hDlg, pagesetupdlg_prop);
3759  if (!data)
3760  {
3761  WARN("__WINE_PAGESETUPDLGDATA prop not set?\n");
3762  return FALSE;
3763  }
3765  {
3767  if (res) return res;
3768  }
3769  }
3770  switch (uMsg) {
3771  case WM_COMMAND:
3772  return pagesetup_wm_command(hDlg, wParam, lParam, data);
3773  }
3774  return FALSE;
3775 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define PSD_DISABLEPRINTER
Definition: commdlg.h:177
#define TRUE
Definition: types.h:120
#define PSD_MARGINS
Definition: commdlg.h:173
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3233
#define WARN(fmt,...)
Definition: debug.h:112
#define edt5
Definition: dlgs.h:69
static BOOL pagesetup_wm_command(HWND hDlg, WPARAM wParam, LPARAM lParam, pagesetup_data *data)
Definition: printdlg.c:3371
static void pagesetup_update_orientation_buttons(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3301
int32_t INT_PTR
Definition: typedefs.h:64
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define rad2
Definition: dlgs.h:131
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2974
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:111
static WNDPROC lpfnStaticWndProc
Definition: printdlg.c:140
#define edt4
Definition: dlgs.h:68
#define PSD_DISABLEORIENTATION
Definition: commdlg.h:179
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3190
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2962
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3113
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL pagesetup_update_papersize(pagesetup_data *data)
Definition: printdlg.c:2986
#define WM_COMMAND
Definition: winuser.h:1727
static void set_margin_groupbox_title(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3292
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
#define cmb2
Definition: dlgs.h:49
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
Definition: printdlg.c:2753
#define cmb3
Definition: dlgs.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static void subclass_margin_edits(HWND hDlg)
Definition: printdlg.c:3660
#define edt7
Definition: dlgs.h:71
GLuint res
Definition: glext.h:9613
static LRESULT CALLBACK PRINTDLG_PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: printdlg.c:3556
#define DMBIN_FORMSOURCE
Definition: wingdi.h:1197
static const WCHAR pagesetupdlg_prop[]
Definition: printdlg.c:149
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SetWindowLongPtrW
Definition: winuser.h:5326
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2951
#define PSD_ENABLEPAGESETUPHOOK
Definition: commdlg.h:183
#define PSD_DISABLEMARGINS
Definition: commdlg.h:176
#define rct1
Definition: dlgs.h:147
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define PSD_DISABLEPAPER
Definition: commdlg.h:180
static LONG thousandths_inch_to_size(const pagesetup_data *data, LONG size)
Definition: printdlg.c:2610
#define rad1
Definition: dlgs.h:130
#define edt6
Definition: dlgs.h:70
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by pagesetup_common().

◆ pagesetup_dump_dlg_struct()

static void pagesetup_dump_dlg_struct ( const pagesetup_data data)
static

Definition at line 3791 of file printdlg.c.

3792 {
3793  if(TRACE_ON(commdlg))
3794  {
3795  char flagstr[1000] = "";
3796  const struct pd_flags *pflag = psd_flags;
3797  for( ; pflag->name; pflag++)
3798  {
3799  if(pagesetup_get_flags(data) & pflag->flag)
3800  {
3801  strcat(flagstr, pflag->name);
3802  strcat(flagstr, "|");
3803  }
3804  }
3805  TRACE("%s: (%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n"
3806  "hinst %p, flags %08x (%s)\n",
3807  data->unicode ? "unicode" : "ansi",
3808  data->u.dlgw, data->u.dlgw->hwndOwner, data->u.dlgw->hDevMode,
3809  data->u.dlgw->hDevNames, data->u.dlgw->hInstance,
3810  pagesetup_get_flags(data), flagstr);
3811  }
3812 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
LPCSTR name
Definition: printdlg.c:91
static const struct pd_flags psd_flags[]
Definition: printdlg.c:94
DWORD flag
Definition: printdlg.c:90
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define TRACE_ON(x)
Definition: compat.h:75
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by pagesetup_common().

◆ pagesetup_get_a_devname()

static WCHAR* pagesetup_get_a_devname ( const pagesetup_data data,
devnames_name  which 
)
static

Definition at line 2787 of file printdlg.c.

2788 {
2789  DEVNAMES *dn;
2790  WCHAR *name;
2791 
2792  dn = GlobalLock(data->u.dlgw->hDevNames);
2793  if(data->unicode)
2794  name = strdupW((WCHAR *)dn + get_devname_offset(dn, which));
2795  else
2796  {
2797  int len = MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, NULL, 0);
2798  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2799  MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, name, len);
2800  }
2801  GlobalUnlock(data->u.dlgw->hDevNames);
2802  return name;
2803 }
#define CP_ACP
Definition: compat.h:109
static GLenum which
Definition: wgl_font.c:159
static WORD get_devname_offset(const DEVNAMES *dn, devnames_name which)
Definition: printdlg.c:2775
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
GLenum GLsizei len
Definition: glext.h:6722
static LPWSTR strdupW(LPCWSTR p)
Definition: printdlg.c:153
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define MultiByteToWideChar
Definition: compat.h:110
Definition: name.c:38
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by pagesetup_get_devname(), pagesetup_get_drvname(), and pagesetup_get_portname().

◆ pagesetup_get_devmode()

static DEVMODEW* pagesetup_get_devmode ( const pagesetup_data data)
static

Definition at line 2892 of file printdlg.c.

2893 {
2894  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2895  DEVMODEW *ret;
2896 
2897  if(data->unicode)
2898  {
2899  /* We make a copy even in the unicode case because the ptr
2900  may get passed back to us in pagesetup_set_devmode. */
2901  ret = HeapAlloc(GetProcessHeap(), 0, dm->dmSize + dm->dmDriverExtra);
2902  memcpy(ret, dm, dm->dmSize + dm->dmDriverExtra);
2903  }
2904  else
2906 
2907  GlobalUnlock(data->u.dlgw->hDevMode);
2908  return ret;
2909 }
WORD dmDriverExtra
Definition: wingdi.h:1621
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:969
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WORD dmSize
Definition: wingdi.h:1620
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by pagesetup_change_printer_dialog(), pagesetup_init_combos(), pagesetup_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_get_devname()

static WCHAR* pagesetup_get_devname ( const pagesetup_data data)
static

Definition at line 2810 of file printdlg.c.

2811 {
2813 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2787
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by pagesetup_change_printer_dialog(), pagesetup_init_combos(), pagesetup_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_get_dlg_struct()

static LPARAM pagesetup_get_dlg_struct ( const pagesetup_data data)
inlinestatic

Definition at line 2974 of file printdlg.c.

2975 {
2976  return (LPARAM)data->u.dlgw;
2977 }
LONG_PTR LPARAM
Definition: windef.h:208
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by pagesetup_common(), pagesetup_dlg_proc(), and PRINTDLG_PagePaintProc().

◆ pagesetup_get_drvname()

static WCHAR* pagesetup_get_drvname ( const pagesetup_data data)
static

Definition at line 2805 of file printdlg.c.

2806 {
2808 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2787
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by pagesetup_change_printer_dialog().

◆ pagesetup_get_flags()

static DWORD pagesetup_get_flags ( const pagesetup_data data)
inlinestatic

Definition at line 2592 of file printdlg.c.

2593 {
2594  return data->u.dlgw->Flags;
2595 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by default_page_paint_hook(), is_metric(), pagesetup_common(), pagesetup_dlg_proc(), pagesetup_dump_dlg_struct(), and pagesetup_get_template().

◆ pagesetup_get_hook()

static LPPAGESETUPHOOK pagesetup_get_hook ( const pagesetup_data data,
hook_type  which 
)
inlinestatic

Definition at line 2962 of file printdlg.c.

2963 {
2964  switch(which)
2965  {
2966  case page_setup_hook: return data->u.dlgw->lpfnPageSetupHook;
2967  case page_paint_hook: return data->u.dlgw->lpfnPagePaintHook;
2968  }
2969  return NULL;
2970 }
static GLenum which
Definition: wgl_font.c:159
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define NULL
Definition: types.h:112

Referenced by default_page_paint_hook(), pagesetup_common(), and pagesetup_dlg_proc().

◆ pagesetup_get_margin_rect()

static RECT* pagesetup_get_margin_rect ( const pagesetup_data data)
inlinestatic

Definition at line 2951 of file printdlg.c.

2952 {
2953  return &data->u.dlgw->rtMargin;
2954 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by margin_edit_notification(), pagesetup_dlg_proc(), pagesetup_wm_command(), PRINTDLG_PagePaintProc(), and update_margin_edits().

◆ pagesetup_get_orientation()

static WORD pagesetup_get_orientation ( const pagesetup_data data)
static

Definition at line 2707 of file printdlg.c.

2708 {
2709  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2710  WORD orient;
2711 
2712  if(data->unicode)
2713  orient = dm->u1.s1.dmOrientation;
2714  else
2715  {
2716  DEVMODEA *dmA = (DEVMODEA *)dm;
2717  orient = dmA->u1.s1.dmOrientation;
2718  }
2719  GlobalUnlock(data->u.dlgw->hDevMode);
2720  return orient;
2721 }
short dmOrientation
Definition: wingdi.h:1625
short dmOrientation
Definition: wingdi.h:1573
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by pagesetup_change_preview(), pagesetup_update_orientation_buttons(), pagesetup_update_papersize(), and pagesetup_wm_command().

◆ pagesetup_get_papersize()

static WORD pagesetup_get_papersize ( const pagesetup_data data)
static

Definition at line 2737 of file printdlg.c.

2738 {
2739  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2740  WORD paper;
2741 
2742  if(data->unicode)
2743  paper = dm->u1.s1.dmPaperSize;
2744  else
2745  {
2746  DEVMODEA *dmA = (DEVMODEA *)dm;
2747  paper = dmA->u1.s1.dmPaperSize;
2748  }
2749  GlobalUnlock(data->u.dlgw->hDevMode);
2750  return paper;
2751 }
short dmPaperSize
Definition: wingdi.h:1626
short dmPaperSize
Definition: wingdi.h:1574
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by pagesetup_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_get_papersize_pt()

static POINT* pagesetup_get_papersize_pt ( const pagesetup_data data)
inlinestatic

Definition at line 2946 of file printdlg.c.

2947 {
2948  return &data->u.dlgw->ptPaperSize;
2949 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by pagesetup_change_preview(), pagesetup_update_papersize(), and PRINTDLG_PagePaintProc().

◆ pagesetup_get_portname()

static WCHAR* pagesetup_get_portname ( const pagesetup_data data)
static

Definition at line 2815 of file printdlg.c.

2816 {
2818 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2787
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by pagesetup_change_printer_dialog(), pagesetup_init_combos(), and pagesetup_update_papersize().

◆ pagesetup_get_template()

static void* pagesetup_get_template ( pagesetup_data data)
static

Definition at line 3814 of file printdlg.c.

3815 {
3816  HRSRC res;
3817  HGLOBAL tmpl_handle;
3818 
3820  {
3821  tmpl_handle = data->u.dlgw->hPageSetupTemplate;
3822  }
3824  {
3825  if(data->unicode)
3826  res = FindResourceW(data->u.dlgw->hInstance,
3827  data->u.dlgw->lpPageSetupTemplateName, (LPWSTR)RT_DIALOG);
3828  else
3829  res = FindResourceA(data->u.dlga->hInstance,
3830  data->u.dlga->lpPageSetupTemplateName, (LPSTR)RT_DIALOG);
3831  tmpl_handle = LoadResource(data->u.dlgw->hInstance, res);
3832  }
3833  else
3834  {
3836  (LPWSTR)RT_DIALOG);
3837  tmpl_handle = LoadResource(COMDLG32_hInstance, res);
3838  }
3839  return LockResource(tmpl_handle);
3840 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define PSD_ENABLEPAGESETUPTEMPLATE
Definition: commdlg.h:184
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
char * LPSTR
Definition: xmlstorage.h:182
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define PSD_ENABLEPAGESETUPTEMPLATEHANDLE
Definition: commdlg.h:185
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define RT_DIALOG
Definition: pedump.c:367
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2592

Referenced by pagesetup_common().

◆ pagesetup_init_combos()

static void pagesetup_init_combos ( HWND  hDlg,
pagesetup_data data 
)
static

Definition at line 3113 of file printdlg.c.

3114 {
3115  DEVMODEW *dm;
3116  LPWSTR devname, portname;
3117 
3119  devname = pagesetup_get_devname(data);
3120  portname = pagesetup_get_portname(data);
3121 
3122  PRINTDLG_SetUpPrinterListComboW(hDlg, cmb1, devname);
3123  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb2, devname, portname, dm);
3124  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb3, devname, portname, dm);
3125 
3126  pagesetup_release_a_devname(data, portname);
3129 }
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2810
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2892
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2911
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2815
static INT PRINTDLG_SetUpPrinterListComboW(HWND hDlg, UINT id, LPCWSTR name)
Definition: printdlg.c:430
#define cmb2
Definition: dlgs.h:49
#define cmb3
Definition: dlgs.h:50
static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, int nIDComboBox, const WCHAR *PrinterName, const WCHAR *PortName, LPDEVMODEW dm)
Definition: printdlg.c:907
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2820
#define cmb1
Definition: dlgs.h:48

Referenced by pagesetup_change_printer_dialog(), pagesetup_dlg_proc(), and pagesetup_wm_command().

◆ pagesetup_margin_editproc()

static LRESULT CALLBACK pagesetup_margin_editproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 3649 of file printdlg.c.

3650 {
3651  if (msg == WM_CHAR)
3652  {
3653  WCHAR decimal = get_decimal_sep();
3654  WCHAR wc = (WCHAR)wparam;
3655  if(!iswdigit(wc) && wc != decimal && wc != VK_BACK) return 0;
3656  }
3658 }
#define WM_CHAR
Definition: winuser.h:1704
#define iswdigit(_c)
Definition: ctype.h:667
static WCHAR get_decimal_sep(void)
Definition: printdlg.c:2618
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static WNDPROC edit_wndproc
Definition: printdlg.c:141
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define VK_BACK
Definition: winuser.h:2178
#define msg(x)
Definition: auth_time.c:54
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by subclass_margin_edits().

◆ pagesetup_printer_properties()

static void pagesetup_printer_properties ( HWND  hDlg,
pagesetup_data data 
)
static

Definition at line 3314 of file printdlg.c.

3315 {
3316  HANDLE hprn;
3317  LPWSTR devname;
3318  DEVMODEW *dm;
3319  LRESULT count;
3320  int i;
3321 
3322  devname = pagesetup_get_devname(data);
3323 
3324  if (!OpenPrinterW(devname, &hprn, NULL))
3325  {
3326  FIXME("Call to OpenPrinter did not succeed!\n");
3328  return;
3329  }
3330 
3332  DocumentPropertiesW(hDlg, hprn, devname, dm, dm, DM_IN_BUFFER | DM_OUT_BUFFER | DM_IN_PROMPT);
3336  ClosePrinter(hprn);
3337 
3338  /* Changing paper */
3341 
3342  /* Changing paper preview */
3344 
3345  /* Selecting paper in combo */
3346  count = SendDlgItemMessageW(hDlg, cmb2, CB_GETCOUNT, 0, 0);
3347  if(count != CB_ERR)
3348  {
3349  WORD paperword = pagesetup_get_papersize(data);
3350  for(i = 0; i < count; i++)
3351  {
3352  if(SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0) == paperword) {
3353  SendDlgItemMessageW(hDlg, cmb2, CB_SETCURSEL, i, 0);
3354  break;
3355  }
3356  }
3357  }
3358 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2737
#define DM_IN_PROMPT
Definition: windef.h:358
#define CB_GETITEMDATA
Definition: winuser.h:1937
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void pagesetup_update_orientation_buttons(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3301
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:1153
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2810
#define DM_OUT_BUFFER
Definition: windef.h:359
#define FIXME(fmt,...)
Definition: debug.h:111
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2916
#define CB_ERR
Definition: winuser.h:2415
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2892
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3190
unsigned short WORD
Definition: ntddk_ex.h:93
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL pagesetup_update_papersize(pagesetup_data *data)
Definition: printdlg.c:2986
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2911
#define CB_SETCURSEL
Definition: winuser.h:1948
#define cmb2
Definition: dlgs.h:49
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2624
#define DM_IN_BUFFER
Definition: windef.h:357
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
#define CB_GETCOUNT
Definition: winuser.h:1929
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2820

Referenced by pagesetup_wm_command().

◆ pagesetup_release_a_devname()

static void pagesetup_release_a_devname ( const pagesetup_data data,
WCHAR name 
)
static

Definition at line 2820 of file printdlg.c.

2821 {
2822  HeapFree(GetProcessHeap(), 0, name);
2823 }
#define GetProcessHeap()
Definition: compat.h:595
Definition: name.c:38
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by pagesetup_change_printer_dialog(), pagesetup_init_combos(), pagesetup_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_release_devmode()

static void pagesetup_release_devmode ( const pagesetup_data data,
DEVMODEW dm 
)
static

Definition at line 2911 of file printdlg.c.

2912 {
2913  HeapFree(GetProcessHeap(), 0, dm);
2914 }
#define GetProcessHeap()
Definition: compat.h:595
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by pagesetup_change_printer_dialog(), pagesetup_init_combos(), pagesetup_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_set_defaultsource()

static void pagesetup_set_defaultsource ( pagesetup_data data,
WORD  source 
)
static

Definition at line 2753 of file printdlg.c.

2754 {
2755  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2756 
2757  if(data->unicode)
2758  dm->u1.s1.dmDefaultSource = source;
2759  else
2760  {
2761  DEVMODEA *dmA = (DEVMODEA *)dm;
2762  dmA->u1.s1.dmDefaultSource = source;
2763  }
2764  GlobalUnlock(data->u.dlgw->hDevMode);
2765 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
short dmDefaultSource
Definition: wingdi.h:1631
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
short dmDefaultSource
Definition: wingdi.h:1579

Referenced by pagesetup_dlg_proc(), and pagesetup_wm_command().

◆ pagesetup_set_devmode()

static void pagesetup_set_devmode ( pagesetup_data data,
DEVMODEW dm 
)
static

Definition at line 2916 of file printdlg.c.

2917 {
2918  DEVMODEA *dmA = NULL;
2919  void *src, *dst;
2920  DWORD size;
2921 
2922  if(data->unicode)
2923  {
2924  size = dm->dmSize + dm->dmDriverExtra;
2925  src = dm;
2926  }
2927  else
2928  {
2929  dmA = convert_to_devmodeA(dm);
2930  size = dmA->dmSize + dmA->dmDriverExtra;
2931  src = dmA;
2932  }
2933 
2934  if(data->u.dlgw->hDevMode)
2935  data->u.dlgw->hDevMode = GlobalReAlloc(data->u.dlgw->hDevMode, size,
2936  GMEM_MOVEABLE);
2937  else
2938  data->u.dlgw->hDevMode = GlobalAlloc(GMEM_MOVEABLE, size);
2939 
2940  dst = GlobalLock(data->u.dlgw->hDevMode);
2941  memcpy(dst, src, size);
2942  GlobalUnlock(data->u.dlgw->hDevMode);
2943  HeapFree(GetProcessHeap(), 0, dmA);
2944 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD dmSize
Definition: wingdi.h:1568
WORD dmDriverExtra
Definition: wingdi.h:1569
WORD dmDriverExtra
Definition: wingdi.h:1621
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
WORD dmSize
Definition: wingdi.h:1620
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static DEVMODEA * convert_to_devmodeA(const DEVMODEW *dmW)
Definition: printdlg.c:325
#define HeapFree(x, y, z)
Definition: compat.h:594
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by pagesetup_change_printer(), pagesetup_change_printer_dialog(), and pagesetup_printer_properties().

◆ pagesetup_set_devnames()

static void pagesetup_set_devnames ( pagesetup_data data,
LPCWSTR  drv,
LPCWSTR  devname,
LPCWSTR  port 
)
static

Definition at line 2825 of file printdlg.c.

2826 {
2827  DEVNAMES *dn;
2828  WCHAR def[256];
2829  DWORD len = sizeof(DEVNAMES), drv_len, dev_len, port_len;
2830 
2831  if(data->unicode)
2832  {
2833  drv_len = (lstrlenW(drv) + 1) * sizeof(WCHAR);
2834  dev_len = (lstrlenW(devname) + 1) * sizeof(WCHAR);
2835  port_len = (lstrlenW(port) + 1) * sizeof(WCHAR);
2836  }
2837  else
2838  {
2839  drv_len = WideCharToMultiByte(CP_ACP, 0, drv, -1, NULL, 0, NULL, NULL);
2840  dev_len = WideCharToMultiByte(CP_ACP, 0, devname, -1, NULL, 0, NULL, NULL);
2841  port_len = WideCharToMultiByte(CP_ACP, 0, port, -1, NULL, 0, NULL, NULL);
2842  }
2843  len += drv_len + dev_len + port_len;
2844 
2845  if(data->u.dlgw->hDevNames)
2846  data->u.dlgw->hDevNames = GlobalReAlloc(data->u.dlgw->hDevNames, len, GMEM_MOVEABLE);
2847  else
2848  data->u.dlgw->hDevNames = GlobalAlloc(GMEM_MOVEABLE, len);
2849 
2850  dn = GlobalLock(data->u.dlgw->hDevNames);
2851 
2852  if(data->unicode)
2853  {
2854  WCHAR *ptr = (WCHAR *)(dn + 1);
2855  len = sizeof(DEVNAMES) / sizeof(WCHAR);
2856  dn->wDriverOffset = len;
2857  lstrcpyW(ptr, drv);
2858  ptr += drv_len / sizeof(WCHAR);
2859  len += drv_len / sizeof(WCHAR);
2860  dn->wDeviceOffset = len;
2861  lstrcpyW(ptr, devname);
2862  ptr += dev_len / sizeof(WCHAR);
2863  len += dev_len / sizeof(WCHAR);
2864  dn->wOutputOffset = len;
2865  lstrcpyW(ptr, port);
2866  }
2867  else
2868  {
2869  char *ptr = (char *)(dn + 1);
2870  len = sizeof(DEVNAMES);
2871  dn->wDriverOffset = len;
2872  WideCharToMultiByte(CP_ACP, 0, drv, -1, ptr, drv_len, NULL, NULL);
2873  ptr += drv_len;
2874  len += drv_len;
2875  dn->wDeviceOffset = len;
2876  WideCharToMultiByte(CP_ACP, 0, devname, -1, ptr, dev_len, NULL, NULL);
2877  ptr += dev_len;
2878  len += dev_len;
2879  dn->wOutputOffset = len;
2880  WideCharToMultiByte(CP_ACP, 0, port, -1, ptr, port_len, NULL, NULL);
2881  }
2882 
2883  dn->wDefault = 0;
2884  len = ARRAY_SIZE(def);
2885  GetDefaultPrinterW(def, &len);
2886  if(!lstrcmpW(def, devname))
2887  dn->wDefault = 1;
2888 
2889  GlobalUnlock(data->u.dlgw->hDevNames);
2890 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define WideCharToMultiByte
Definition: compat.h:111
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1942
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD wDefault
Definition: commdlg.h:300
#define CP_ACP
Definition: compat.h:109
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define lstrlenW
Definition: compat.h:609
struct tagDEVNAMES DEVNAMES
static PVOID ptr
Definition: dispmode.c:27
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:608
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
WORD wOutputOffset
Definition: commdlg.h:299
USHORT port
Definition: uri.c:228
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by pagesetup_change_printer(), and pagesetup_change_printer_dialog().

◆ pagesetup_set_orientation()

static void pagesetup_set_orientation ( pagesetup_data data,
WORD  orient 
)
static

Definition at line 2691 of file printdlg.c.

2692 {
2693  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2694 
2695  assert(orient == DMORIENT_PORTRAIT || orient == DMORIENT_LANDSCAPE);
2696 
2697  if(data->unicode)
2698  dm->u1.s1.dmOrientation = orient;
2699  else
2700  {
2701  DEVMODEA *dmA = (DEVMODEA *)dm;
2702  dmA->u1.s1.dmOrientation = orient;
2703  }
2704  GlobalUnlock(data->u.dlgw->hDevMode);
2705 }
short dmOrientation
Definition: wingdi.h:1625
#define assert(x)
Definition: debug.h:53
short dmOrientation
Definition: wingdi.h:1573
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1111
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1110

Referenced by pagesetup_wm_command().

◆ pagesetup_set_papersize()

static void pagesetup_set_papersize ( pagesetup_data data,
WORD  paper 
)
static

Definition at line 2723 of file printdlg.c.

2724 {
2725  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2726 
2727  if(data->unicode)
2728  dm->u1.s1.dmPaperSize = paper;
2729  else
2730  {
2731  DEVMODEA *dmA = (DEVMODEA *)dm;
2732  dmA->u1.s1.dmPaperSize = paper;
2733  }
2734  GlobalUnlock(data->u.dlgw->hDevMode);
2735 }
short dmPaperSize
Definition: wingdi.h:1626
short dmPaperSize
Definition: wingdi.h:1574
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by pagesetup_wm_command().

◆ pagesetup_update_orientation_buttons()

static void pagesetup_update_orientation_buttons ( HWND  hDlg,
const pagesetup_data data 
)
static

Definition at line 3301 of file printdlg.c.

3302 {
3304  CheckRadioButton(hDlg, rad1, rad2, rad2);
3305  else
3306  CheckRadioButton(hDlg, rad1, rad2, rad1);
3307 }
#define rad2
Definition: dlgs.h:131
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1111
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2707
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define rad1
Definition: dlgs.h:130

Referenced by pagesetup_dlg_proc(), and pagesetup_printer_properties().

◆ pagesetup_update_papersize()

static BOOL pagesetup_update_papersize ( pagesetup_data data)
static

Definition at line 2986 of file printdlg.c.

2987 {
2988  DEVMODEW *dm;
2989  LPWSTR devname, portname;
2990  int i, num;
2991  WORD *words = NULL, paperword;
2992  POINT *points = NULL;
2993  BOOL retval = FALSE;
2994 
2996  devname = pagesetup_get_devname(data);
2997  portname = pagesetup_get_portname(data);
2998 
2999  num = DeviceCapabilitiesW(devname, portname, DC_PAPERS, NULL, dm);
3000  if (num <= 0)
3001  {
3002  FIXME("No papernames found for %s/%s\n", debugstr_w(devname), debugstr_w(portname));
3003  goto end;
3004  }
3005 
3006  words = HeapAlloc(GetProcessHeap(), 0, num * sizeof(WORD));
3007  points = HeapAlloc(GetProcessHeap(), 0, num * sizeof(POINT));
3008 
3009  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERS, (LPWSTR)words, dm))
3010  {
3011  FIXME("Number of returned words is not %d\n", num);
3012  goto end;
3013  }
3014 
3015  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERSIZE, (LPWSTR)points, dm))
3016  {
3017  FIXME("Number of returned sizes is not %d\n", num);
3018  goto end;
3019  }
3020 
3021  paperword = pagesetup_get_papersize(data);
3022 
3023  for (i = 0; i < num; i++)
3024  if (words[i] == paperword)
3025  break;
3026 
3027  if (i == num)
3028  {
3029  FIXME("Papersize %d not found in list?\n", paperword);
3030  goto end;
3031  }
3032 
3033  /* this is _10ths_ of a millimeter */
3036 
3039 
3040  retval = TRUE;
3041 
3042 end:
3043  HeapFree(GetProcessHeap(), 0, words);
3045  pagesetup_release_a_devname(data, portname);
3048 
3049  return retval;
3050 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2737
#define DC_PAPERS
Definition: windef.h:363
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2946
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
static LONG tenths_mm_to_size(const pagesetup_data *data, LONG size)
Definition: printdlg.c:2602
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
DWORD WINAPI DeviceCapabilitiesW(_In_ LPCWSTR pDevice, _In_opt_ LPCWSTR pPort, _In_ WORD fwCapability, _Out_writes_opt_(_Inexpressible_(1)) LPWSTR pOutput, _In_opt_ const DEVMODEW *pDevMode)
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2810
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2892
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1111
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint num
Definition: glext.h:9618
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint end
Definition: gl.h:1545
GLsizei const GLfloat * points
Definition: glext.h:8112
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2911
static void swap_point(POINT *pt)
Definition: printdlg.c:2979
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2815
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2707
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DC_PAPERSIZE
Definition: windef.h:364
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2820
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by pagesetup_common(), pagesetup_dlg_proc(), pagesetup_printer_properties(), and pagesetup_wm_command().

◆ pagesetup_wm_command()

static BOOL pagesetup_wm_command ( HWND  hDlg,
WPARAM  wParam,
LPARAM  lParam,
pagesetup_data data 
)
static

Definition at line 3371 of file printdlg.c.

3372 {
3373  WORD msg = HIWORD(wParam);
3374  WORD id = LOWORD(wParam);
3375 
3376  TRACE("loword (lparam) %d, wparam 0x%lx, lparam %08lx\n",
3378  switch (id) {
3379  case IDOK:
3380  EndDialog(hDlg, TRUE);
3381  return TRUE ;
3382 
3383  case IDCANCEL:
3384  EndDialog(hDlg, FALSE);
3385  return FALSE ;
3386 
3387  case psh3: /* Printer... */
3389  return TRUE;
3390 
3391  case rad1: /* Portrait */
3392  case rad2: /* Landscape */
3395  {
3399  update_margin_edits(hDlg, data, 0);
3401  }
3402  break;
3403  case cmb1: /* Printer combo */
3404  if(msg == CBN_SELCHANGE)
3405  {
3406  WCHAR *name;
3407  INT index = SendDlgItemMessageW(hDlg, id, CB_GETCURSEL, 0, 0);
3409  name = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(length+1));
3412  pagesetup_init_combos(hDlg, data);
3414  }
3415  break;
3416  case cmb2: /* Paper combo */
3417  if(msg == CBN_SELCHANGE)
3418  {
3419  DWORD paperword = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA,
3420  SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0), 0);
3421  if (paperword != CB_ERR)
3422  {
3423  pagesetup_set_papersize(data, paperword);
3426  } else
3427  FIXME("could not get dialog text for papersize cmbbox?\n");
3428  }
3429  break;
3430  case cmb3: /* Paper Source */
3431  if(msg == CBN_SELCHANGE)
3432  {
3434  SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0), 0);
3436  }
3437  break;
3438  case psh2: /* Printer Properties button */
3440  break;
3441  case edt4:
3442  case edt5:
3443  case edt6:
3444  case edt7:
3445  margin_edit_notification(hDlg, data, msg, id);
3446  break;
3447  }
3449  return FALSE;
3450 }
static void pagesetup_printer_properties(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3314
#define CB_GETLBTEXTLEN
Definition: winuser.h:1940
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define CB_GETLBTEXT
Definition: winuser.h:1939
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3233
#define CB_GETITEMDATA
Definition: winuser.h:1937
static void pagesetup_change_printer_dialog(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3139
#define edt5
Definition: dlgs.h:69
static void pagesetup_set_orientation(pagesetup_data *data, WORD orient)
Definition: printdlg.c:2691
#define psh2
Definition: dlgs.h:113
int32_t INT
Definition: typedefs.h:58
#define CB_GETCURSEL
Definition: winuser.h:1930
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define rad2
Definition: dlgs.h:131
#define FALSE
Definition: types.h:117
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define edt4
Definition: dlgs.h:68
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define CB_ERR
Definition: winuser.h:2415
static void rotate_rect(RECT *rc, BOOL sense)
Definition: printdlg.c:2670
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1111
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3190
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3113
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL pagesetup_update_papersize(pagesetup_data *data)
Definition: printdlg.c:2986
static void margin_edit_notification(HWND hDlg, const pagesetup_data *data, WORD msg, WORD id)
Definition: printdlg.c:3248
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2707
#define cmb2
Definition: dlgs.h:49
static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
Definition: printdlg.c:2753
static void pagesetup_set_papersize(pagesetup_data *data, WORD paper)
Definition: printdlg.c:2723
#define cmb3
Definition: dlgs.h:50
#define NULL
Definition: types.h:112
#define CBN_SELCHANGE
Definition: winuser.h:1966
#define msg(x)
Definition: auth_time.c:54
Definition: name.c:38
#define edt7
Definition: dlgs.h:71
static BOOL pagesetup_change_printer(LPWSTR name, pagesetup_data *data)
Definition: printdlg.c:3058
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1110
#define HIWORD(l)
Definition: typedefs.h:247
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2951
#define IDCANCEL
Definition: winuser.h:825
#define cmb1
Definition: dlgs.h:48
#define rct1
Definition: dlgs.h:147
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define rad1
Definition: dlgs.h:130
#define HeapFree(x, y, z)
Definition: compat.h:594
#define edt6
Definition: dlgs.h:70
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by pagesetup_dlg_proc().

◆ PageSetupDlgA()

BOOL WINAPI PageSetupDlgA ( LPPAGESETUPDLGA  setupdlg)

Definition at line 3923 of file printdlg.c.

3924 {
3926 
3927  data.unicode = FALSE;
3928  data.u.dlga = setupdlg;
3929 
3930  return pagesetup_common(&data);
3931 }
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3842
#define FALSE
Definition: types.h:117
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by test_PageSetupDlgA().

◆ PageSetupDlgW()

BOOL WINAPI PageSetupDlgW ( LPPAGESETUPDLGW  setupdlg)

Definition at line 3938 of file printdlg.c.

3939 {
3941 
3942  data.unicode = TRUE;
3943  data.u.dlgw = setupdlg;
3944 
3945  return pagesetup_common(&data);
3946 }
#define TRUE
Definition: types.h:120
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3842
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by dialog_printsetup(), and PageSetupDlgWrapW().

◆ pdlg_to_pdlgex()

static void pdlg_to_pdlgex ( const PRINTDLGW pdlg,
PRINTDLGEXW *  pdlgex 
)
static

Definition at line 3980 of file printdlg.c.

3981 {
3982  pdlgex->hDevMode = pdlg->hDevMode;
3983  pdlgex->hDevNames = pdlg->hDevNames;
3984  pdlgex->hDC = pdlg->hDC;
3985  if (!(pdlgex->Flags & PD_NOPAGENUMS) && pdlgex->nPageRanges && pdlgex->lpPageRanges)
3986  {
3987  pdlgex->lpPageRanges[0].nFromPage = pdlg->nFromPage;
3988  pdlgex->lpPageRanges[0].nToPage = pdlg->nToPage;
3989  }
3990  pdlgex->nMinPage = pdlg->nMinPage;
3991  pdlgex->nMaxPage = pdlg->nMaxPage;
3992  pdlgex->nCopies = pdlg->nCopies;
3993 }
HGLOBAL hDevNames
Definition: commdlg.h:489
#define PD_NOPAGENUMS
Definition: commdlg.h:150
HDC hDC
Definition: commdlg.h:490
WORD nMinPage
Definition: commdlg.h:494
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD nCopies
Definition: commdlg.h:496
WORD nToPage
Definition: commdlg.h:493
WORD nFromPage
Definition: commdlg.h:492
WORD nMaxPage
Definition: commdlg.h:495

Referenced by PrintDlgExA(), and PrintDlgExW().

◆ pdlgex_hook_proc()

static UINT_PTR CALLBACK pdlgex_hook_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 4001 of file printdlg.c.

4002 {
4003  if (msg == WM_INITDIALOG)
4004  {
4005  PRINTDLGW *pd = (PRINTDLGW *)lp;
4006  struct callback_data *cb = (struct callback_data *)pd->lCustData;
4007 
4008  if (cb->callback)
4009  {
4010  cb->callback->lpVtbl->SelectionChange(cb->callback);
4011  cb->callback->lpVtbl->InitDone(cb->callback);
4012  }
4013  }
4014  else
4015  {
4016 /* FIXME: store interface pointer somewhere in window properties and call it
4017  HRESULT hres;
4018  cb->callback->lpVtbl->HandleMessage(cb->callback, hwnd, msg, wp, lp, &hres);
4019 */
4020  }
4021 
4022  return 0;
4023 }
if(dx==0 &&dy==0)
Definition: linetemp.h:174
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
#define msg(x)
Definition: auth_time.c:54
LPARAM lCustData
Definition: commdlg.h:498
#define WM_INITDIALOG
Definition: winuser.h:1726

Referenced by PrintDlgExA(), and PrintDlgExW().

◆ pdlgex_to_pdlg()

static void pdlgex_to_pdlg ( const PRINTDLGEXW *  pdlgex,
PRINTDLGW pdlg 
)
static

Definition at line 3948 of file printdlg.c.

3949 {
3950  pdlg->lStructSize = sizeof(*pdlg);
3951  pdlg->hwndOwner = pdlgex->hwndOwner;
3952  pdlg->hDevMode = pdlgex->hDevMode;
3953  pdlg->hDevNames = pdlgex->hDevNames;
3954  pdlg->hDC = pdlgex->hDC;
3955  pdlg->Flags = pdlgex->Flags;
3956  if ((pdlgex->Flags & PD_NOPAGENUMS) || !pdlgex->nPageRanges || !pdlgex->lpPageRanges)
3957  {
3958  pdlg->nFromPage = 0;
3959  pdlg->nToPage = 65534;
3960  }
3961  else
3962  {
3963  pdlg->nFromPage = pdlgex->lpPageRanges[0].nFromPage;
3964  pdlg->nToPage = pdlgex->lpPageRanges[0].nToPage;
3965  }
3966  pdlg->nMinPage = pdlgex->nMinPage;
3967  pdlg->nMaxPage = pdlgex->nMaxPage;
3968  pdlg->nCopies = pdlgex->nCopies;
3969  pdlg->hInstance = pdlgex->hInstance;
3970  pdlg->lCustData = 0;
3971  pdlg->lpfnPrintHook = NULL;
3972  pdlg->lpfnSetupHook = NULL;
3973  pdlg->lpPrintTemplateName = pdlgex->lpPrintTemplateName;
3974  pdlg->lpSetupTemplateName = NULL;
3975  pdlg->hPrintTemplate = NULL;
3976  pdlg->hSetupTemplate = NULL;
3977 }
HWND hwndOwner
Definition: commdlg.h:487
HGLOBAL hSetupTemplate
Definition: commdlg.h:504
HGLOBAL hDevNames
Definition: commdlg.h:489
DWORD Flags
Definition: commdlg.h:491
#define PD_NOPAGENUMS
Definition: commdlg.h:150
LPCWSTR lpSetupTemplateName
Definition: commdlg.h:502
HDC hDC
Definition: commdlg.h:490
WORD nMinPage
Definition: commdlg.h:494
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD nCopies
Definition: commdlg.h:496
LPPRINTHOOKPROC lpfnPrintHook
Definition: commdlg.h:499
DWORD lStructSize
Definition: commdlg.h:486
LPCWSTR lpPrintTemplateName
Definition: commdlg.h:501
WORD nToPage
Definition: commdlg.h:493
LPSETUPHOOKPROC lpfnSetupHook
Definition: commdlg.h:500
WORD nFromPage
Definition: commdlg.h:492
HGLOBAL hPrintTemplate
Definition: commdlg.h:503
HINSTANCE hInstance
Definition: commdlg.h:497
WORD nMaxPage
Definition: commdlg.h:495
#define NULL
Definition: types.h:112
LPARAM lCustData
Definition: commdlg.h:498

Referenced by PrintDlgExA(), and PrintDlgExW().

◆ PRINTDLG_ChangePrinterA()

static BOOL PRINTDLG_ChangePrinterA ( HWND  hDlg,
char name,
PRINT_PTRA PrintStructures 
)
static

Definition at line 1098 of file printdlg.c.

1099 {
1100  LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
1101  LPDEVMODEA lpdm = NULL;
1102  LONG dmSize;
1103  DWORD needed;
1104  HANDLE hprn;
1105 
1106  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1107  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1108  if(!OpenPrinterA(name, &hprn, NULL)) {
1109  ERR("Can't open printer %s\n", name);
1110  return FALSE;
1111  }
1112  GetPrinterA(hprn, 2, NULL, 0, &needed);
1113  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1114  GetPrinterA(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1115  &needed);
1116  GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
1117  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1118  if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1119  needed, &needed)) {
1120  ERR("GetPrinterDriverA failed for %s, fix your config!\n",PrintStructures->lpPrinterInfo->pPrinterName);
1121  return FALSE;
1122  }
1123  ClosePrinter(hprn);
1124 
1125  PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo);
1126 
1127  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1128  PrintStructures->lpDevMode = NULL;
1129 
1130  dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0);
1131  if(dmSize == -1) {
1132  ERR("DocumentProperties fails on %s\n", debugstr_a(name));
1133  return FALSE;
1134  }
1135  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1136  dmSize = DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, NULL,
1137  DM_OUT_BUFFER);
1138  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1139  !lstrcmpA( (LPSTR) lpdm->dmDeviceName,
1140  (LPSTR) PrintStructures->lpDevMode->dmDeviceName)) {
1141  /* Supplied devicemode matches current printer so try to use it */
1142  DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, lpdm,
1144  }
1145  if(lpdm)
1146  GlobalUnlock(lppd->hDevMode);
1147 
1148  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1149 
1150  if(!(lppd->Flags & PD_PRINTSETUP)) {
1151  /* Print range (All/Range/Selection) */
1152  if(lppd->nFromPage != 0xffff)
1153  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1154  if(lppd->nToPage != 0xffff)
1155  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1156 
1157  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1158  if (lppd->Flags & PD_NOSELECTION)
1159  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1160  else
1161  if (lppd->Flags & PD_SELECTION)
1162  CheckRadioButton(hDlg, rad1, rad3, rad2);
1163  if (lppd->Flags & PD_NOPAGENUMS) {
1164  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1166  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1168  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1169  } else {
1170  if (lppd->Flags & PD_PAGENUMS)
1171  CheckRadioButton(hDlg, rad1, rad3, rad3);
1172  }
1173 
1174  /* Collate pages */
1175  if (lppd->Flags & PD_COLLATE) {
1177  (LPARAM)PrintStructures->hCollateIcon);
1178  CheckDlgButton(hDlg, chx2, 1);
1179  } else {
1181  (LPARAM)PrintStructures->hNoCollateIcon);
1182  CheckDlgButton(hDlg, chx2, 0);
1183  }
1184 
1185  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1186  /* if printer doesn't support it: no Collate */
1187  if (!(lpdm->dmFields & DM_COLLATE)) {
1188  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1189  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1190  }
1191  }
1192 
1193  /* nCopies */
1194  {
1195  INT copies;
1196  if (lppd->hDevMode == 0)
1197  copies = lppd->nCopies;
1198  else
1199  copies = lpdm->u1.s1.dmCopies;
1200  if(copies == 0) copies = 1;
1201  else if(copies < 0) copies = MAX_COPIES;
1202  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1203  }
1204 
1205  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1206  /* if printer doesn't support it: no nCopies */
1207  if (!(lpdm->dmFields & DM_COPIES)) {
1208  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1209  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1210  }
1211  }
1212 
1213  /* print to file */
1214  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1215  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1216  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1217  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1218  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1219 
1220  /* Fill print quality combo, PrintDlg16 */
1221  if(GetDlgItem(hDlg, cmb1))
1222  {
1223  DWORD numResolutions = DeviceCapabilitiesA(PrintStructures->lpPrinterInfo->pPrinterName,
1224  PrintStructures->lpPrinterInfo->pPortName,
1225  DC_ENUMRESOLUTIONS, NULL, lpdm);
1226 
1227  if(numResolutions != -1)
1228  {
1229  HWND hQuality = GetDlgItem(hDlg, cmb1);
1230  LONG* Resolutions;
1231  char buf[255];
1232  DWORD i;
1233  int dpiX, dpiY;
1234  HDC hPrinterDC = CreateDCA(PrintStructures->lpPrinterInfo->pDriverName,
1235  PrintStructures->lpPrinterInfo->pPrinterName,
1236  0, lpdm);
1237 
1238  Resolutions = HeapAlloc(GetProcessHeap(), 0, numResolutions*sizeof(LONG)*2);
1240  PrintStructures->lpPrinterInfo->pPortName,
1241  DC_ENUMRESOLUTIONS, (LPSTR)Resolutions, lpdm);
1242 
1243  dpiX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
1244  dpiY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
1245  DeleteDC(hPrinterDC);
1246 
1247  SendMessageA(hQuality, CB_RESETCONTENT, 0, 0);
1248  for(i = 0; i < (numResolutions * 2); i += 2)
1249  {
1250  BOOL IsDefault = FALSE;
1251  LRESULT Index;
1252 
1253  if(Resolutions[i] == Resolutions[i+1])
1254  {
1255  if(dpiX == Resolutions[i])
1256  IsDefault = TRUE;
1257  sprintf(buf, "%d dpi", Resolutions[i]);
1258  } else
1259  {
1260  if(dpiX == Resolutions[i] && dpiY == Resolutions[i+1])
1261  IsDefault = TRUE;
1262  sprintf(buf, "%d dpi x %d dpi", Resolutions[i], Resolutions[i+1]);
1263  }
1264 
1265  Index = SendMessageA(hQuality, CB_ADDSTRING, 0, (LPARAM)buf);
1266 
1267  if(IsDefault)
1268  SendMessageA(hQuality, CB_SETCURSEL, Index, 0);
1269 
1270  SendMessageA(hQuality, CB_SETITEMDATA, Index, MAKELONG(dpiX,dpiY));
1271  }
1272  HeapFree(GetProcessHeap(), 0, Resolutions);
1273  }
1274  }
1275  } else { /* PD_PRINTSETUP */
1276  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1277 
1279  PrintStructures->lpPrinterInfo->pPrinterName,
1280  PrintStructures->lpPrinterInfo->pPortName,
1281  lpdm);
1283  PrintStructures->lpPrinterInfo->pPrinterName,
1284  PrintStructures->lpPrinterInfo->pPortName,
1285  lpdm);
1286  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1288  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1289  PrintStructures->hLandscapeIcon));
1290 
1291  }
1292 
1293  /* help button */
1294  if ((lppd->Flags & PD_SHOWHELP)==0) {
1295  /* hide if PD_SHOWHELP not specified */
1297  }
1298  return TRUE;
1299 }
HICON hPortraitIcon
Definition: printdlg.c:68
WINBOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
#define CB_SETITEMDATA
Definition: winuser.h:1953
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define LOGPIXELSX
Definition: wingdi.h:718
#define PD_NOSELECTION
Definition: commdlg.h:149
#define IMAGE_ICON
Definition: winuser.h:212
HICON hNoCollateIcon
Definition: printdlg.c:67
HICON hCollateIcon
Definition: printdlg.c:66
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WINBOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2033
static HDC
Definition: imagelist.c:92
LPPRINTER_INFO_2A lpPrinterInfo
Definition: printdlg.c:63
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define stc2
Definition: dlgs.h:161
WORD nCopies
Definition: commdlg.h:475
LPPRINTDLGA lpPrintDlg
Definition: printdlg.c:62
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PD_NOPAGENUMS
Definition: commdlg.h:150
char * LPSTR
Definition: xmlstorage.h:182
#define DM_COLLATE
Definition: wingdi.h:1265
int32_t INT
Definition: typedefs.h:58
static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *pi)
Definition: printdlg.c:1021
#define rad2
Definition: dlgs.h:131
static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg, int nIDComboBox, char *PrinterName, char *PortName, LPDEVMODEA dm)
Definition: printdlg.c:798
#define ico1
Definition: dlgs.h:90
#define sprintf(buf, format,...)
Definition: sprintf.c:55
short dmCopies
Definition: wingdi.h:1578
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPDRIVER_INFO_3A lpDriverInfo
Definition: printdlg.c:64
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
unsigned char * LPBYTE
Definition: typedefs.h:53
#define DC_ENUMRESOLUTIONS
Definition: windef.h:374
#define FALSE
Definition: types.h:117
#define chx1
Definition: dlgs.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
#define chx2
Definition: dlgs.h:32
long LONG
Definition: pedump.c:60
#define DM_OUT_BUFFER
Definition: windef.h:359
#define stc3
Definition: dlgs.h:162
short dmOrientation
Definition: wingdi.h:1573
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
#define CB_ADDSTRING
Definition: winuser.h:1923
#define MAKELONG(a, b)
Definition: typedefs.h:249
WORD nFromPage
Definition: commdlg.h:471
LPSTR pDriverName
Definition: winspool.h:42
LONG WINAPI DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode)
Definition: printers.c:666
#define PD_SELECTION
Definition: commdlg.h:147
LONG_PTR LPARAM
Definition: windef.h:208
HICON hLandscapeIcon
Definition: printdlg.c:69
WINBOOL WINAPI OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefault)
Definition: printers.c:2553
#define CB_RESETCONTENT
Definition: winuser.h:1946
LPSTR pPrinterName
Definition: winspool.h:39
#define GetProcessHeap()
Definition: compat.h:595
#define PD_PRINTSETUP
Definition: commdlg.h:153
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define debugstr_a
Definition: kernel32.h:31
_In_ WDFCOLLECTION _In_ ULONG Index
#define rad3
Definition: dlgs.h:132
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL hDevMode
Definition: commdlg.h:467
DWORD WINAPI DeviceCapabilitiesA(_In_ LPCSTR pDevice, _In_opt_ LPCSTR pPort, _In_ WORD fwCapability, _Out_writes_opt_(_Inexpressible_(1)) LPSTR pOutput, _In_opt_ const DEVMODEA *pDevMode)
#define PD_SHOWHELP
Definition: commdlg.h:158
#define PD_PAGENUMS
Definition: commdlg.h:148
#define edt1
Definition: dlgs.h:65
DWORD dmFields
Definition: wingdi.h:1570
#define edt2
Definition: dlgs.h:66
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
LPDEVMODEA lpDevMode
Definition: printdlg.c:61
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define PD_COLLATE
Definition: commdlg.h:151
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
LPSTR pPortName
Definition: winspool.h:41
#define CB_SETCURSEL
Definition: winuser.h:1948
#define PD_PRINTTOFILE
Definition: commdlg.h:152
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:110
#define cmb2
Definition: dlgs.h:49
#define DM_IN_BUFFER
Definition: windef.h:357
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI DeleteDC(_In_ HDC)
#define cmb3
Definition: dlgs.h:50
#define DM_COPIES
Definition: wingdi.h:1258
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BYTE dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1565
#define pshHelp
Definition: dlgs.h:127
#define STM_SETIMAGE
Definition: winuser.h:2080
WORD nToPage
Definition: commdlg.h:472
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: name.c:38
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1110
#define edt3
Definition: dlgs.h:67
#define LOGPIXELSY
Definition: wingdi.h:719
DWORD Flags
Definition: commdlg.h:470
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
LONG_PTR LRESULT
Definition: windef.h:209
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
#define cmb1
Definition: dlgs.h:48
#define ico3
Definition: dlgs.h:92
#define rad1
Definition: dlgs.h:130
#define HeapFree(x, y, z)
Definition: compat.h:594
#define stc5
Definition: dlgs.h:164
#define MAX_COPIES
Definition: printdlg.c:53

Referenced by PRINTDLG_WMCommandA(), and PRINTDLG_WMInitDialog().

◆ PRINTDLG_ChangePrinterW()

static BOOL PRINTDLG_ChangePrinterW ( HWND  hDlg,
WCHAR name,
PRINT_PTRW PrintStructures 
)
static

Definition at line 1301 of file printdlg.c.

1303 {
1304  LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
1305  LPDEVMODEW lpdm = NULL;
1306  LONG dmSize;
1307  DWORD needed;
1308  HANDLE hprn;
1309 
1310  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1311  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1312  if(!OpenPrinterW(name, &hprn, NULL)) {
1313  ERR("Can't open printer %s\n", debugstr_w(name));
1314  return FALSE;
1315  }
1316  GetPrinterW(hprn, 2, NULL, 0, &needed);
1317  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1318  GetPrinterW(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1319  &needed);
1320  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
1321  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1322  if (!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1323  needed, &needed)) {
1324  ERR("GetPrinterDriverA failed for %s, fix your config!\n",debugstr_w(PrintStructures->lpPrinterInfo->pPrinterName));
1325  return FALSE;
1326  }
1327  ClosePrinter(hprn);
1328 
1329  PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo);
1330 
1331  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1332  PrintStructures->lpDevMode = NULL;
1333 
1334  dmSize = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
1335  if(dmSize == -1) {
1336  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
1337  return FALSE;
1338  }
1339  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1340  dmSize = DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, NULL,
1341  DM_OUT_BUFFER);
1342  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1343  !lstrcmpW(lpdm->dmDeviceName,
1344  PrintStructures->lpDevMode->dmDeviceName)) {
1345  /* Supplied devicemode matches current printer so try to use it */
1346  DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, lpdm,
1348  }
1349  if(lpdm)
1350  GlobalUnlock(lppd->hDevMode);
1351 
1352  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1353 
1354  if(!(lppd->Flags & PD_PRINTSETUP)) {
1355  /* Print range (All/Range/Selection) */
1356  if(lppd->nFromPage != 0xffff)
1357  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1358  if(lppd->nToPage != 0xffff)
1359  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1360 
1361  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1362  if (lppd->Flags & PD_NOSELECTION)
1363  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1364  else
1365  if (lppd->Flags & PD_SELECTION)
1366  CheckRadioButton(hDlg, rad1, rad3, rad2);
1367  if (lppd->Flags & PD_NOPAGENUMS) {
1368  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1370  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1372  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1373  } else {
1374  if (lppd->Flags & PD_PAGENUMS)
1375  CheckRadioButton(hDlg, rad1, rad3, rad3);
1376  }
1377 
1378  /* Collate pages */
1379  if (lppd->Flags & PD_COLLATE) {
1381  (LPARAM)PrintStructures->hCollateIcon);
1382  CheckDlgButton(hDlg, chx2, 1);
1383  } else {
1385  (LPARAM)PrintStructures->hNoCollateIcon);
1386  CheckDlgButton(hDlg, chx2, 0);
1387  }
1388 
1389  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1390  /* if printer doesn't support it: no Collate */
1391  if (!(lpdm->dmFields & DM_COLLATE)) {
1392  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1393  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1394  }
1395  }
1396 
1397  /* nCopies */
1398  {
1399  INT copies;
1400  if (lppd->hDevMode == 0)
1401  copies = lppd->nCopies;
1402  else
1403  copies = lpdm->u1.s1.dmCopies;
1404  if(copies == 0) copies = 1;
1405  else if(copies < 0) copies = MAX_COPIES;
1406  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1407  }
1408 
1409  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1410  /* if printer doesn't support it: no nCopies */
1411  if (!(lpdm->dmFields & DM_COPIES)) {
1412  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1413  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1414  }
1415  }
1416 
1417  /* print to file */
1418  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1419  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1420  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1421  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1422  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1423 
1424  } else { /* PD_PRINTSETUP */
1425  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1426 
1428  PrintStructures->lpPrinterInfo->pPrinterName,
1429  PrintStructures->lpPrinterInfo->pPortName,
1430  lpdm);
1432  PrintStructures->lpPrinterInfo->pPrinterName,
1433  PrintStructures->lpPrinterInfo->pPortName,
1434  lpdm);
1435  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1437  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1438  PrintStructures->hLandscapeIcon));
1439 
1440  }
1441 
1442  /* help button */
1443  if ((lppd->Flags & PD_SHOWHELP)==0) {
1444  /* hide if PD_SHOWHELP not specified */
1446  }
1447  return TRUE;
1448 }
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define PD_NOSELECTION
Definition: commdlg.h:149
#define IMAGE_ICON
Definition: winuser.h:212
DWORD dmFields
Definition: wingdi.h:1622
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
short dmOrientation
Definition: wingdi.h:1625
#define stc2
Definition: dlgs.h:161
static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *pi)
Definition: printdlg.c:1057
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:1153
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD Flags
Definition: commdlg.h:491
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
#define PD_NOPAGENUMS
Definition: commdlg.h:150
#define DM_COLLATE
Definition: wingdi.h:1265
int32_t INT
Definition: typedefs.h:58
#define rad2
Definition: dlgs.h:131
#define ico1
Definition: dlgs.h:90
HICON hPortraitIcon
Definition: printdlg.c:82
LPDRIVER_INFO_3W lpDriverInfo
Definition: printdlg.c:78
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define chx1
Definition: dlgs.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
#define chx2
Definition: dlgs.h:32
long LONG
Definition: pedump.c:60
#define DM_OUT_BUFFER
Definition: windef.h:359
#define debugstr_w
Definition: kernel32.h:32
#define stc3
Definition: dlgs.h:162
HICON hCollateIcon
Definition: printdlg.c:80
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD nCopies
Definition: commdlg.h:496
#define PD_SELECTION
Definition: commdlg.h:147
LONG_PTR LPARAM
Definition: windef.h:208
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2504
HICON hNoCollateIcon
Definition: printdlg.c:81
#define GetProcessHeap()
Definition: compat.h:595
#define PD_PRINTSETUP
Definition: commdlg.h:153
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
WORD nToPage
Definition: commdlg.h:493
LPPRINTDLGW lpPrintDlg
Definition: printdlg.c:76
#define rad3
Definition: dlgs.h:132
LPPRINTER_INFO_2W lpPrinterInfo
Definition: printdlg.c:77
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1617
#define PD_SHOWHELP
Definition: commdlg.h:158
#define PD_PAGENUMS
Definition: commdlg.h:148
#define edt1
Definition: dlgs.h:65
#define edt2
Definition: dlgs.h:66
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define PD_COLLATE
Definition: commdlg.h:151
#define PD_PRINTTOFILE
Definition: commdlg.h:152
WORD nFromPage
Definition: commdlg.h:492
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:110
#define cmb2
Definition: dlgs.h:49
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2624
#define DM_IN_BUFFER
Definition: windef.h:357
#define cmb3
Definition: dlgs.h:50
#define DM_COPIES
Definition: wingdi.h:1258
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
LPDEVMODEW lpDevMode
Definition: printdlg.c:75
#define pshHelp
Definition: dlgs.h:127
HICON hLandscapeIcon
Definition: printdlg.c:83
#define STM_SETIMAGE
Definition: winuser.h:2080
LPWSTR pPortName
Definition: winspool.h:65
Definition: name.c:38
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1110
LPWSTR pPrinterName
Definition: winspool.h:63
#define edt3
Definition: dlgs.h:67
short dmCopies
Definition: wingdi.h:1630
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, int nIDComboBox, const WCHAR *PrinterName, const WCHAR *PortName, LPDEVMODEW dm)
Definition: printdlg.c:907
#define ico3
Definition: dlgs.h:92
#define rad1
Definition: dlgs.h:130
#define HeapFree(x, y, z)
Definition: compat.h:594
#define stc5
Definition: dlgs.h:164
#define MAX_COPIES
Definition: printdlg.c:53

Referenced by PRINTDLG_WMCommandW(), and PRINTDLG_WMInitDialogW().

◆ PRINTDLG_CreateDCA()

static BOOL PRINTDLG_CreateDCA ( LPPRINTDLGA  lppd)
static

Definition at line 2191 of file printdlg.c.

2192 {
2193  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2194  DEVMODEA *pdm = GlobalLock(lppd->hDevMode);
2195 
2196  if(lppd->Flags & PD_RETURNDC) {
2197  lppd->hDC = CreateDCA((char*)pdn + pdn->wDriverOffset,
2198  (char*)pdn + pdn->wDeviceOffset,
2199  (char*)pdn + pdn->wOutputOffset,
2200  pdm );
2201  } else if(lppd->Flags & PD_RETURNIC) {
2202  lppd->hDC = CreateICA((char*)pdn + pdn->wDriverOffset,
2203  (char*)pdn + pdn->wDeviceOffset,
2204  (char*)pdn + pdn->wOutputOffset,
2205  pdm );
2206  }
2207  GlobalUnlock(lppd->hDevNames);
2208  GlobalUnlock(lppd->hDevMode);
2209  return lppd->hDC != NULL;
2210 }
HDC WINAPI CreateICA(_In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ const DEVMODEA *)
WORD wDeviceOffset
Definition: commdlg.h:298
#define PD_RETURNIC
Definition: commdlg.h:156
WORD wDriverOffset
Definition: commdlg.h:297
#define PD_RETURNDC
Definition: commdlg.h:155
HGLOBAL hDevMode
Definition: commdlg.h:467
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL hDevNames
Definition: commdlg.h:468
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
DWORD Flags
Definition: commdlg.h:470
WORD wOutputOffset
Definition: commdlg.h:299
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
HDC hDC
Definition: commdlg.h:469

Referenced by PrintDlgA().

◆ PRINTDLG_CreateDCW()

static BOOL PRINTDLG_CreateDCW ( LPPRINTDLGW  lppd)
static

Definition at line 2212 of file printdlg.c.

2213 {
2214  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2215  DEVMODEW *pdm = GlobalLock(lppd->hDevMode);
2216 
2217  if(lppd->Flags & PD_RETURNDC) {
2218  lppd->hDC = CreateDCW((WCHAR*)pdn + pdn->wDriverOffset,
2219  (WCHAR*)pdn + pdn->wDeviceOffset,
2220  (WCHAR*)pdn + pdn->wOutputOffset,
2221  pdm );
2222  } else if(lppd->Flags & PD_RETURNIC) {
2223  lppd->hDC = CreateICW((WCHAR*)pdn + pdn->wDriverOffset,
2224  (WCHAR*)pdn + pdn->wDeviceOffset,
2225  (WCHAR*)pdn + pdn->wOutputOffset,
2226  pdm );
2227  }
2228  GlobalUnlock(lppd->hDevNames);
2229  GlobalUnlock(lppd->hDevMode);
2230  return lppd->hDC != NULL;
2231 }
HGLOBAL hDevNames
Definition: commdlg.h:489
DWORD Flags
Definition: commdlg.h:491
HDC hDC
Definition: commdlg.h:490
WORD wDeviceOffset
Definition: commdlg.h:298
#define PD_RETURNIC
Definition: commdlg.h:156
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD wDriverOffset
Definition: commdlg.h:297
#define PD_RETURNDC
Definition: commdlg.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HDC WINAPI CreateICW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ const DEVMODEW *)
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
WORD wOutputOffset
Definition: commdlg.h:299

Referenced by PrintDlgW().

◆ PRINTDLG_CreateDevNames()

static BOOL PRINTDLG_CreateDevNames ( HGLOBAL hmem,
const char DeviceDriverName,
const char DeviceName,
const char OutputPort 
)
static

Definition at line 476 of file printdlg.c.

478 {
479  long size;
480  char* pDevNamesSpace;
481  char* pTempPtr;
482  LPDEVNAMES lpDevNames;
483  char buf[260];
485  const char *p;
486 
487  p = strrchr( DeviceDriverName, '\\' );
488  if (p) DeviceDriverName = p + 1;
489 #ifndef __REACTOS__
490  size = strlen(DeviceDriverName) + 1
491 #else
492  size = strlen(cDriverName) + 1
493 #endif
494  + strlen(DeviceName) + 1
495  + strlen(OutputPort) + 1
496  + sizeof(DEVNAMES);
497 
498  if(*hmem)
499  *hmem = GlobalReAlloc(*hmem, size, GMEM_MOVEABLE);
500  else
501  *hmem = GlobalAlloc(GMEM_MOVEABLE, size);
502  if (*hmem == 0)
503  return FALSE;
504 
505  pDevNamesSpace = GlobalLock(*hmem);
506  lpDevNames = (LPDEVNAMES) pDevNamesSpace;
507 
508  pTempPtr = pDevNamesSpace + sizeof(DEVNAMES);
509 #ifndef __REACTOS__
510  strcpy(pTempPtr, DeviceDriverName);
511 #else
512  strcpy(pTempPtr, cDriverName);
513 #endif
514  lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
515 
516  pTempPtr += strlen(DeviceDriverName) + 1;
517  strcpy(pTempPtr, DeviceName);
518  lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
519 
520  pTempPtr += strlen(DeviceName) + 1;
521  strcpy(pTempPtr, OutputPort);
522  lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
523 
525  lpDevNames->wDefault = (strcmp(buf, DeviceName) == 0) ? 1 : 0;
526  GlobalUnlock(*hmem);
527  return TRUE;
528 }
struct tagDEVNAMES * LPDEVNAMES
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD wDefault
Definition: commdlg.h:300
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define FALSE
Definition: types.h:117
struct tagDEVNAMES DEVNAMES
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
WINBOOL WINAPI GetDefaultPrinterA(LPSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1896
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
WORD wOutputOffset
Definition: commdlg.h:299
GLfloat GLfloat p
Definition: glext.h:8902
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by PrintDlgA(), and PrintDlgExA().

◆ PRINTDLG_CreateDevNamesW()

static BOOL PRINTDLG_CreateDevNamesW ( HGLOBAL hmem,
LPCWSTR  DeviceDriverName,
LPCWSTR  DeviceName,
LPCWSTR  OutputPort 
)
static

Definition at line 530 of file printdlg.c.

532 {
533  long size;
534  LPWSTR pDevNamesSpace;
535  LPWSTR pTempPtr;
536  LPDEVNAMES lpDevNames;
537  WCHAR bufW[260];
538  DWORD dwBufLen = ARRAY_SIZE(bufW);
539  const WCHAR *p;
540 
541  p = wcsrchr( DeviceDriverName, '\\' );
542  if (p) DeviceDriverName = p + 1;
543 #ifndef __REACTOS__
544  size = sizeof(WCHAR)*lstrlenW(DeviceDriverName) + 2
545 #else
546  size = sizeof(WCHAR)*lstrlenW(wDriverName) + 2
547 #endif
548  + sizeof(WCHAR)*lstrlenW(DeviceName) + 2
549  + sizeof(WCHAR)*lstrlenW(OutputPort) + 2
550  + sizeof(DEVNAMES);
551 
552  if(*hmem)
553  *hmem = GlobalReAlloc(*hmem, size, GMEM_MOVEABLE);
554  else
555  *hmem = GlobalAlloc(GMEM_MOVEABLE, size);
556  if (*hmem == 0)
557  return FALSE;
558 
559  pDevNamesSpace = GlobalLock(*hmem);
560  lpDevNames = (LPDEVNAMES) pDevNamesSpace;
561 
562  pTempPtr = (LPWSTR)((LPDEVNAMES)pDevNamesSpace + 1);
563 #ifndef __REACTOS__
564  lstrcpyW(pTempPtr, DeviceDriverName);
565 #else
566  lstrcpyW(pTempPtr, wDriverName);
567 #endif
568  lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
569 
570  pTempPtr += lstrlenW(DeviceDriverName) + 1;
571  lstrcpyW(pTempPtr, DeviceName);
572  lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
573 
574  pTempPtr += lstrlenW(DeviceName) + 1;
575  lstrcpyW(pTempPtr, OutputPort);
576  lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
577 
579  lpDevNames->wDefault = (lstrcmpW(bufW, DeviceName) == 0) ? 1 : 0;
580  GlobalUnlock(*hmem);
581  return TRUE;
582 }
struct tagDEVNAMES * LPDEVNAMES
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1942
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD wDefault
Definition: commdlg.h:300
#define TRUE
Definition: types.h:120
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
#define lstrlenW
Definition: compat.h:609
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define FALSE
Definition: types.h:117
struct tagDEVNAMES DEVNAMES
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define wcsrchr
Definition: compat.h:16
#define lstrcpyW
Definition: compat.h:608
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
WORD wOutputOffset
Definition: commdlg.h:299
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by pagesetup_change_printer_dialog(), PrintDlgExW(), and PrintDlgW().

◆ PRINTDLG_GetDlgTemplateA()

static HGLOBAL PRINTDLG_GetDlgTemplateA ( const PRINTDLGA lppd)
static

Definition at line 2118 of file printdlg.c.

2119 {
2120  HRSRC hResInfo;
2121  HGLOBAL hDlgTmpl;
2122 
2123  if (lppd->Flags & PD_PRINTSETUP) {
2124  if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) {
2125  hDlgTmpl = lppd->hSetupTemplate;
2126  } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) {
2127  hResInfo = FindResourceA(lppd->hInstance,
2129  hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);
2130  } else {
2131  hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP",
2132&