ReactOS  0.4.14-dev-1332-g6db3d88
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 2754 of file printdlg.c.

◆ hook_type

Enumerator
page_setup_hook 
page_paint_hook 

Definition at line 2943 of file printdlg.c.

2944 {
2947 } hook_type;
hook_type
Definition: printdlg.c:2943

Function Documentation

◆ check_printer_setup()

static LRESULT check_printer_setup ( HWND  hDlg)
static

Definition at line 1440 of file printdlg.c.

1441 {
1442  DWORD needed,num;
1443  WCHAR resourcestr[256],resultstr[256];
1444 
1445  EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num);
1446  if(needed == 0)
1447  {
1448  EnumPrintersW(PRINTER_ENUM_CONNECTIONS, NULL, 2, NULL, 0, &needed, &num);
1449  }
1450  if(needed > 0)
1451  return TRUE;
1452  else
1453  {
1455  LoadStringW(COMDLG32_hInstance, PD32_PRINT_TITLE,resourcestr, 255);
1456  MessageBoxW(hDlg, resultstr, resourcestr,MB_OK | MB_ICONWARNING);
1457  return FALSE;
1458  }
1459 }
#define PD32_NO_DEVICES
Definition: cdlg.h:61
#define PRINTER_ENUM_CONNECTIONS
Definition: winspool.h:804
#define TRUE
Definition: types.h:120
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
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
smooth NULL
Definition: ftsmooth.c:416
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:803
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 MB_OK
Definition: winuser.h:784
#define PD32_PRINT_TITLE
Definition: cdlg.h:47

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:101
WORD dmSize
Definition: wingdi.h:1567
#define CP_ACP
Definition: compat.h:99
WORD dmDriverExtra
Definition: wingdi.h:1620
WCHAR dmFormName[CCHFORMNAME]
Definition: wingdi.h:1644
char * LPSTR
Definition: xmlstorage.h:182
BYTE dmFormName[CCHFORMNAME]
Definition: wingdi.h:1592
WORD dmLogPixels
Definition: wingdi.h:1645
smooth NULL
Definition: ftsmooth.c:416
WORD dmSpecVersion
Definition: wingdi.h:1565
WORD dmSpecVersion
Definition: wingdi.h:1617
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WORD dmSize
Definition: wingdi.h:1619
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1616
#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:254
WORD dmLogPixels
Definition: wingdi.h:1593
BYTE dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1564

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 3444 of file printdlg.c.

3446 {
3447  LPRECT lprc = (LPRECT) lParam;
3448  HDC hdc = (HDC) wParam;
3449  HPEN hpen, holdpen;
3450  LOGFONTW lf;
3451  HFONT hfont, holdfont;
3452  INT oldbkmode;
3453  TRACE("uMsg: WM_USER+%d\n",uMsg-WM_USER);
3454  /* Call user paint hook if enable */
3456  if (pagesetup_get_hook(data, page_paint_hook)(hwndDlg, uMsg, wParam, lParam))
3457  return TRUE;
3458 
3459  switch (uMsg) {
3460  /* LPPAGESETUPDLG in lParam */
3461  case WM_PSD_PAGESETUPDLG:
3462  /* Inform about the sample page rectangle */
3463  case WM_PSD_FULLPAGERECT:
3464  /* Inform about the margin rectangle */
3465  case WM_PSD_MINMARGINRECT:
3466  return FALSE;
3467 
3468  /* Draw dashed rectangle showing margins */
3469  case WM_PSD_MARGINRECT:
3471  holdpen = SelectObject(hdc, hpen);
3473  DeleteObject(SelectObject(hdc, holdpen));
3474  return TRUE;
3475  /* Draw the fake document */
3476  case WM_PSD_GREEKTEXTRECT:
3477  /* select a nice scalable font, because we want the text really small */
3478  SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
3479  lf.lfHeight = 6; /* value chosen based on visual effect */
3480  hfont = CreateFontIndirectW(&lf);
3481  holdfont = SelectObject(hdc, hfont);
3482 
3483  /* if text not loaded, then do so now */
3484  if (wszFakeDocumentText[0] == '\0')
3489 
3490  oldbkmode = SetBkMode(hdc, TRANSPARENT);
3492  SetBkMode(hdc, oldbkmode);
3493 
3494  DeleteObject(SelectObject(hdc, holdfont));
3495  return TRUE;
3496 
3497  /* Envelope stamp */
3498  case WM_PSD_ENVSTAMPRECT:
3499  /* Return address */
3500  case WM_PSD_YAFULLPAGERECT:
3501  FIXME("envelope/stamp is not implemented\n");
3502  return FALSE;
3503  default:
3504  FIXME("Unknown message %x\n",uMsg);
3505  return FALSE;
3506  }
3507  return TRUE;
3508 }
#define WM_PSD_FULLPAGERECT
Definition: commdlg.h:189
#define TRUE
Definition: types.h:120
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:4440
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define IDS_FAKEDOCTEXT
Definition: cdlg.h:182
#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:1497
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:57
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define COLOR_3DSHADOW
Definition: winuser.h:921
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define DT_LEFT
Definition: winuser.h:534
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRANSPARENT
Definition: wingdi.h:949
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:2949
#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:586
#define WM_USER
Definition: winuser.h:1877
#define ARRAY_SIZE(a)
Definition: main.h:24
#define DT_TOP
Definition: winuser.h:542
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
#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:2579

Referenced by PRINTDLG_PagePaintProc().

◆ element_from_margin_id()

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

Definition at line 3208 of file printdlg.c.

3209 {
3210  switch(id)
3211  {
3212  case edt4: return &rc->left;
3213  case edt5: return &rc->top;
3214  case edt6: return &rc->right;
3215  case edt7: return &rc->bottom;
3216  }
3217  return NULL;
3218 }
#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
smooth NULL
Definition: ftsmooth.c:416
#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 2605 of file printdlg.c.

2606 {
2607  static WCHAR sep;
2608 
2609  if(!sep)
2610  {
2611  WCHAR buf[] = {'.', 0};
2613  sep = buf[0];
2614  }
2615  return sep;
2616 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LOCALE_USER_DEFAULT
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#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 3764 of file printdlg.c.

3765 {
3766  WCHAR *name = NULL;
3767  DWORD len = 0;
3768 
3770  if(len)
3771  {
3772  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
3774  }
3775  return name;
3776 }
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1017
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
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
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 2762 of file printdlg.c.

2763 {
2764  switch(which)
2765  {
2766  case devnames_driver_name: return dn->wDriverOffset;
2767  case devnames_device_name: return dn->wDeviceOffset;
2768  case devnames_output_name: return dn->wOutputOffset;
2769  }
2770  ERR("Shouldn't be here\n");
2771  return 0;
2772 }
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:109
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)
Definition: printers.c:1568
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:402
#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:1059
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:1797
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:402
#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:1108
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:402
#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:1059
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:1846
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define HeapFree(x, y, z)
Definition: compat.h:402
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExW().

◆ is_default_metric()

static BOOL is_default_metric ( void  )
inlinestatic

Definition at line 2643 of file printdlg.c.

2644 {
2645  DWORD system;
2646  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
2647  (LPWSTR)&system, sizeof(system));
2648  return system == 0;
2649 }
#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:1098
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 2584 of file printdlg.c.

2585 {
2587 }
#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:2579

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 3235 of file printdlg.c.

3236 {
3237  switch (msg)
3238  {
3239  case EN_CHANGE:
3240  {
3241  WCHAR buf[10];
3242  LONG val = 0;
3244 
3245  if (GetDlgItemTextW(hDlg, id, buf, ARRAY_SIZE(buf)) != 0)
3246  {
3247  WCHAR *end;
3248  WCHAR decimal = get_decimal_sep();
3249 
3250  val = wcstol(buf, &end, 10);
3251  if(end != buf || *end == decimal)
3252  {
3253  int mult = is_metric(data) ? 100 : 1000;
3254  val *= mult;
3255  if(*end == decimal)
3256  {
3257  while(mult > 1)
3258  {
3259  end++;
3260  mult /= 10;
3261  if(iswdigit(*end))
3262  val += (*end - '0') * mult;
3263  else
3264  break;
3265  }
3266  }
3267  }
3268  }
3269  *value = val;
3270  return;
3271  }
3272 
3273  case EN_KILLFOCUS:
3274  update_margin_edits(hDlg, data, id);
3275  return;
3276  }
3277 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3220
#define iswdigit(_c)
Definition: ctype.h:667
GLuint GLuint end
Definition: gl.h:1545
_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:2605
#define EN_KILLFOCUS
Definition: winuser.h:2007
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
static BOOL is_metric(const pagesetup_data *data)
Definition: printdlg.c:2584
#define ARRAY_SIZE(a)
Definition: main.h:24
static LONG * element_from_margin_id(RECT *rc, WORD id)
Definition: printdlg.c:3208
#define msg(x)
Definition: auth_time.c:54
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2938
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by pagesetup_wm_command().

◆ pagesetup_change_preview()

static void pagesetup_change_preview ( const pagesetup_data data)
static

Definition at line 3177 of file printdlg.c.

3178 {
3179  LONG width, height, x, y;
3180  RECT tmp;
3181  const int shadow = 4;
3182 
3184  {
3185  width = data->rtDrawRect.right - data->rtDrawRect.left;
3187  }
3188  else
3189  {
3190  height = data->rtDrawRect.bottom - data->rtDrawRect.top;
3192  }
3193  x = (data->rtDrawRect.right + data->rtDrawRect.left - width) / 2;
3194  y = (data->rtDrawRect.bottom + data->rtDrawRect.top - height) / 2;
3195  TRACE("draw rect %s x=%d, y=%d, w=%d, h=%d\n",
3196  wine_dbgstr_rect(&data->rtDrawRect), x, y, width, height);
3197 
3198  MoveWindow(GetDlgItem(data->hDlg, rct2), x + width, y + shadow, shadow, height, FALSE);
3199  MoveWindow(GetDlgItem(data->hDlg, rct3), x + shadow, y + height, width, shadow, FALSE);
3200  MoveWindow(GetDlgItem(data->hDlg, rct1), x, y, width, height, FALSE);
3201 
3202  tmp = data->rtDrawRect;
3203  tmp.right += shadow;
3204  tmp.bottom += shadow;
3205  InvalidateRect(data->hDlg, &tmp, TRUE);
3206 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2933
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
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:1110
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:2694
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 3045 of file printdlg.c.

3046 {
3047  HANDLE hprn;
3048  DWORD needed;
3049  PRINTER_INFO_2W *prn_info = NULL;
3050  DRIVER_INFO_3W *drv_info = NULL;
3051  DEVMODEW *dm = NULL;
3052  BOOL retval = FALSE;
3053 
3054  if(!OpenPrinterW(name, &hprn, NULL))
3055  {
3056  ERR("Can't open printer %s\n", debugstr_w(name));
3057  goto end;
3058  }
3059 
3060  GetPrinterW(hprn, 2, NULL, 0, &needed);
3061  prn_info = HeapAlloc(GetProcessHeap(), 0, needed);
3062  GetPrinterW(hprn, 2, (LPBYTE)prn_info, needed, &needed);
3063  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
3064  drv_info = HeapAlloc(GetProcessHeap(), 0, needed);
3065  if(!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)drv_info, needed, &needed))
3066  {
3067  ERR("GetPrinterDriverA failed for %s, fix your config!\n", debugstr_w(prn_info->pPrinterName));
3068  goto end;
3069  }
3070  ClosePrinter(hprn);
3071 
3072  needed = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
3073  if(needed == -1)
3074  {
3075  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
3076  goto end;
3077  }
3078 
3079  dm = HeapAlloc(GetProcessHeap(), 0, needed);
3081 
3083  pagesetup_set_devnames(data, drv_info->pDriverPath, prn_info->pPrinterName,
3084  prn_info->pPortName);
3085 
3086  retval = TRUE;
3087 end:
3088  HeapFree(GetProcessHeap(), 0, dm);
3089  HeapFree(GetProcessHeap(), 0, prn_info);
3090  HeapFree(GetProcessHeap(), 0, drv_info);
3091  return retval;
3092 }
#define TRUE
Definition: types.h:120
GLuint GLuint end
Definition: gl.h:1545
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:311
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:1797
unsigned char * LPBYTE
Definition: typedefs.h:53
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:12
smooth NULL
Definition: ftsmooth.c:416
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2903
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:1846
#define GetProcessHeap()
Definition: compat.h:403
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
#define ERR(fmt,...)
Definition: debug.h:109
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:1960
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:2812
#define HeapFree(x, y, z)
Definition: compat.h:402

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 3126 of file printdlg.c.

3127 {
3128  PRINTDLGW prnt;
3129  LPWSTR drvname, devname, portname;
3130  DEVMODEW *tmp_dm, *dm;
3131 
3132  memset(&prnt, 0, sizeof(prnt));
3133  prnt.lStructSize = sizeof(prnt);
3134  prnt.Flags = 0;
3135  prnt.hwndOwner = hDlg;
3136 
3137  drvname = pagesetup_get_drvname(data);
3138  devname = pagesetup_get_devname(data);
3139  portname = pagesetup_get_portname(data);
3140  prnt.hDevNames = 0;
3141  PRINTDLG_CreateDevNamesW(&prnt.hDevNames, drvname, devname, portname);
3142  pagesetup_release_a_devname(data, portname);
3145 
3146  tmp_dm = pagesetup_get_devmode(data);
3147  prnt.hDevMode = GlobalAlloc(GMEM_MOVEABLE, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3148  dm = GlobalLock(prnt.hDevMode);
3149  memcpy(dm, tmp_dm, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3150  GlobalUnlock(prnt.hDevMode);
3152 
3153  if (PrintDlgW(&prnt))
3154  {
3155  DEVMODEW *dm = GlobalLock(prnt.hDevMode);
3156  DEVNAMES *dn = GlobalLock(prnt.hDevNames);
3157 
3159  (WCHAR*)dn + dn->wDeviceOffset, (WCHAR *)dn + dn->wOutputOffset);
3161  GlobalUnlock(prnt.hDevNames);
3162  GlobalUnlock(prnt.hDevMode);
3163  pagesetup_init_combos(hDlg, data);
3164  }
3165 
3166  GlobalFree(prnt.hDevMode);
3167  GlobalFree(prnt.hDevNames);
3168 
3169 }
static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName, LPCWSTR DeviceName, LPCWSTR OutputPort)
Definition: printdlg.c:518
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:1620
DWORD Flags
Definition: commdlg.h:491
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2797
WORD wDeviceOffset
Definition: commdlg.h:298
BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
Definition: printdlg.c:2390
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:2903
DWORD lStructSize
Definition: commdlg.h:486
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2879
__wchar_t WCHAR
Definition: xmlstorage.h:180
WORD dmSize
Definition: wingdi.h:1619
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3100
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:2898
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:2802
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:2812
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:2807
#define memset(x, y, z)
Definition: compat.h:39
static WCHAR * pagesetup_get_drvname(const pagesetup_data *data)
Definition: printdlg.c:2792
#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 3829 of file printdlg.c.

3830 {
3831  BOOL ret;
3832  void *tmpl;
3833 
3835  {
3837  return FALSE;
3838  }
3839 
3841 
3842  if(data->u.dlgw->lStructSize != sizeof(PAGESETUPDLGW))
3843  {
3845  return FALSE;
3846  }
3847 
3850  {
3852  return FALSE;
3853  }
3854 
3856  data->u.dlgw->Flags |= is_default_metric() ?
3858 
3859  if (!data->u.dlgw->hDevMode || !data->u.dlgw->hDevNames)
3860  {
3861  WCHAR *def = get_default_printer();
3862  if(!def)
3863  {
3865  {
3866  WCHAR errstr[256];
3868  MessageBoxW(data->u.dlgw->hwndOwner, errstr, 0, MB_OK | MB_ICONERROR);
3869  }
3871  return FALSE;
3872  }
3874  HeapFree(GetProcessHeap(), 0, def);
3875  }
3876 
3878  {
3880  return TRUE;
3881  }
3882 
3883  tmpl = pagesetup_get_template(data);
3884 
3885  ret = DialogBoxIndirectParamW(data->u.dlgw->hInstance, tmpl,
3886  data->u.dlgw->hwndOwner,
3888  return ret;
3889 }
#define TRUE
Definition: types.h:120
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define PSD_INHUNDREDTHSOFMILLIMETERS
Definition: commdlg.h:175
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:3764
#define PSD_NOWARNING
Definition: commdlg.h:178
#define CDERR_STRUCTSIZE
Definition: cderr.h:6
#define PDERR_NODEFAULTPRN
Definition: cderr.h:26
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2961
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define PD32_NO_DEFAULT_PRINTER
Definition: cdlg.h:56
#define GetProcessHeap()
Definition: compat.h:403
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:2643
#define CDERR_INITIALIZATION
Definition: cderr.h:7
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2949
static void pagesetup_dump_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:3778
#define PSD_INTHOUSANDTHSOFINCHES
Definition: commdlg.h:174
static void * pagesetup_get_template(pagesetup_data *data)
Definition: printdlg.c:3801
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:2973
#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:119
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#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:3045
static INT_PTR CALLBACK pagesetup_dlg_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: printdlg.c:3666
const char * errstr(int errcode)
#define HeapFree(x, y, z)
Definition: compat.h:402
#define PSD_ENABLEPAGEPAINTHOOK
Definition: commdlg.h:186
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2579

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 3666 of file printdlg.c.

3667 {
3669  INT_PTR res = FALSE;
3670  HWND hDrawWnd;
3671 
3672  if (uMsg == WM_INITDIALOG) { /*Init dialog*/
3673  data = (pagesetup_data *)lParam;
3674  data->hDlg = hDlg;
3675 
3676  hDrawWnd = GetDlgItem(hDlg, rct1);
3677  TRACE("set property to %p\n", data);
3679  SetPropW(hDrawWnd, pagesetupdlg_prop, data);
3680  GetWindowRect(hDrawWnd, &data->rtDrawRect); /* Calculating rect in client coordinates where paper draws */
3681  MapWindowPoints( 0, hDlg, (LPPOINT)&data->rtDrawRect, 2 );
3683  hDrawWnd,
3684  GWLP_WNDPROC,
3686 
3687  /* FIXME: Paint hook. Must it be at begin of initialization or at end? */
3688  res = TRUE;
3690  {
3691  if (!pagesetup_get_hook(data, page_setup_hook)(hDlg, uMsg, wParam,
3693  FIXME("Setup page hook failed?\n");
3694  }
3695 
3696  /* if printer button disabled */
3698  EnableWindow(GetDlgItem(hDlg, psh3), FALSE);
3699  /* if margin edit boxes disabled */
3701  {
3702  EnableWindow(GetDlgItem(hDlg, edt4), FALSE);
3703  EnableWindow(GetDlgItem(hDlg, edt5), FALSE);
3704  EnableWindow(GetDlgItem(hDlg, edt6), FALSE);
3705  EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
3706  }
3707 
3708  /* Set orientation radiobuttons properly */
3710 
3711  /* if orientation disabled */
3713  {
3716  }
3717 
3718  /* We fill them out enabled or not */
3720  {
3721  /* default is 1 inch */
3724  }
3725  update_margin_edits(hDlg, data, 0);
3726  subclass_margin_edits(hDlg);
3728 
3729  /* if paper disabled */
3731  {
3734  }
3735 
3736  /* filling combos: printer, paper, source. selecting current printer (from DEVMODEA) */
3737  pagesetup_init_combos(hDlg, data);
3739  pagesetup_set_defaultsource(data, DMBIN_FORMSOURCE); /* FIXME: This is the auto select bin. Is this correct? */
3740 
3741  /* Drawing paper prev */
3743  return TRUE;
3744  } else {
3745  data = GetPropW(hDlg, pagesetupdlg_prop);
3746  if (!data)
3747  {
3748  WARN("__WINE_PAGESETUPDLGDATA prop not set?\n");
3749  return FALSE;
3750  }
3752  {
3754  if (res) return res;
3755  }
3756  }
3757  switch (uMsg) {
3758  case WM_COMMAND:
3759  return pagesetup_wm_command(hDlg, wParam, lParam, data);
3760  }
3761  return FALSE;
3762 }
#define TRUE
Definition: types.h:120
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 PSD_MARGINS
Definition: commdlg.h:173
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3220
#define WARN(fmt,...)
Definition: debug.h:111
#define edt5
Definition: dlgs.h:69
static BOOL pagesetup_wm_command(HWND hDlg, WPARAM wParam, LPARAM lParam, pagesetup_data *data)
Definition: printdlg.c:3358
static void pagesetup_update_orientation_buttons(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3288
int32_t INT_PTR
Definition: typedefs.h:63
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define rad2
Definition: dlgs.h:131
long LONG
Definition: pedump.c:60
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2961
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:110
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:3177
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2949
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3100
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:2973
#define WM_COMMAND
Definition: winuser.h:1722
static void set_margin_groupbox_title(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3279
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#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:2740
#define cmb3
Definition: dlgs.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static void subclass_margin_edits(HWND hDlg)
Definition: printdlg.c:3647
#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:3543
#define DMBIN_FORMSOURCE
Definition: wingdi.h:1196
static const WCHAR pagesetupdlg_prop[]
Definition: printdlg.c:149
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SetWindowLongPtrW
Definition: winuser.h:5321
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2938
#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:1721
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:2597
#define rad1
Definition: dlgs.h:130
#define edt6
Definition: dlgs.h:70
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2579

Referenced by pagesetup_common().

◆ pagesetup_dump_dlg_struct()

static void pagesetup_dump_dlg_struct ( const pagesetup_data data)
static

Definition at line 3778 of file printdlg.c.

3779 {
3780  if(TRACE_ON(commdlg))
3781  {
3782  char flagstr[1000] = "";
3783  const struct pd_flags *pflag = psd_flags;
3784  for( ; pflag->name; pflag++)
3785  {
3786  if(pagesetup_get_flags(data) & pflag->flag)
3787  {
3788  strcat(flagstr, pflag->name);
3789  strcat(flagstr, "|");
3790  }
3791  }
3792  TRACE("%s: (%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n"
3793  "hinst %p, flags %08x (%s)\n",
3794  data->unicode ? "unicode" : "ansi",
3795  data->u.dlgw, data->u.dlgw->hwndOwner, data->u.dlgw->hDevMode,
3796  data->u.dlgw->hDevNames, data->u.dlgw->hInstance,
3797  pagesetup_get_flags(data), flagstr);
3798  }
3799 }
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:65
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2579

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 2774 of file printdlg.c.

2775 {
2776  DEVNAMES *dn;
2777  WCHAR *name;
2778 
2779  dn = GlobalLock(data->u.dlgw->hDevNames);
2780  if(data->unicode)
2781  name = strdupW((WCHAR *)dn + get_devname_offset(dn, which));
2782  else
2783  {
2784  int len = MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, NULL, 0);
2785  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2786  MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, name, len);
2787  }
2788  GlobalUnlock(data->u.dlgw->hDevNames);
2789  return name;
2790 }
#define CP_ACP
Definition: compat.h:99
static GLenum which
Definition: wgl_font.c:159
smooth NULL
Definition: ftsmooth.c:416
static WORD get_devname_offset(const DEVNAMES *dn, devnames_name which)
Definition: printdlg.c:2762
#define GetProcessHeap()
Definition: compat.h:403
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
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define MultiByteToWideChar
Definition: compat.h:100
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 2879 of file printdlg.c.

2880 {
2881  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2882  DEVMODEW *ret;
2883 
2884  if(data->unicode)
2885  {
2886  /* We make a copy even in the unicode case because the ptr
2887  may get passed back to us in pagesetup_set_devmode. */
2888  ret = HeapAlloc(GetProcessHeap(), 0, dm->dmSize + dm->dmDriverExtra);
2889  memcpy(ret, dm, dm->dmSize + dm->dmDriverExtra);
2890  }
2891  else
2893 
2894  GlobalUnlock(data->u.dlgw->hDevMode);
2895  return ret;
2896 }
WORD dmDriverExtra
Definition: wingdi.h:1620
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:969
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WORD dmSize
Definition: wingdi.h:1619
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 2797 of file printdlg.c.

2798 {
2800 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2774
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 2961 of file printdlg.c.

2962 {
2963  return (LPARAM)data->u.dlgw;
2964 }
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 2792 of file printdlg.c.

2793 {
2795 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2774
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 2579 of file printdlg.c.

2580 {
2581  return data->u.dlgw->Flags;
2582 }
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 2949 of file printdlg.c.

2950 {
2951  switch(which)
2952  {
2953  case page_setup_hook: return data->u.dlgw->lpfnPageSetupHook;
2954  case page_paint_hook: return data->u.dlgw->lpfnPagePaintHook;
2955  }
2956  return NULL;
2957 }
static GLenum which
Definition: wgl_font.c:159
smooth NULL
Definition: ftsmooth.c:416
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

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 2938 of file printdlg.c.

2939 {
2940  return &data->u.dlgw->rtMargin;
2941 }
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 2694 of file printdlg.c.

2695 {
2696  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2697  WORD orient;
2698 
2699  if(data->unicode)
2700  orient = dm->u1.s1.dmOrientation;
2701  else
2702  {
2703  DEVMODEA *dmA = (DEVMODEA *)dm;
2704  orient = dmA->u1.s1.dmOrientation;
2705  }
2706  GlobalUnlock(data->u.dlgw->hDevMode);
2707  return orient;
2708 }
short dmOrientation
Definition: wingdi.h:1624
short dmOrientation
Definition: wingdi.h:1572
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 2724 of file printdlg.c.

2725 {
2726  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2727  WORD paper;
2728 
2729  if(data->unicode)
2730  paper = dm->u1.s1.dmPaperSize;
2731  else
2732  {
2733  DEVMODEA *dmA = (DEVMODEA *)dm;
2734  paper = dmA->u1.s1.dmPaperSize;
2735  }
2736  GlobalUnlock(data->u.dlgw->hDevMode);
2737  return paper;
2738 }
short dmPaperSize
Definition: wingdi.h:1625
short dmPaperSize
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_printer_properties(), and pagesetup_update_papersize().

◆ pagesetup_get_papersize_pt()

static POINT* pagesetup_get_papersize_pt ( const pagesetup_data data)
inlinestatic

Definition at line 2933 of file printdlg.c.

2934 {
2935  return &data->u.dlgw->ptPaperSize;
2936 }
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 2802 of file printdlg.c.

2803 {
2805 }
static WCHAR * pagesetup_get_a_devname(const pagesetup_data *data, devnames_name which)
Definition: printdlg.c:2774
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 3801 of file printdlg.c.

3802 {
3803  HRSRC res;
3804  HGLOBAL tmpl_handle;
3805 
3807  {
3808  tmpl_handle = data->u.dlgw->hPageSetupTemplate;
3809  }
3811  {
3812  if(data->unicode)
3813  res = FindResourceW(data->u.dlgw->hInstance,
3814  data->u.dlgw->lpPageSetupTemplateName, (LPWSTR)RT_DIALOG);
3815  else
3816  res = FindResourceA(data->u.dlga->hInstance,
3817  data->u.dlga->lpPageSetupTemplateName, (LPSTR)RT_DIALOG);
3818  tmpl_handle = LoadResource(data->u.dlgw->hInstance, res);
3819  }
3820  else
3821  {
3823  (LPWSTR)RT_DIALOG);
3824  tmpl_handle = LoadResource(COMDLG32_hInstance, res);
3825  }
3826  return LockResource(tmpl_handle);
3827 }
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:2579

Referenced by pagesetup_common().

◆ pagesetup_init_combos()

static void pagesetup_init_combos ( HWND  hDlg,
pagesetup_data data 
)
static

Definition at line 3100 of file printdlg.c.

3101 {
3102  DEVMODEW *dm;
3103  LPWSTR devname, portname;
3104 
3106  devname = pagesetup_get_devname(data);
3107  portname = pagesetup_get_portname(data);
3108 
3109  PRINTDLG_SetUpPrinterListComboW(hDlg, cmb1, devname);
3110  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb2, devname, portname, dm);
3111  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb3, devname, portname, dm);
3112 
3113  pagesetup_release_a_devname(data, portname);
3116 }
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2797
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2879
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:2898
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2802
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:888
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2807
#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 3636 of file printdlg.c.

3637 {
3638  if (msg == WM_CHAR)
3639  {
3640  WCHAR decimal = get_decimal_sep();
3641  WCHAR wc = (WCHAR)wparam;
3642  if(!iswdigit(wc) && wc != decimal && wc != VK_BACK) return 0;
3643  }
3645 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_CHAR
Definition: winuser.h:1699
#define iswdigit(_c)
Definition: ctype.h:667
static WCHAR get_decimal_sep(void)
Definition: printdlg.c:2605
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:2173
#define msg(x)
Definition: auth_time.c:54
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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 3301 of file printdlg.c.

3302 {
3303  HANDLE hprn;
3304  LPWSTR devname;
3305  DEVMODEW *dm;
3306  LRESULT count;
3307  int i;
3308 
3309  devname = pagesetup_get_devname(data);
3310 
3311  if (!OpenPrinterW(devname, &hprn, NULL))
3312  {
3313  FIXME("Call to OpenPrinter did not succeed!\n");
3315  return;
3316  }
3317 
3319  DocumentPropertiesW(hDlg, hprn, devname, dm, dm, DM_IN_BUFFER | DM_OUT_BUFFER | DM_IN_PROMPT);
3323  ClosePrinter(hprn);
3324 
3325  /* Changing paper */
3328 
3329  /* Changing paper preview */
3331 
3332  /* Selecting paper in combo */
3333  count = SendDlgItemMessageW(hDlg, cmb2, CB_GETCOUNT, 0, 0);
3334  if(count != CB_ERR)
3335  {
3336  WORD paperword = pagesetup_get_papersize(data);
3337  for(i = 0; i < count; i++)
3338  {
3339  if(SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0) == paperword) {
3340  SendDlgItemMessageW(hDlg, cmb2, CB_SETCURSEL, i, 0);
3341  break;
3342  }
3343  }
3344  }
3345 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2724
#define DM_IN_PROMPT
Definition: windef.h:358
#define CB_GETITEMDATA
Definition: winuser.h:1932
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void pagesetup_update_orientation_buttons(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3288
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:311
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2797
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 DM_OUT_BUFFER
Definition: windef.h:359
#define FIXME(fmt,...)
Definition: debug.h:110
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:12
smooth NULL
Definition: ftsmooth.c:416
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2903
#define CB_ERR
Definition: winuser.h:2410
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2879
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3177
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:2973
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2898
#define CB_SETCURSEL
Definition: winuser.h:1943
#define cmb2
Definition: dlgs.h:49
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:1960
#define DM_IN_BUFFER
Definition: windef.h:357
#define CB_GETCOUNT
Definition: winuser.h:1924
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:2807

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 2807 of file printdlg.c.

2808 {
2809  HeapFree(GetProcessHeap(), 0, name);
2810 }
#define GetProcessHeap()
Definition: compat.h:403
Definition: name.c:38
#define HeapFree(x, y, z)
Definition: compat.h:402

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 2898 of file printdlg.c.

2899 {
2900  HeapFree(GetProcessHeap(), 0, dm);
2901 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

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 2740 of file printdlg.c.

2741 {
2742  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2743 
2744  if(data->unicode)
2745  dm->u1.s1.dmDefaultSource = source;
2746  else
2747  {
2748  DEVMODEA *dmA = (DEVMODEA *)dm;
2749  dmA->u1.s1.dmDefaultSource = source;
2750  }
2751  GlobalUnlock(data->u.dlgw->hDevMode);
2752 }
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:1630
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
short dmDefaultSource
Definition: wingdi.h:1578

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 2903 of file printdlg.c.

2904 {
2905  DEVMODEA *dmA = NULL;
2906  void *src, *dst;
2907  DWORD size;
2908 
2909  if(data->unicode)
2910  {
2911  size = dm->dmSize + dm->dmDriverExtra;
2912  src = dm;
2913  }
2914  else
2915  {
2916  dmA = convert_to_devmodeA(dm);
2917  size = dmA->dmSize + dmA->dmDriverExtra;
2918  src = dmA;
2919  }
2920 
2921  if(data->u.dlgw->hDevMode)
2922  data->u.dlgw->hDevMode = GlobalReAlloc(data->u.dlgw->hDevMode, size,
2923  GMEM_MOVEABLE);
2924  else
2925  data->u.dlgw->hDevMode = GlobalAlloc(GMEM_MOVEABLE, size);
2926 
2927  dst = GlobalLock(data->u.dlgw->hDevMode);
2928  memcpy(dst, src, size);
2929  GlobalUnlock(data->u.dlgw->hDevMode);
2930  HeapFree(GetProcessHeap(), 0, dmA);
2931 }
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:1567
WORD dmDriverExtra
Definition: wingdi.h:1568
WORD dmDriverExtra
Definition: wingdi.h:1620
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
WORD dmSize
Definition: wingdi.h:1619
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
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:402
#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 2812 of file printdlg.c.

2813 {
2814  DEVNAMES *dn;
2815  WCHAR def[256];
2816  DWORD len = sizeof(DEVNAMES), drv_len, dev_len, port_len;
2817 
2818  if(data->unicode)
2819  {
2820  drv_len = (lstrlenW(drv) + 1) * sizeof(WCHAR);
2821  dev_len = (lstrlenW(devname) + 1) * sizeof(WCHAR);
2822  port_len = (lstrlenW(port) + 1) * sizeof(WCHAR);
2823  }
2824  else
2825  {
2826  drv_len = WideCharToMultiByte(CP_ACP, 0, drv, -1, NULL, 0, NULL, NULL);
2827  dev_len = WideCharToMultiByte(CP_ACP, 0, devname, -1, NULL, 0, NULL, NULL);
2828  port_len = WideCharToMultiByte(CP_ACP, 0, port, -1, NULL, 0, NULL, NULL);
2829  }
2830  len += drv_len + dev_len + port_len;
2831 
2832  if(data->u.dlgw->hDevNames)
2833  data->u.dlgw->hDevNames = GlobalReAlloc(data->u.dlgw->hDevNames, len, GMEM_MOVEABLE);
2834  else
2835  data->u.dlgw->hDevNames = GlobalAlloc(GMEM_MOVEABLE, len);
2836 
2837  dn = GlobalLock(data->u.dlgw->hDevNames);
2838 
2839  if(data->unicode)
2840  {
2841  WCHAR *ptr = (WCHAR *)(dn + 1);
2842  len = sizeof(DEVNAMES) / sizeof(WCHAR);
2843  dn->wDriverOffset = len;
2844  lstrcpyW(ptr, drv);
2845  ptr += drv_len / sizeof(WCHAR);
2846  len += drv_len / sizeof(WCHAR);
2847  dn->wDeviceOffset = len;
2848  lstrcpyW(ptr, devname);
2849  ptr += dev_len / sizeof(WCHAR);
2850  len += dev_len / sizeof(WCHAR);
2851  dn->wOutputOffset = len;
2852  lstrcpyW(ptr, port);
2853  }
2854  else
2855  {
2856  char *ptr = (char *)(dn + 1);
2857  len = sizeof(DEVNAMES);
2858  dn->wDriverOffset = len;
2859  WideCharToMultiByte(CP_ACP, 0, drv, -1, ptr, drv_len, NULL, NULL);
2860  ptr += drv_len;
2861  len += drv_len;
2862  dn->wDeviceOffset = len;
2863  WideCharToMultiByte(CP_ACP, 0, devname, -1, ptr, dev_len, NULL, NULL);
2864  ptr += dev_len;
2865  len += dev_len;
2866  dn->wOutputOffset = len;
2867  WideCharToMultiByte(CP_ACP, 0, port, -1, ptr, port_len, NULL, NULL);
2868  }
2869 
2870  dn->wDefault = 0;
2871  len = ARRAY_SIZE(def);
2872  GetDefaultPrinterW(def, &len);
2873  if(!lstrcmpW(def, devname))
2874  dn->wDefault = 1;
2875 
2876  GlobalUnlock(data->u.dlgw->hDevNames);
2877 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define WideCharToMultiByte
Definition: compat.h:101
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1017
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:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define lstrlenW
Definition: compat.h:415
struct tagDEVNAMES DEVNAMES
static PVOID ptr
Definition: dispmode.c:27
WORD wDeviceOffset
Definition: commdlg.h:298
smooth NULL
Definition: ftsmooth.c:416
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:414
#define ARRAY_SIZE(a)
Definition: main.h:24
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 2678 of file printdlg.c.

2679 {
2680  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2681 
2682  assert(orient == DMORIENT_PORTRAIT || orient == DMORIENT_LANDSCAPE);
2683 
2684  if(data->unicode)
2685  dm->u1.s1.dmOrientation = orient;
2686  else
2687  {
2688  DEVMODEA *dmA = (DEVMODEA *)dm;
2689  dmA->u1.s1.dmOrientation = orient;
2690  }
2691  GlobalUnlock(data->u.dlgw->hDevMode);
2692 }
short dmOrientation
Definition: wingdi.h:1624
#define assert(x)
Definition: debug.h:53
short dmOrientation
Definition: wingdi.h:1572
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1110
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:1109

Referenced by pagesetup_wm_command().

◆ pagesetup_set_papersize()

static void pagesetup_set_papersize ( pagesetup_data data,
WORD  paper 
)
static

Definition at line 2710 of file printdlg.c.

2711 {
2712  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2713 
2714  if(data->unicode)
2715  dm->u1.s1.dmPaperSize = paper;
2716  else
2717  {
2718  DEVMODEA *dmA = (DEVMODEA *)dm;
2719  dmA->u1.s1.dmPaperSize = paper;
2720  }
2721  GlobalUnlock(data->u.dlgw->hDevMode);
2722 }
short dmPaperSize
Definition: wingdi.h:1625
short dmPaperSize
Definition: wingdi.h:1573
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 3288 of file printdlg.c.

3289 {
3291  CheckRadioButton(hDlg, rad1, rad2, rad2);
3292  else
3293  CheckRadioButton(hDlg, rad1, rad2, rad1);
3294 }
#define rad2
Definition: dlgs.h:131
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1110
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:2694
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 2973 of file printdlg.c.

2974 {
2975  DEVMODEW *dm;
2976  LPWSTR devname, portname;
2977  int i, num;
2978  WORD *words = NULL, paperword;
2979  POINT *points = NULL;
2980  BOOL retval = FALSE;
2981 
2983  devname = pagesetup_get_devname(data);
2984  portname = pagesetup_get_portname(data);
2985 
2986  num = DeviceCapabilitiesW(devname, portname, DC_PAPERS, NULL, dm);
2987  if (num <= 0)
2988  {
2989  FIXME("No papernames found for %s/%s\n", debugstr_w(devname), debugstr_w(portname));
2990  goto end;
2991  }
2992 
2993  words = HeapAlloc(GetProcessHeap(), 0, num * sizeof(WORD));
2994  points = HeapAlloc(GetProcessHeap(), 0, num * sizeof(POINT));
2995 
2996  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERS, (LPWSTR)words, dm))
2997  {
2998  FIXME("Number of returned words is not %d\n", num);
2999  goto end;
3000  }
3001 
3002  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERSIZE, (LPWSTR)points, dm))
3003  {
3004  FIXME("Number of returned sizes is not %d\n", num);
3005  goto end;
3006  }
3007 
3008  paperword = pagesetup_get_papersize(data);
3009 
3010  for (i = 0; i < num; i++)
3011  if (words[i] == paperword)
3012  break;
3013 
3014  if (i == num)
3015  {
3016  FIXME("Papersize %d not found in list?\n", paperword);
3017  goto end;
3018  }
3019 
3020  /* this is _10ths_ of a millimeter */
3023 
3026 
3027  retval = TRUE;
3028 
3029 end:
3030  HeapFree(GetProcessHeap(), 0, words);
3032  pagesetup_release_a_devname(data, portname);
3035 
3036  return retval;
3037 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2724
#define DC_PAPERS
Definition: windef.h:363
#define TRUE
Definition: types.h:120
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2933
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static LONG tenths_mm_to_size(const pagesetup_data *data, LONG size)
Definition: printdlg.c:2589
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
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:2797
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2879
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DMORIENT_LANDSCAPE
Definition: wingdi.h:1110
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
GLsizei const GLfloat * points
Definition: glext.h:8112
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2898
static void swap_point(POINT *pt)
Definition: printdlg.c:2966
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2802
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2694
#define DC_PAPERSIZE
Definition: windef.h:364
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:2807
#define HeapFree(x, y, z)
Definition: compat.h:402

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 3358 of file printdlg.c.

3359 {
3360  WORD msg = HIWORD(wParam);
3361  WORD id = LOWORD(wParam);
3362 
3363  TRACE("loword (lparam) %d, wparam 0x%lx, lparam %08lx\n",
3365  switch (id) {
3366  case IDOK:
3367  EndDialog(hDlg, TRUE);
3368  return TRUE ;
3369 
3370  case IDCANCEL:
3371  EndDialog(hDlg, FALSE);
3372  return FALSE ;
3373 
3374  case psh3: /* Printer... */
3376  return TRUE;
3377 
3378  case rad1: /* Portrait */
3379  case rad2: /* Landscape */
3382  {
3386  update_margin_edits(hDlg, data, 0);
3388  }
3389  break;
3390  case cmb1: /* Printer combo */
3391  if(msg == CBN_SELCHANGE)
3392  {
3393  WCHAR *name;
3394  INT index = SendDlgItemMessageW(hDlg, id, CB_GETCURSEL, 0, 0);
3396  name = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(length+1));
3399  pagesetup_init_combos(hDlg, data);
3401  }
3402  break;
3403  case cmb2: /* Paper combo */
3404  if(msg == CBN_SELCHANGE)
3405  {
3406  DWORD paperword = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA,
3407  SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0), 0);
3408  if (paperword != CB_ERR)
3409  {
3410  pagesetup_set_papersize(data, paperword);
3413  } else
3414  FIXME("could not get dialog text for papersize cmbbox?\n");
3415  }
3416  break;
3417  case cmb3: /* Paper Source */
3418  if(msg == CBN_SELCHANGE)
3419  {
3421  SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0), 0);
3423  }
3424  break;
3425  case psh2: /* Printer Properties button */
3427  break;
3428  case edt4:
3429  case edt5:
3430  case edt6:
3431  case edt7:
3432  margin_edit_notification(hDlg, data, msg, id);
3433  break;
3434  }
3436  return FALSE;
3437 }
static void pagesetup_printer_properties(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3301
#define CB_GETLBTEXTLEN
Definition: winuser.h:1935
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define CB_GETLBTEXT
Definition: winuser.h:1934
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3220
#define CB_GETITEMDATA
Definition: winuser.h:1932
static void pagesetup_change_printer_dialog(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3126
#define edt5
Definition: dlgs.h:69
static void pagesetup_set_orientation(pagesetup_data *data, WORD orient)
Definition: printdlg.c:2678
#define psh2
Definition: dlgs.h:113
int32_t INT
Definition: typedefs.h:57
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define rad2
Definition: dlgs.h:131
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:110
#define edt4
Definition: dlgs.h:68
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define CB_ERR
Definition: winuser.h:2410
static void rotate_rect(RECT *rc, BOOL sense)
Definition: printdlg.c:2657
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
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:1110
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3177
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:3100
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:2973
static void margin_edit_notification(HWND hDlg, const pagesetup_data *data, WORD msg, WORD id)
Definition: printdlg.c:3235
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2694
#define cmb2
Definition: dlgs.h:49
static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
Definition: printdlg.c:2740
static void pagesetup_set_papersize(pagesetup_data *data, WORD paper)
Definition: printdlg.c:2710
#define cmb3
Definition: dlgs.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1961
#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:3045
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1109
#define HIWORD(l)
Definition: typedefs.h:246
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2938
#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:402
#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 3910 of file printdlg.c.

3911 {
3913 
3914  data.unicode = FALSE;
3915  data.u.dlga = setupdlg;
3916 
3917  return pagesetup_common(&data);
3918 }
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3829
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 3925 of file printdlg.c.

3926 {
3928 
3929  data.unicode = TRUE;
3930  data.u.dlgw = setupdlg;
3931 
3932  return pagesetup_common(&data);
3933 }
#define TRUE
Definition: types.h:120
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3829
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 3967 of file printdlg.c.

3968 {
3969  pdlgex->hDevMode = pdlg->hDevMode;
3970  pdlgex->hDevNames = pdlg->hDevNames;
3971  pdlgex->hDC = pdlg->hDC;
3972  if (!(pdlgex->Flags & PD_NOPAGENUMS) && pdlgex->nPageRanges && pdlgex->lpPageRanges)
3973  {
3974  pdlgex->lpPageRanges[0].nFromPage = pdlg->nFromPage;
3975  pdlgex->lpPageRanges[0].nToPage = pdlg->nToPage;
3976  }
3977  pdlgex->nMinPage = pdlg->nMinPage;
3978  pdlgex->nMaxPage = pdlg->nMaxPage;
3979  pdlgex->nCopies = pdlg->nCopies;
3980 }
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 3988 of file printdlg.c.

3989 {
3990  if (msg == WM_INITDIALOG)
3991  {
3992  PRINTDLGW *pd = (PRINTDLGW *)lp;
3993  struct callback_data *cb = (struct callback_data *)pd->lCustData;
3994 
3995  if (cb->callback)
3996  {
3997  cb->callback->lpVtbl->SelectionChange(cb->callback);
3998  cb->callback->lpVtbl->InitDone(cb->callback);
3999  }
4000  }
4001  else
4002  {
4003 /* FIXME: store interface pointer somewhere in window properties and call it
4004  HRESULT hres;
4005  cb->callback->lpVtbl->HandleMessage(cb->callback, hwnd, msg, wp, lp, &hres);
4006 */
4007  }
4008 
4009  return 0;
4010 }
if(!(yy_init))
Definition: macro.lex.yy.c:714
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:1721

Referenced by PrintDlgExA(), and PrintDlgExW().

◆ pdlgex_to_pdlg()

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

Definition at line 3935 of file printdlg.c.

3936 {
3937  pdlg->lStructSize = sizeof(*pdlg);
3938  pdlg->hwndOwner = pdlgex->hwndOwner;
3939  pdlg->hDevMode = pdlgex->hDevMode;
3940  pdlg->hDevNames = pdlgex->hDevNames;
3941  pdlg->hDC = pdlgex->hDC;
3942  pdlg->Flags = pdlgex->Flags;
3943  if ((pdlgex->Flags & PD_NOPAGENUMS) || !pdlgex->nPageRanges || !pdlgex->lpPageRanges)
3944  {
3945  pdlg->nFromPage = 0;
3946  pdlg->nToPage = 65534;
3947  }
3948  else
3949  {
3950  pdlg->nFromPage = pdlgex->lpPageRanges[0].nFromPage;
3951  pdlg->nToPage = pdlgex->lpPageRanges[0].nToPage;
3952  }
3953  pdlg->nMinPage = pdlgex->nMinPage;
3954  pdlg->nMaxPage = pdlgex->nMaxPage;
3955  pdlg->nCopies = pdlgex->nCopies;
3956  pdlg->hInstance = pdlgex->hInstance;
3957  pdlg->lCustData = 0;
3958  pdlg->lpfnPrintHook = NULL;
3959  pdlg->lpfnSetupHook = NULL;
3960  pdlg->lpPrintTemplateName = pdlgex->lpPrintTemplateName;
3961  pdlg->lpSetupTemplateName = NULL;
3962  pdlg->hPrintTemplate = NULL;
3963  pdlg->hSetupTemplate = NULL;
3964 }
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
smooth NULL
Definition: ftsmooth.c:416
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
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 1079 of file printdlg.c.

1080 {
1081  LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
1082  LPDEVMODEA lpdm = NULL;
1083  LONG dmSize;
1084  DWORD needed;
1085  HANDLE hprn;
1086 
1087  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1088  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1089  if(!OpenPrinterA(name, &hprn, NULL)) {
1090  ERR("Can't open printer %s\n", name);
1091  return FALSE;
1092  }
1093  GetPrinterA(hprn, 2, NULL, 0, &needed);
1094  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1095  GetPrinterA(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1096  &needed);
1097  GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
1098  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1099  if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1100  needed, &needed)) {
1101  ERR("GetPrinterDriverA failed for %s, fix your config!\n",PrintStructures->lpPrinterInfo->pPrinterName);
1102  return FALSE;
1103  }
1104  ClosePrinter(hprn);
1105 
1106  PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo);
1107 
1108  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1109  PrintStructures->lpDevMode = NULL;
1110 
1111  dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0);
1112  if(dmSize == -1) {
1113  ERR("DocumentProperties fails on %s\n", debugstr_a(name));
1114  return FALSE;
1115  }
1116  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1117  dmSize = DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, NULL,
1118  DM_OUT_BUFFER);
1119  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1120  !lstrcmpA( (LPSTR) lpdm->dmDeviceName,
1121  (LPSTR) PrintStructures->lpDevMode->dmDeviceName)) {
1122  /* Supplied devicemode matches current printer so try to use it */
1123  DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, lpdm,
1125  }
1126  if(lpdm)
1127  GlobalUnlock(lppd->hDevMode);
1128 
1129  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1130 
1131  if(!(lppd->Flags & PD_PRINTSETUP)) {
1132  /* Print range (All/Range/Selection) */
1133  if(lppd->nFromPage != 0xffff)
1134  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1135  if(lppd->nToPage != 0xffff)
1136  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1137 
1138  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1139  if (lppd->Flags & PD_NOSELECTION)
1140  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1141  else
1142  if (lppd->Flags & PD_SELECTION)
1143  CheckRadioButton(hDlg, rad1, rad3, rad2);
1144  if (lppd->Flags & PD_NOPAGENUMS) {
1145  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1147  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1149  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1150  } else {
1151  if (lppd->Flags & PD_PAGENUMS)
1152  CheckRadioButton(hDlg, rad1, rad3, rad3);
1153  }
1154 
1155  /* Collate pages
1156  *
1157  * FIXME: The ico3 is not displayed for some reason. I don't know why.
1158  */
1159  if (lppd->Flags & PD_COLLATE) {
1161  (LPARAM)PrintStructures->hCollateIcon);
1162  CheckDlgButton(hDlg, chx2, 1);
1163  } else {
1165  (LPARAM)PrintStructures->hNoCollateIcon);
1166  CheckDlgButton(hDlg, chx2, 0);
1167  }
1168 
1169  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1170  /* if printer doesn't support it: no Collate */
1171  if (!(lpdm->dmFields & DM_COLLATE)) {
1172  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1173  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1174  }
1175  }
1176 
1177  /* nCopies */
1178  {
1179  INT copies;
1180  if (lppd->hDevMode == 0)
1181  copies = lppd->nCopies;
1182  else
1183  copies = lpdm->u1.s1.dmCopies;
1184  if(copies == 0) copies = 1;
1185  else if(copies < 0) copies = MAX_COPIES;
1186  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1187  }
1188 
1189  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1190  /* if printer doesn't support it: no nCopies */
1191  if (!(lpdm->dmFields & DM_COPIES)) {
1192  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1193  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1194  }
1195  }
1196 
1197  /* print to file */
1198  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1199  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1200  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1201  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1202  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1203 
1204  /* Fill print quality combo, PrintDlg16 */
1205  if(GetDlgItem(hDlg, cmb1))
1206  {
1207  DWORD numResolutions = DeviceCapabilitiesA(PrintStructures->lpPrinterInfo->pPrinterName,
1208  PrintStructures->lpPrinterInfo->pPortName,
1209  DC_ENUMRESOLUTIONS, NULL, lpdm);
1210 
1211  if(numResolutions != -1)
1212  {
1213  HWND hQuality = GetDlgItem(hDlg, cmb1);
1214  LONG* Resolutions;
1215  char buf[255];
1216  DWORD i;
1217  int dpiX, dpiY;
1218  HDC hPrinterDC = CreateDCA(PrintStructures->lpPrinterInfo->pDriverName,
1219  PrintStructures->lpPrinterInfo->pPrinterName,
1220  0, lpdm);
1221 
1222  Resolutions = HeapAlloc(GetProcessHeap(), 0, numResolutions*sizeof(LONG)*2);
1224  PrintStructures->lpPrinterInfo->pPortName,
1225  DC_ENUMRESOLUTIONS, (LPSTR)Resolutions, lpdm);
1226 
1227  dpiX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
1228  dpiY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
1229  DeleteDC(hPrinterDC);
1230 
1231  SendMessageA(hQuality, CB_RESETCONTENT, 0, 0);
1232  for(i = 0; i < (numResolutions * 2); i += 2)
1233  {
1234  BOOL IsDefault = FALSE;
1235  LRESULT Index;
1236 
1237  if(Resolutions[i] == Resolutions[i+1])
1238  {
1239  if(dpiX == Resolutions[i])
1240  IsDefault = TRUE;
1241  sprintf(buf, "%d dpi", Resolutions[i]);
1242  } else
1243  {
1244  if(dpiX == Resolutions[i] && dpiY == Resolutions[i+1])
1245  IsDefault = TRUE;
1246  sprintf(buf, "%d dpi x %d dpi", Resolutions[i], Resolutions[i+1]);
1247  }
1248 
1249  Index = SendMessageA(hQuality, CB_ADDSTRING, 0, (LPARAM)buf);
1250 
1251  if(IsDefault)
1252  SendMessageA(hQuality, CB_SETCURSEL, Index, 0);
1253 
1254  SendMessageA(hQuality, CB_SETITEMDATA, Index, MAKELONG(dpiX,dpiY));
1255  }
1256  HeapFree(GetProcessHeap(), 0, Resolutions);
1257  }
1258  }
1259  } else { /* PD_PRINTSETUP */
1260  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1261 
1263  PrintStructures->lpPrinterInfo->pPrinterName,
1264  PrintStructures->lpPrinterInfo->pPortName,
1265  lpdm);
1267  PrintStructures->lpPrinterInfo->pPrinterName,
1268  PrintStructures->lpPrinterInfo->pPortName,
1269  lpdm);
1270  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1272  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1273  PrintStructures->hLandscapeIcon));
1274 
1275  }
1276 
1277  /* help button */
1278  if ((lppd->Flags & PD_SHOWHELP)==0) {
1279  /* hide if PD_SHOWHELP not specified */
1281  }
1282  return TRUE;
1283 }
HICON hPortraitIcon
Definition: printdlg.c:68
WINBOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:1568
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
#define CB_SETITEMDATA
Definition: winuser.h:1948
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define LOGPIXELSX
Definition: wingdi.h:717
#define PD_NOSELECTION
Definition: commdlg.h:149
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
HICON hNoCollateIcon
Definition: printdlg.c:67
HICON hCollateIcon
Definition: printdlg.c:66
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#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:1108
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:1264
int32_t INT
Definition: typedefs.h:57
static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *pi)
Definition: printdlg.c:1002
#define rad2
Definition: dlgs.h:131
static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg, int nIDComboBox, char *PrinterName, char *PortName, LPDEVMODEA dm)
Definition: printdlg.c:779
#define ico1
Definition: dlgs.h:90
#define sprintf(buf, format,...)
Definition: sprintf.c:55
short dmCopies
Definition: wingdi.h:1577
LPDRIVER_INFO_3A lpDriverInfo
Definition: printdlg.c:64
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 PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
unsigned char * LPBYTE
Definition: typedefs.h:53
#define DC_ENUMRESOLUTIONS
Definition: windef.h:374
#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:1572
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:12
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
#define CB_ADDSTRING
Definition: winuser.h:1918
#define MAKELONG(a, b)
Definition: typedefs.h:248
WORD nFromPage
Definition: commdlg.h:471
smooth NULL
Definition: ftsmooth.c:416
LPSTR pDriverName
Definition: winspool.h:42
LONG WINAPI DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode)
Definition: printers.c:206
#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:1895
#define CB_RESETCONTENT
Definition: winuser.h:1941
LPSTR pPrinterName
Definition: winspool.h:39
#define GetProcessHeap()
Definition: compat.h:403
#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
#define rad3
Definition: dlgs.h:132
static const UCHAR Index[8]
Definition: usbohci.c:18
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:1569
#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:1943
#define PD_PRINTTOFILE
Definition: commdlg.h:152
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:109
#define cmb2
Definition: dlgs.h:49
#define DM_IN_BUFFER
Definition: windef.h:357
BOOL WINAPI DeleteDC(_In_ HDC)
#define cmb3
Definition: dlgs.h:50
#define DM_COPIES
Definition: wingdi.h:1257
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BYTE dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1564
#define pshHelp
Definition: dlgs.h:127
#define STM_SETIMAGE
Definition: winuser.h:2075
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:1109
#define edt3
Definition: dlgs.h:67
#define LOGPIXELSY
Definition: wingdi.h:718
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:402
#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 1285 of file printdlg.c.

1287 {
1288  LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
1289  LPDEVMODEW lpdm = NULL;
1290  LONG dmSize;
1291  DWORD needed;
1292  HANDLE hprn;
1293 
1294  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1295  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1296  if(!OpenPrinterW(name, &hprn, NULL)) {
1297  ERR("Can't open printer %s\n", debugstr_w(name));
1298  return FALSE;
1299  }
1300  GetPrinterW(hprn, 2, NULL, 0, &needed);
1301  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1302  GetPrinterW(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1303  &needed);
1304  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
1305  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1306  if (!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1307  needed, &needed)) {
1308  ERR("GetPrinterDriverA failed for %s, fix your config!\n",debugstr_w(PrintStructures->lpPrinterInfo->pPrinterName));
1309  return FALSE;
1310  }
1311  ClosePrinter(hprn);
1312 
1313  PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo);
1314 
1315  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1316  PrintStructures->lpDevMode = NULL;
1317 
1318  dmSize = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
1319  if(dmSize == -1) {
1320  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
1321  return FALSE;
1322  }
1323  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1324  dmSize = DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, NULL,
1325  DM_OUT_BUFFER);
1326  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1327  !lstrcmpW(lpdm->dmDeviceName,
1328  PrintStructures->lpDevMode->dmDeviceName)) {
1329  /* Supplied devicemode matches current printer so try to use it */
1330  DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, lpdm,
1332  }
1333  if(lpdm)
1334  GlobalUnlock(lppd->hDevMode);
1335 
1336  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1337 
1338  if(!(lppd->Flags & PD_PRINTSETUP)) {
1339  /* Print range (All/Range/Selection) */
1340  if(lppd->nFromPage != 0xffff)
1341  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1342  if(lppd->nToPage != 0xffff)
1343  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1344 
1345  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1346  if (lppd->Flags & PD_NOSELECTION)
1347  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1348  else
1349  if (lppd->Flags & PD_SELECTION)
1350  CheckRadioButton(hDlg, rad1, rad3, rad2);
1351  if (lppd->Flags & PD_NOPAGENUMS) {
1352  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1354  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1356  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1357  } else {
1358  if (lppd->Flags & PD_PAGENUMS)
1359  CheckRadioButton(hDlg, rad1, rad3, rad3);
1360  }
1361 
1362  /* Collate pages
1363  *
1364  * FIXME: The ico3 is not displayed for some reason. I don't know why.
1365  */
1366  if (lppd->Flags & PD_COLLATE) {
1368  (LPARAM)PrintStructures->hCollateIcon);
1369  CheckDlgButton(hDlg, chx2, 1);
1370  } else {
1372  (LPARAM)PrintStructures->hNoCollateIcon);
1373  CheckDlgButton(hDlg, chx2, 0);
1374  }
1375 
1376  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1377  /* if printer doesn't support it: no Collate */
1378  if (!(lpdm->dmFields & DM_COLLATE)) {
1379  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1380  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1381  }
1382  }
1383 
1384  /* nCopies */
1385  {
1386  INT copies;
1387  if (lppd->hDevMode == 0)
1388  copies = lppd->nCopies;
1389  else
1390  copies = lpdm->u1.s1.dmCopies;
1391  if(copies == 0) copies = 1;
1392  else if(copies < 0) copies = MAX_COPIES;
1393  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1394  }
1395 
1396  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1397  /* if printer doesn't support it: no nCopies */
1398  if (!(lpdm->dmFields & DM_COPIES)) {
1399  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1400  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1401  }
1402  }
1403 
1404  /* print to file */
1405  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1406  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1407  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1408  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1409  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1410 
1411  } else { /* PD_PRINTSETUP */
1412  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1413 
1415  PrintStructures->lpPrinterInfo->pPrinterName,
1416  PrintStructures->lpPrinterInfo->pPortName,
1417  lpdm);
1419  PrintStructures->lpPrinterInfo->pPrinterName,
1420  PrintStructures->lpPrinterInfo->pPortName,
1421  lpdm);
1422  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1424  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1425  PrintStructures->hLandscapeIcon));
1426 
1427  }
1428 
1429  /* help button */
1430  if ((lppd->Flags & PD_SHOWHELP)==0) {
1431  /* hide if PD_SHOWHELP not specified */
1433  }
1434  return TRUE;
1435 }
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define PD_NOSELECTION
Definition: commdlg.h:149
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
DWORD dmFields
Definition: wingdi.h:1621
#define SW_HIDE
Definition: winuser.h:762
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
short dmOrientation
Definition: wingdi.h:1624
#define stc2
Definition: dlgs.h:161
static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *pi)
Definition: printdlg.c:1038
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:311
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)
Definition: printers.c:1797
#define PD_NOPAGENUMS
Definition: commdlg.h:150
#define DM_COLLATE
Definition: wingdi.h:1264
int32_t INT
Definition: typedefs.h:57
#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 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:12
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD nCopies
Definition: commdlg.h:496
smooth NULL
Definition: ftsmooth.c:416
#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:1846
HICON hNoCollateIcon
Definition: printdlg.c:81
#define GetProcessHeap()
Definition: compat.h:403
#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:1616
#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:109
#define cmb2
Definition: dlgs.h:49
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:1960
#define DM_IN_BUFFER
Definition: windef.h:357
#define cmb3
Definition: dlgs.h:50
#define DM_COPIES
Definition: wingdi.h:1257
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:2075
LPWSTR pPortName
Definition: winspool.h:65
Definition: name.c:38
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1109
LPWSTR pPrinterName
Definition: winspool.h:63
#define edt3
Definition: dlgs.h:67
short dmCopies
Definition: wingdi.h:1629
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:888
#define ico3
Definition: dlgs.h:92
#define rad1
Definition: dlgs.h:130
#define HeapFree(x, y, z)
Definition: compat.h:402
#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 2178 of file printdlg.c.

2179 {
2180  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2181  DEVMODEA *pdm = GlobalLock(lppd->hDevMode);
2182 
2183  if(lppd->Flags & PD_RETURNDC) {
2184  lppd->hDC = CreateDCA((char*)pdn + pdn->wDriverOffset,
2185  (char*)pdn + pdn->wDeviceOffset,
2186  (char*)pdn + pdn->wOutputOffset,
2187  pdm );
2188  } else if(lppd->Flags & PD_RETURNIC) {
2189  lppd->hDC = CreateICA((char*)pdn + pdn->wDriverOffset,
2190  (char*)pdn + pdn->wDeviceOffset,
2191  (char*)pdn + pdn->wOutputOffset,
2192  pdm );
2193  }
2194  GlobalUnlock(lppd->hDevNames);
2195  GlobalUnlock(lppd->hDevMode);
2196  return lppd->hDC != NULL;
2197 }
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
smooth NULL
Definition: ftsmooth.c:416
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
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 2199 of file printdlg.c.

2200 {
2201  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2202  DEVMODEW *pdm = GlobalLock(lppd->hDevMode);
2203 
2204  if(lppd->Flags & PD_RETURNDC) {
2205  lppd->hDC = CreateDCW((WCHAR*)pdn + pdn->wDriverOffset,
2206  (WCHAR*)pdn + pdn->wDeviceOffset,
2207  (WCHAR*)pdn + pdn->wOutputOffset,
2208  pdm );
2209  } else if(lppd->Flags & PD_RETURNIC) {
2210  lppd->hDC = CreateICW((WCHAR*)pdn + pdn->wDriverOffset,
2211  (WCHAR*)pdn + pdn->wDeviceOffset,
2212  (WCHAR*)pdn + pdn->wOutputOffset,
2213  pdm );
2214  }
2215  GlobalUnlock(lppd->hDevNames);
2216  GlobalUnlock(lppd->hDevMode);
2217  return lppd->hDC != NULL;
2218 }
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
smooth NULL
Definition: ftsmooth.c:416
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
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 471 of file printdlg.c.

473 {
474  long size;
475  char* pDevNamesSpace;
476  char* pTempPtr;
477  LPDEVNAMES lpDevNames;
478  char buf[260];
480  const char *p;
481 
482  p = strrchr( DeviceDriverName, '\\' );
483  if (p) DeviceDriverName = p + 1;
484 
485  size = strlen(DeviceDriverName) + 1
486  + strlen(DeviceName) + 1
487  + strlen(OutputPort) + 1
488  + sizeof(DEVNAMES);
489 
490  if(*hmem)
491  *hmem = GlobalReAlloc(*hmem, size, GMEM_MOVEABLE);
492  else
493  *hmem = GlobalAlloc(GMEM_MOVEABLE, size);
494  if (*hmem == 0)
495  return FALSE;
496 
497  pDevNamesSpace = GlobalLock(*hmem);
498  lpDevNames = (LPDEVNAMES) pDevNamesSpace;
499 
500  pTempPtr = pDevNamesSpace + sizeof(DEVNAMES);
501  strcpy(pTempPtr, DeviceDriverName);
502  lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
503 
504  pTempPtr += strlen(DeviceDriverName) + 1;
505  strcpy(pTempPtr, DeviceName);
506  lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
507 
508  pTempPtr += strlen(DeviceName) + 1;
509  strcpy(pTempPtr, OutputPort);
510  lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
511 
513  lpDevNames->wDefault = (strcmp(buf, DeviceName) == 0) ? 1 : 0;
514  GlobalUnlock(*hmem);
515  return TRUE;
516 }
struct tagDEVNAMES * LPDEVNAMES
#define TRUE
Definition: types.h:120
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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
WCHAR DeviceName[]
Definition: adapter.cpp:21
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
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:971
#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 518 of file printdlg.c.

520 {
521  long size;
522  LPWSTR pDevNamesSpace;
523  LPWSTR pTempPtr;
524  LPDEVNAMES lpDevNames;
525  WCHAR bufW[260];
526  DWORD dwBufLen = ARRAY_SIZE(bufW);
527  const WCHAR *p;
528 
529  p = wcsrchr( DeviceDriverName, '\\' );
530  if (p) DeviceDriverName = p + 1;
531 
532  size = sizeof(WCHAR)*lstrlenW(DeviceDriverName) + 2
533  + sizeof(WCHAR)*lstrlenW(DeviceName) + 2
534  + sizeof(WCHAR)*lstrlenW(OutputPort) + 2
535  + sizeof(DEVNAMES);
536 
537  if(*hmem)
538  *hmem = GlobalReAlloc(*hmem, size, GMEM_MOVEABLE);
539  else
540  *hmem = GlobalAlloc(GMEM_MOVEABLE, size);
541  if (*hmem == 0)
542  return FALSE;
543 
544  pDevNamesSpace = GlobalLock(*hmem);
545  lpDevNames = (LPDEVNAMES) pDevNamesSpace;
546 
547  pTempPtr = (LPWSTR)((LPDEVNAMES)pDevNamesSpace + 1);
548  lstrcpyW(pTempPtr, DeviceDriverName);
549  lpDevNames->wDriverOffset = pTempPtr - pDevNamesSpace;
550 
551  pTempPtr += lstrlenW(DeviceDriverName) + 1;
552  lstrcpyW(pTempPtr, DeviceName);
553  lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace;
554 
555  pTempPtr += lstrlenW(DeviceName) + 1;
556  lstrcpyW(pTempPtr, OutputPort);
557  lpDevNames->wOutputOffset = pTempPtr - pDevNamesSpace;
558 
560  lpDevNames->wDefault = (lstrcmpW(bufW, DeviceName) == 0) ? 1 : 0;
561  GlobalUnlock(*hmem);
562  return TRUE;
563 }
struct tagDEVNAMES * LPDEVNAMES
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1017
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD wDefault
Definition: commdlg.h:300
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
WCHAR DeviceName[]
Definition: adapter.cpp:21
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
#define lstrlenW
Definition: compat.h:415
struct tagDEVNAMES DEVNAMES
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
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 lstrcpyW
Definition: compat.h:414
#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 2105 of file printdlg.c.

2106 {
2107  HRSRC hResInfo;
2108  HGLOBAL hDlgTmpl;
2109 
2110  if (lppd->Flags & PD_PRINTSETUP) {
2111  if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) {
2112  hDlgTmpl = lppd->hSetupTemplate;
2113  } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) {
2114  hResInfo = FindResourceA(lppd->hInstance,
2116  hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);
2117  } else {
2118  hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP",
2119  (LPSTR)RT_DIALOG);
2120  hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo);
2121  }
2122  } else {
2123  if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) {
2124  hDlgTmpl = lppd->hPrintTemplate;
2125  } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) {
2126  hResInfo = FindResourceA(lppd->hInstance,
2127  lppd->lpPrintTemplateName,
2128  (LPSTR)RT_DIALOG);
2129  hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);
2130  } else {
2131  hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32",
2132  (LPSTR)RT_DIALOG);
2133  hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo);
2134  }
2135  }
2136  return hDlgTmpl;
2137 }
#define PD_ENABLEPRINTTEMPLATEHANDLE
Definition: commdlg.h:163
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
#define PD_ENABLESETUPTEMPLATEHANDLE
Definition: commdlg.h:164
LPCSTR lpSetupTemplateName
Definition: commdlg.h:481
HGLOBAL hPrintTemplate
Definition: commdlg.h:482
char * LPSTR
Definition: xmlstorage.h:182
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define PD_ENABLEPRINTTEMPLATE
Definition: commdlg.h:161