ReactOS  0.4.15-dev-980-ge160524
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 2773 of file printdlg.c.

◆ hook_type

Enumerator
page_setup_hook 
page_paint_hook 

Definition at line 2962 of file printdlg.c.

2963 {
2966 } hook_type;
hook_type
Definition: printdlg.c:2962

Function Documentation

◆ check_printer_setup()

static LRESULT check_printer_setup ( HWND  hDlg)
static

Definition at line 1459 of file printdlg.c.

1460 {
1461  DWORD needed,num;
1462  WCHAR resourcestr[256],resultstr[256];
1463 
1464  EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num);
1465  if(needed == 0)
1466  {
1467  EnumPrintersW(PRINTER_ENUM_CONNECTIONS, NULL, 2, NULL, 0, &needed, &num);
1468  }
1469  if(needed > 0)
1470  return TRUE;
1471  else
1472  {
1474  LoadStringW(COMDLG32_hInstance, PD32_PRINT_TITLE,resourcestr, 255);
1475  MessageBoxW(hDlg, resultstr, resourcestr,MB_OK | MB_ICONWARNING);
1476  return FALSE;
1477  }
1478 }
#define PD32_NO_DEVICES
Definition: cdlg.h:61
#define PRINTER_ENUM_CONNECTIONS
Definition: winspool.h:897
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define TRUE
Definition: types.h:120
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_ICONWARNING
Definition: winuser.h:780
#define FALSE
Definition: types.h:117
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:896
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
WINBOOL WINAPI EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
#define 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:111
WORD dmSize
Definition: wingdi.h:1567
#define CP_ACP
Definition: compat.h:109
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:484
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:255
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 3463 of file printdlg.c.

3465 {
3466  LPRECT lprc = (LPRECT) lParam;
3467  HDC hdc = (HDC) wParam;
3468  HPEN hpen, holdpen;
3469  LOGFONTW lf;
3470  HFONT hfont, holdfont;
3471  INT oldbkmode;
3472  TRACE("uMsg: WM_USER+%d\n",uMsg-WM_USER);
3473  /* Call user paint hook if enable */
3475  if (pagesetup_get_hook(data, page_paint_hook)(hwndDlg, uMsg, wParam, lParam))
3476  return TRUE;
3477 
3478  switch (uMsg) {
3479  /* LPPAGESETUPDLG in lParam */
3480  case WM_PSD_PAGESETUPDLG:
3481  /* Inform about the sample page rectangle */
3482  case WM_PSD_FULLPAGERECT:
3483  /* Inform about the margin rectangle */
3484  case WM_PSD_MINMARGINRECT:
3485  return FALSE;
3486 
3487  /* Draw dashed rectangle showing margins */
3488  case WM_PSD_MARGINRECT:
3490  holdpen = SelectObject(hdc, hpen);
3492  DeleteObject(SelectObject(hdc, holdpen));
3493  return TRUE;
3494  /* Draw the fake document */
3495  case WM_PSD_GREEKTEXTRECT:
3496  /* select a nice scalable font, because we want the text really small */
3497  SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
3498  lf.lfHeight = 6; /* value chosen based on visual effect */
3499  hfont = CreateFontIndirectW(&lf);
3500  holdfont = SelectObject(hdc, hfont);
3501 
3502  /* if text not loaded, then do so now */
3503  if (wszFakeDocumentText[0] == '\0')
3508 
3509  oldbkmode = SetBkMode(hdc, TRANSPARENT);
3511  SetBkMode(hdc, oldbkmode);
3512 
3513  DeleteObject(SelectObject(hdc, holdfont));
3514  return TRUE;
3515 
3516  /* Envelope stamp */
3517  case WM_PSD_ENVSTAMPRECT:
3518  /* Return address */
3519  case WM_PSD_YAFULLPAGERECT:
3520  FIXME("envelope/stamp is not implemented\n");
3521  return FALSE;
3522  default:
3523  FIXME("Unknown message %x\n",uMsg);
3524  return FALSE;
3525  }
3526  return TRUE;
3527 }
#define WM_PSD_FULLPAGERECT
Definition: commdlg.h:189
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4440
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
#define IDS_FAKEDOCTEXT
Definition: cdlg.h: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:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static HPEN hpen
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define WM_PSD_GREEKTEXTRECT
Definition: commdlg.h:192
#define DT_NOPREFIX
Definition: winuser.h:537
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define COLOR_3DSHADOW
Definition: winuser.h:921
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1034
#define FALSE
Definition: types.h:117
#define DT_LEFT
Definition: winuser.h:534
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRANSPARENT
Definition: wingdi.h: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:2968
#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:2598

Referenced by PRINTDLG_PagePaintProc().

◆ element_from_margin_id()

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

Definition at line 3227 of file printdlg.c.

3228 {
3229  switch(id)
3230  {
3231  case edt4: return &rc->left;
3232  case edt5: return &rc->top;
3233  case edt6: return &rc->right;
3234  case edt7: return &rc->bottom;
3235  }
3236  return NULL;
3237 }
#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 2624 of file printdlg.c.

2625 {
2626  static WCHAR sep;
2627 
2628  if(!sep)
2629  {
2630  WCHAR buf[] = {'.', 0};
2632  sep = buf[0];
2633  }
2634  return sep;
2635 }
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 3783 of file printdlg.c.

3784 {
3785  WCHAR *name = NULL;
3786  DWORD len = 0;
3787 
3789  if(len)
3790  {
3791  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
3793  }
3794  return name;
3795 }
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1942
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
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 2781 of file printdlg.c.

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

Referenced by pagesetup_get_a_devname().

◆ get_driver_infoA()

static DRIVER_INFO_3A* get_driver_infoA ( HANDLE  hprn)
static

Definition at line 191 of file printdlg.c.

192 {
193  DRIVER_INFO_3A *di3 = NULL;
194  DWORD needed = 0;
195  BOOL res;
196 
197  res = GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
198  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
199  di3 = HeapAlloc(GetProcessHeap(), 0, needed);
200  res = GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)di3, needed, &needed);
201  }
202 
203  if (res)
204  return di3;
205 
206  TRACE("GetPrinterDriverA failed with %u\n", GetLastError());
207  HeapFree(GetProcessHeap(), 0, di3);
208  return NULL;
209 }
WINBOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
DWORD WINAPI GetLastError(VOID)
Definition: except.c: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:484
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:483
#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)
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:484
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:483
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExW().

◆ get_printer_infoA()

static PRINTER_INFO_2A* get_printer_infoA ( HANDLE  hprn)
static

Definition at line 238 of file printdlg.c.

239 {
240  PRINTER_INFO_2A *pi2 = NULL;
241  DWORD needed = 0;
242  BOOL res;
243 
244  res = GetPrinterA(hprn, 2, NULL, 0, &needed);
245  if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
246  pi2 = HeapAlloc(GetProcessHeap(), 0, needed);
247  res = GetPrinterA(hprn, 2, (LPBYTE)pi2, needed, &needed);
248  }
249 
250  if (res)
251  return pi2;
252 
253  TRACE("GetPrinterA failed with %u\n", GetLastError());
254  HeapFree(GetProcessHeap(), 0, pi2);
255  return NULL;
256 }
WINBOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2033
DWORD WINAPI GetLastError(VOID)
Definition: except.c: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:484
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:483
#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:2504
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
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:483
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by PrintDlgExW().

◆ is_default_metric()

static BOOL is_default_metric ( void  )
inlinestatic

Definition at line 2662 of file printdlg.c.

2663 {
2664  DWORD system;
2665  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
2666  (LPWSTR)&system, sizeof(system));
2667  return system == 0;
2668 }
#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 2603 of file printdlg.c.

2604 {
2606 }
#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:2598

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

3255 {
3256  switch (msg)
3257  {
3258  case EN_CHANGE:
3259  {
3260  WCHAR buf[10];
3261  LONG val = 0;
3263 
3264  if (GetDlgItemTextW(hDlg, id, buf, ARRAY_SIZE(buf)) != 0)
3265  {
3266  WCHAR *end;
3267  WCHAR decimal = get_decimal_sep();
3268 
3269  val = wcstol(buf, &end, 10);
3270  if(end != buf || *end == decimal)
3271  {
3272  int mult = is_metric(data) ? 100 : 1000;
3273  val *= mult;
3274  if(*end == decimal)
3275  {
3276  while(mult > 1)
3277  {
3278  end++;
3279  mult /= 10;
3280  if(iswdigit(*end))
3281  val += (*end - '0') * mult;
3282  else
3283  break;
3284  }
3285  }
3286  }
3287  }
3288  *value = val;
3289  return;
3290  }
3291 
3292  case EN_KILLFOCUS:
3293  update_margin_edits(hDlg, data, id);
3294  return;
3295  }
3296 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
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:3239
#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:2624
#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:2603
#define ARRAY_SIZE(a)
Definition: main.h:24
static LONG * element_from_margin_id(RECT *rc, WORD id)
Definition: printdlg.c:3227
#define msg(x)
Definition: auth_time.c:54
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2957
#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 3196 of file printdlg.c.

3197 {
3198  LONG width, height, x, y;
3199  RECT tmp;
3200  const int shadow = 4;
3201 
3203  {
3204  width = data->rtDrawRect.right - data->rtDrawRect.left;
3206  }
3207  else
3208  {
3209  height = data->rtDrawRect.bottom - data->rtDrawRect.top;
3211  }
3212  x = (data->rtDrawRect.right + data->rtDrawRect.left - width) / 2;
3213  y = (data->rtDrawRect.bottom + data->rtDrawRect.top - height) / 2;
3214  TRACE("draw rect %s x=%d, y=%d, w=%d, h=%d\n",
3215  wine_dbgstr_rect(&data->rtDrawRect), x, y, width, height);
3216 
3217  MoveWindow(GetDlgItem(data->hDlg, rct2), x + width, y + shadow, shadow, height, FALSE);
3218  MoveWindow(GetDlgItem(data->hDlg, rct3), x + shadow, y + height, width, shadow, FALSE);
3219  MoveWindow(GetDlgItem(data->hDlg, rct1), x, y, width, height, FALSE);
3220 
3221  tmp = data->rtDrawRect;
3222  tmp.right += shadow;
3223  tmp.bottom += shadow;
3224  InvalidateRect(data->hDlg, &tmp, TRUE);
3225 }
GLint GLint GLsizei width
Definition: gl.h:1546
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2952
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DMORIENT_LANDSCAPE
Definition: wingdi.h: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:2713
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 3064 of file printdlg.c.

3065 {
3066  HANDLE hprn;
3067  DWORD needed;
3068  PRINTER_INFO_2W *prn_info = NULL;
3069  DRIVER_INFO_3W *drv_info = NULL;
3070  DEVMODEW *dm = NULL;
3071  BOOL retval = FALSE;
3072 
3073  if(!OpenPrinterW(name, &hprn, NULL))
3074  {
3075  ERR("Can't open printer %s\n", debugstr_w(name));
3076  goto end;
3077  }
3078 
3079  GetPrinterW(hprn, 2, NULL, 0, &needed);
3080  prn_info = HeapAlloc(GetProcessHeap(), 0, needed);
3081  GetPrinterW(hprn, 2, (LPBYTE)prn_info, needed, &needed);
3082  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
3083  drv_info = HeapAlloc(GetProcessHeap(), 0, needed);
3084  if(!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)drv_info, needed, &needed))
3085  {
3086  ERR("GetPrinterDriverA failed for %s, fix your config!\n", debugstr_w(prn_info->pPrinterName));
3087  goto end;
3088  }
3089  ClosePrinter(hprn);
3090 
3091  needed = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
3092  if(needed == -1)
3093  {
3094  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
3095  goto end;
3096  }
3097 
3098  dm = HeapAlloc(GetProcessHeap(), 0, needed);
3100 
3102  pagesetup_set_devnames(data, drv_info->pDriverPath, prn_info->pPrinterName,
3103  prn_info->pPortName);
3104 
3105  retval = TRUE;
3106 end:
3107  HeapFree(GetProcessHeap(), 0, dm);
3108  HeapFree(GetProcessHeap(), 0, prn_info);
3109  HeapFree(GetProcessHeap(), 0, drv_info);
3110  return retval;
3111 }
#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:1153
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DM_OUT_BUFFER
Definition: windef.h:359
#define debugstr_w
Definition: kernel32.h:32
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
smooth NULL
Definition: ftsmooth.c:416
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2922
WINBOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2504
#define GetProcessHeap()
Definition: compat.h:484
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:110
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2624
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:2831
#define HeapFree(x, y, z)
Definition: compat.h:483

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

3146 {
3147  PRINTDLGW prnt;
3148  LPWSTR drvname, devname, portname;
3149  DEVMODEW *tmp_dm, *dm;
3150 
3151  memset(&prnt, 0, sizeof(prnt));
3152  prnt.lStructSize = sizeof(prnt);
3153  prnt.Flags = 0;
3154  prnt.hwndOwner = hDlg;
3155 
3156  drvname = pagesetup_get_drvname(data);
3157  devname = pagesetup_get_devname(data);
3158  portname = pagesetup_get_portname(data);
3159  prnt.hDevNames = 0;
3160  PRINTDLG_CreateDevNamesW(&prnt.hDevNames, drvname, devname, portname);
3161  pagesetup_release_a_devname(data, portname);
3164 
3165  tmp_dm = pagesetup_get_devmode(data);
3166  prnt.hDevMode = GlobalAlloc(GMEM_MOVEABLE, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3167  dm = GlobalLock(prnt.hDevMode);
3168  memcpy(dm, tmp_dm, tmp_dm->dmSize + tmp_dm->dmDriverExtra);
3169  GlobalUnlock(prnt.hDevMode);
3171 
3172  if (PrintDlgW(&prnt))
3173  {
3174  DEVMODEW *dm = GlobalLock(prnt.hDevMode);
3175  DEVNAMES *dn = GlobalLock(prnt.hDevNames);
3176 
3178  (WCHAR*)dn + dn->wDeviceOffset, (WCHAR *)dn + dn->wOutputOffset);
3180  GlobalUnlock(prnt.hDevNames);
3181  GlobalUnlock(prnt.hDevMode);
3182  pagesetup_init_combos(hDlg, data);
3183  }
3184 
3185  GlobalFree(prnt.hDevMode);
3186  GlobalFree(prnt.hDevNames);
3187 
3188 }
static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName, LPCWSTR DeviceName, LPCWSTR OutputPort)
Definition: printdlg.c:530
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HWND hwndOwner
Definition: commdlg.h:487
HGLOBAL hDevNames
Definition: commdlg.h:489
WORD dmDriverExtra
Definition: wingdi.h:1620
DWORD Flags
Definition: commdlg.h:491
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2816
WORD wDeviceOffset
Definition: commdlg.h:298
BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
Definition: printdlg.c:2409
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:2922
DWORD lStructSize
Definition: commdlg.h:486
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2898
__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:3119
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:2917
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:2821
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:2831
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:2826
#define memset(x, y, z)
Definition: compat.h:39
static WCHAR * pagesetup_get_drvname(const pagesetup_data *data)
Definition: printdlg.c:2811
#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 3848 of file printdlg.c.

3849 {
3850  BOOL ret;
3851  void *tmpl;
3852 
3854  {
3856  return FALSE;
3857  }
3858 
3860 
3861  if(data->u.dlgw->lStructSize != sizeof(PAGESETUPDLGW))
3862  {
3864  return FALSE;
3865  }
3866 
3869  {
3871  return FALSE;
3872  }
3873 
3875  data->u.dlgw->Flags |= is_default_metric() ?
3877 
3878  if (!data->u.dlgw->hDevMode || !data->u.dlgw->hDevNames)
3879  {
3880  WCHAR *def = get_default_printer();
3881  if(!def)
3882  {
3884  {
3885  WCHAR errstr[256];
3887  MessageBoxW(data->u.dlgw->hwndOwner, errstr, 0, MB_OK | MB_ICONERROR);
3888  }
3890  return FALSE;
3891  }
3893  HeapFree(GetProcessHeap(), 0, def);
3894  }
3895 
3897  {
3899  return TRUE;
3900  }
3901 
3902  tmpl = pagesetup_get_template(data);
3903 
3904  ret = DialogBoxIndirectParamW(data->u.dlgw->hInstance, tmpl,
3905  data->u.dlgw->hwndOwner,
3907  return ret;
3908 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define PSD_INHUNDREDTHSOFMILLIMETERS
Definition: commdlg.h:175
#define TRUE
Definition: types.h:120
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static WCHAR * get_default_printer(void)
Definition: printdlg.c:3783
#define PSD_NOWARNING
Definition: commdlg.h:178
#define CDERR_STRUCTSIZE
Definition: cderr.h:6
#define PDERR_NODEFAULTPRN
Definition: cderr.h:26
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2980
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:484
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:2662
#define CDERR_INITIALIZATION
Definition: cderr.h:7
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2968
static void pagesetup_dump_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:3797
#define PSD_INTHOUSANDTHSOFINCHES
Definition: commdlg.h:174
static void * pagesetup_get_template(pagesetup_data *data)
Definition: printdlg.c:3820
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:2992
#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:3064
static INT_PTR CALLBACK pagesetup_dlg_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: printdlg.c:3685
const char * errstr(int errcode)
#define HeapFree(x, y, z)
Definition: compat.h:483
#define PSD_ENABLEPAGEPAINTHOOK
Definition: commdlg.h:186
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2598

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

3686 {
3688  INT_PTR res = FALSE;
3689  HWND hDrawWnd;
3690 
3691  if (uMsg == WM_INITDIALOG) { /*Init dialog*/
3692  data = (pagesetup_data *)lParam;
3693  data->hDlg = hDlg;
3694 
3695  hDrawWnd = GetDlgItem(hDlg, rct1);
3696  TRACE("set property to %p\n", data);
3698  SetPropW(hDrawWnd, pagesetupdlg_prop, data);
3699  GetWindowRect(hDrawWnd, &data->rtDrawRect); /* Calculating rect in client coordinates where paper draws */
3700  MapWindowPoints( 0, hDlg, (LPPOINT)&data->rtDrawRect, 2 );
3702  hDrawWnd,
3703  GWLP_WNDPROC,
3705 
3706  /* FIXME: Paint hook. Must it be at begin of initialization or at end? */
3707  res = TRUE;
3709  {
3710  if (!pagesetup_get_hook(data, page_setup_hook)(hDlg, uMsg, wParam,
3712  FIXME("Setup page hook failed?\n");
3713  }
3714 
3715  /* if printer button disabled */
3717  EnableWindow(GetDlgItem(hDlg, psh3), FALSE);
3718  /* if margin edit boxes disabled */
3720  {
3721  EnableWindow(GetDlgItem(hDlg, edt4), FALSE);
3722  EnableWindow(GetDlgItem(hDlg, edt5), FALSE);
3723  EnableWindow(GetDlgItem(hDlg, edt6), FALSE);
3724  EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
3725  }
3726 
3727  /* Set orientation radiobuttons properly */
3729 
3730  /* if orientation disabled */
3732  {
3735  }
3736 
3737  /* We fill them out enabled or not */
3739  {
3740  /* default is 1 inch */
3743  }
3744  update_margin_edits(hDlg, data, 0);
3745  subclass_margin_edits(hDlg);
3747 
3748  /* if paper disabled */
3750  {
3753  }
3754 
3755  /* filling combos: printer, paper, source. selecting current printer (from DEVMODEA) */
3756  pagesetup_init_combos(hDlg, data);
3758  pagesetup_set_defaultsource(data, DMBIN_FORMSOURCE); /* FIXME: This is the auto select bin. Is this correct? */
3759 
3760  /* Drawing paper prev */
3762  return TRUE;
3763  } else {
3764  data = GetPropW(hDlg, pagesetupdlg_prop);
3765  if (!data)
3766  {
3767  WARN("__WINE_PAGESETUPDLGDATA prop not set?\n");
3768  return FALSE;
3769  }
3771  {
3773  if (res) return res;
3774  }
3775  }
3776  switch (uMsg) {
3777  case WM_COMMAND:
3778  return pagesetup_wm_command(hDlg, wParam, lParam, data);
3779  }
3780  return FALSE;
3781 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define PSD_DISABLEPRINTER
Definition: commdlg.h:177
#define TRUE
Definition: types.h:120
#define PSD_MARGINS
Definition: commdlg.h:173
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3239
#define WARN(fmt,...)
Definition: debug.h:112
#define edt5
Definition: dlgs.h:69
static BOOL pagesetup_wm_command(HWND hDlg, WPARAM wParam, LPARAM lParam, pagesetup_data *data)
Definition: printdlg.c:3377
static void pagesetup_update_orientation_buttons(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3307
int32_t INT_PTR
Definition: typedefs.h:64
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define rad2
Definition: dlgs.h:131
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static LPARAM pagesetup_get_dlg_struct(const pagesetup_data *data)
Definition: printdlg.c:2980
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:111
static WNDPROC lpfnStaticWndProc
Definition: printdlg.c:140
#define edt4
Definition: dlgs.h:68
#define PSD_DISABLEORIENTATION
Definition: commdlg.h:179
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3196
static LPPAGESETUPHOOK pagesetup_get_hook(const pagesetup_data *data, hook_type which)
Definition: printdlg.c:2968
static void pagesetup_init_combos(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3119
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:2992
#define WM_COMMAND
Definition: winuser.h:1722
static void set_margin_groupbox_title(HWND hDlg, const pagesetup_data *data)
Definition: printdlg.c:3298
#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:2759
#define cmb3
Definition: dlgs.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static void subclass_margin_edits(HWND hDlg)
Definition: printdlg.c:3666
#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:3562
#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:2957
#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:2616
#define rad1
Definition: dlgs.h:130
#define edt6
Definition: dlgs.h:70
static DWORD pagesetup_get_flags(const pagesetup_data *data)
Definition: printdlg.c:2598

Referenced by pagesetup_common().

◆ pagesetup_dump_dlg_struct()

static void pagesetup_dump_dlg_struct ( const pagesetup_data data)
static

Definition at line 3797 of file printdlg.c.

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

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

2794 {
2795  DEVNAMES *dn;
2796  WCHAR *name;
2797 
2798  dn = GlobalLock(data->u.dlgw->hDevNames);
2799  if(data->unicode)
2800  name = strdupW((WCHAR *)dn + get_devname_offset(dn, which));
2801  else
2802  {
2803  int len = MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, NULL, 0);
2804  name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2805  MultiByteToWideChar(CP_ACP, 0, (char*)dn + get_devname_offset(dn, which), -1, name, len);
2806  }
2807  GlobalUnlock(data->u.dlgw->hDevNames);
2808  return name;
2809 }
#define CP_ACP
Definition: compat.h:109
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:2781
#define GetProcessHeap()
Definition: compat.h:484
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:110
Definition: name.c:38
GLuint const GLchar * name
Definition: glext.h:6031

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

◆ pagesetup_get_devmode()

static DEVMODEW* pagesetup_get_devmode ( const pagesetup_data data)
static

Definition at line 2898 of file printdlg.c.

2899 {
2900  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2901  DEVMODEW *ret;
2902 
2903  if(data->unicode)
2904  {
2905  /* We make a copy even in the unicode case because the ptr
2906  may get passed back to us in pagesetup_set_devmode. */
2907  ret = HeapAlloc(GetProcessHeap(), 0, dm->dmSize + dm->dmDriverExtra);
2908  memcpy(ret, dm, dm->dmSize + dm->dmDriverExtra);
2909  }
2910  else
2912 
2913  GlobalUnlock(data->u.dlgw->hDevMode);
2914  return ret;
2915 }
WORD dmDriverExtra
Definition: wingdi.h:1620
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:969
#define GetProcessHeap()
Definition: compat.h:484
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 2816 of file printdlg.c.

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

2981 {
2982  return (LPARAM)data->u.dlgw;
2983 }
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 2811 of file printdlg.c.

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

2599 {
2600  return data->u.dlgw->Flags;
2601 }
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 2968 of file printdlg.c.

2969 {
2970  switch(which)
2971  {
2972  case page_setup_hook: return data->u.dlgw->lpfnPageSetupHook;
2973  case page_paint_hook: return data->u.dlgw->lpfnPagePaintHook;
2974  }
2975  return NULL;
2976 }
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 2957 of file printdlg.c.

2958 {
2959  return &data->u.dlgw->rtMargin;
2960 }
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 2713 of file printdlg.c.

2714 {
2715  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2716  WORD orient;
2717 
2718  if(data->unicode)
2719  orient = dm->u1.s1.dmOrientation;
2720  else
2721  {
2722  DEVMODEA *dmA = (DEVMODEA *)dm;
2723  orient = dmA->u1.s1.dmOrientation;
2724  }
2725  GlobalUnlock(data->u.dlgw->hDevMode);
2726  return orient;
2727 }
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 2743 of file printdlg.c.

2744 {
2745  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2746  WORD paper;
2747 
2748  if(data->unicode)
2749  paper = dm->u1.s1.dmPaperSize;
2750  else
2751  {
2752  DEVMODEA *dmA = (DEVMODEA *)dm;
2753  paper = dmA->u1.s1.dmPaperSize;
2754  }
2755  GlobalUnlock(data->u.dlgw->hDevMode);
2756  return paper;
2757 }
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 2952 of file printdlg.c.

2953 {
2954  return &data->u.dlgw->ptPaperSize;
2955 }
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 2821 of file printdlg.c.

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

3821 {
3822  HRSRC res;
3823  HGLOBAL tmpl_handle;
3824 
3826  {
3827  tmpl_handle = data->u.dlgw->hPageSetupTemplate;
3828  }
3830  {
3831  if(data->unicode)
3832  res = FindResourceW(data->u.dlgw->hInstance,
3833  data->u.dlgw->lpPageSetupTemplateName, (LPWSTR)RT_DIALOG);
3834  else
3835  res = FindResourceA(data->u.dlga->hInstance,
3836  data->u.dlga->lpPageSetupTemplateName, (LPSTR)RT_DIALOG);
3837  tmpl_handle = LoadResource(data->u.dlgw->hInstance, res);
3838  }
3839  else
3840  {
3842  (LPWSTR)RT_DIALOG);
3843  tmpl_handle = LoadResource(COMDLG32_hInstance, res);
3844  }
3845  return LockResource(tmpl_handle);
3846 }
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:2598

Referenced by pagesetup_common().

◆ pagesetup_init_combos()

static void pagesetup_init_combos ( HWND  hDlg,
pagesetup_data data 
)
static

Definition at line 3119 of file printdlg.c.

3120 {
3121  DEVMODEW *dm;
3122  LPWSTR devname, portname;
3123 
3125  devname = pagesetup_get_devname(data);
3126  portname = pagesetup_get_portname(data);
3127 
3128  PRINTDLG_SetUpPrinterListComboW(hDlg, cmb1, devname);
3129  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb2, devname, portname, dm);
3130  PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb3, devname, portname, dm);
3131 
3132  pagesetup_release_a_devname(data, portname);
3135 }
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2816
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2898
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:2917
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2821
static INT PRINTDLG_SetUpPrinterListComboW(HWND hDlg, UINT id, LPCWSTR name)
Definition: printdlg.c:430
#define cmb2
Definition: dlgs.h:49
#define cmb3
Definition: dlgs.h:50
static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, int nIDComboBox, const WCHAR *PrinterName, const WCHAR *PortName, LPDEVMODEW dm)
Definition: printdlg.c:907
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void pagesetup_release_a_devname(const pagesetup_data *data, WCHAR *name)
Definition: printdlg.c:2826
#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 3655 of file printdlg.c.

3656 {
3657  if (msg == WM_CHAR)
3658  {
3659  WCHAR decimal = get_decimal_sep();
3660  WCHAR wc = (WCHAR)wparam;
3661  if(!iswdigit(wc) && wc != decimal && wc != VK_BACK) return 0;
3662  }
3664 }
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:2624
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 3320 of file printdlg.c.

3321 {
3322  HANDLE hprn;
3323  LPWSTR devname;
3324  DEVMODEW *dm;
3325  LRESULT count;
3326  int i;
3327 
3328  devname = pagesetup_get_devname(data);
3329 
3330  if (!OpenPrinterW(devname, &hprn, NULL))
3331  {
3332  FIXME("Call to OpenPrinter did not succeed!\n");
3334  return;
3335  }
3336 
3338  DocumentPropertiesW(hDlg, hprn, devname, dm, dm, DM_IN_BUFFER | DM_OUT_BUFFER | DM_IN_PROMPT);
3342  ClosePrinter(hprn);
3343 
3344  /* Changing paper */
3347 
3348  /* Changing paper preview */
3350 
3351  /* Selecting paper in combo */
3352  count = SendDlgItemMessageW(hDlg, cmb2, CB_GETCOUNT, 0, 0);
3353  if(count != CB_ERR)
3354  {
3355  WORD paperword = pagesetup_get_papersize(data);
3356  for(i = 0; i < count; i++)
3357  {
3358  if(SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0) == paperword) {
3359  SendDlgItemMessageW(hDlg, cmb2, CB_SETCURSEL, i, 0);
3360  break;
3361  }
3362  }
3363  }
3364 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2743
#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:3307
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:1153
static WCHAR * pagesetup_get_devname(const pagesetup_data *data)
Definition: printdlg.c:2816
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:111
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
smooth NULL
Definition: ftsmooth.c:416
static void pagesetup_set_devmode(pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2922
#define CB_ERR
Definition: winuser.h:2410
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2898
static void pagesetup_change_preview(const pagesetup_data *data)
Definition: printdlg.c:3196
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:2992
static void pagesetup_release_devmode(const pagesetup_data *data, DEVMODEW *dm)
Definition: printdlg.c:2917
#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:2624
#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:2826

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

2827 {
2828  HeapFree(GetProcessHeap(), 0, name);
2829 }
#define GetProcessHeap()
Definition: compat.h:484
Definition: name.c:38
#define HeapFree(x, y, z)
Definition: compat.h:483

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

2918 {
2919  HeapFree(GetProcessHeap(), 0, dm);
2920 }
#define GetProcessHeap()
Definition: compat.h:484
#define HeapFree(x, y, z)
Definition: compat.h:483

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

2760 {
2761  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2762 
2763  if(data->unicode)
2764  dm->u1.s1.dmDefaultSource = source;
2765  else
2766  {
2767  DEVMODEA *dmA = (DEVMODEA *)dm;
2768  dmA->u1.s1.dmDefaultSource = source;
2769  }
2770  GlobalUnlock(data->u.dlgw->hDevMode);
2771 }
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 2922 of file printdlg.c.

2923 {
2924  DEVMODEA *dmA = NULL;
2925  void *src, *dst;
2926  DWORD size;
2927 
2928  if(data->unicode)
2929  {
2930  size = dm->dmSize + dm->dmDriverExtra;
2931  src = dm;
2932  }
2933  else
2934  {
2935  dmA = convert_to_devmodeA(dm);
2936  size = dmA->dmSize + dmA->dmDriverExtra;
2937  src = dmA;
2938  }
2939 
2940  if(data->u.dlgw->hDevMode)
2941  data->u.dlgw->hDevMode = GlobalReAlloc(data->u.dlgw->hDevMode, size,
2942  GMEM_MOVEABLE);
2943  else
2944  data->u.dlgw->hDevMode = GlobalAlloc(GMEM_MOVEABLE, size);
2945 
2946  dst = GlobalLock(data->u.dlgw->hDevMode);
2947  memcpy(dst, src, size);
2948  GlobalUnlock(data->u.dlgw->hDevMode);
2949  HeapFree(GetProcessHeap(), 0, dmA);
2950 }
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:484
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:483
#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 2831 of file printdlg.c.

2832 {
2833  DEVNAMES *dn;
2834  WCHAR def[256];
2835  DWORD len = sizeof(DEVNAMES), drv_len, dev_len, port_len;
2836 
2837  if(data->unicode)
2838  {
2839  drv_len = (lstrlenW(drv) + 1) * sizeof(WCHAR);
2840  dev_len = (lstrlenW(devname) + 1) * sizeof(WCHAR);
2841  port_len = (lstrlenW(port) + 1) * sizeof(WCHAR);
2842  }
2843  else
2844  {
2845  drv_len = WideCharToMultiByte(CP_ACP, 0, drv, -1, NULL, 0, NULL, NULL);
2846  dev_len = WideCharToMultiByte(CP_ACP, 0, devname, -1, NULL, 0, NULL, NULL);
2847  port_len = WideCharToMultiByte(CP_ACP, 0, port, -1, NULL, 0, NULL, NULL);
2848  }
2849  len += drv_len + dev_len + port_len;
2850 
2851  if(data->u.dlgw->hDevNames)
2852  data->u.dlgw->hDevNames = GlobalReAlloc(data->u.dlgw->hDevNames, len, GMEM_MOVEABLE);
2853  else
2854  data->u.dlgw->hDevNames = GlobalAlloc(GMEM_MOVEABLE, len);
2855 
2856  dn = GlobalLock(data->u.dlgw->hDevNames);
2857 
2858  if(data->unicode)
2859  {
2860  WCHAR *ptr = (WCHAR *)(dn + 1);
2861  len = sizeof(DEVNAMES) / sizeof(WCHAR);
2862  dn->wDriverOffset = len;
2863  lstrcpyW(ptr, drv);
2864  ptr += drv_len / sizeof(WCHAR);
2865  len += drv_len / sizeof(WCHAR);
2866  dn->wDeviceOffset = len;
2867  lstrcpyW(ptr, devname);
2868  ptr += dev_len / sizeof(WCHAR);
2869  len += dev_len / sizeof(WCHAR);
2870  dn->wOutputOffset = len;
2871  lstrcpyW(ptr, port);
2872  }
2873  else
2874  {
2875  char *ptr = (char *)(dn + 1);
2876  len = sizeof(DEVNAMES);
2877  dn->wDriverOffset = len;
2878  WideCharToMultiByte(CP_ACP, 0, drv, -1, ptr, drv_len, NULL, NULL);
2879  ptr += drv_len;
2880  len += drv_len;
2881  dn->wDeviceOffset = len;
2882  WideCharToMultiByte(CP_ACP, 0, devname, -1, ptr, dev_len, NULL, NULL);
2883  ptr += dev_len;
2884  len += dev_len;
2885  dn->wOutputOffset = len;
2886  WideCharToMultiByte(CP_ACP, 0, port, -1, ptr, port_len, NULL, NULL);
2887  }
2888 
2889  dn->wDefault = 0;
2890  len = ARRAY_SIZE(def);
2891  GetDefaultPrinterW(def, &len);
2892  if(!lstrcmpW(def, devname))
2893  dn->wDefault = 1;
2894 
2895  GlobalUnlock(data->u.dlgw->hDevNames);
2896 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define WideCharToMultiByte
Definition: compat.h:111
WINBOOL WINAPI GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
Definition: printers.c:1942
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
WORD wDefault
Definition: commdlg.h:300
#define CP_ACP
Definition: compat.h:109
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define lstrlenW
Definition: compat.h:498
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:497
#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 2697 of file printdlg.c.

2698 {
2699  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2700 
2701  assert(orient == DMORIENT_PORTRAIT || orient == DMORIENT_LANDSCAPE);
2702 
2703  if(data->unicode)
2704  dm->u1.s1.dmOrientation = orient;
2705  else
2706  {
2707  DEVMODEA *dmA = (DEVMODEA *)dm;
2708  dmA->u1.s1.dmOrientation = orient;
2709  }
2710  GlobalUnlock(data->u.dlgw->hDevMode);
2711 }
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 2729 of file printdlg.c.

2730 {
2731  DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
2732 
2733  if(data->unicode)
2734  dm->u1.s1.dmPaperSize = paper;
2735  else
2736  {
2737  DEVMODEA *dmA = (DEVMODEA *)dm;
2738  dmA->u1.s1.dmPaperSize = paper;
2739  }
2740  GlobalUnlock(data->u.dlgw->hDevMode);
2741 }
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 3307 of file printdlg.c.

3308 {
3310  CheckRadioButton(hDlg, rad1, rad2, rad2);
3311  else
3312  CheckRadioButton(hDlg, rad1, rad2, rad1);
3313 }
#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:2713
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 2992 of file printdlg.c.

2993 {
2994  DEVMODEW *dm;
2995  LPWSTR devname, portname;
2996  int i, num;
2997  WORD *words = NULL, paperword;
2998  POINT *points = NULL;
2999  BOOL retval = FALSE;
3000 
3002  devname = pagesetup_get_devname(data);
3003  portname = pagesetup_get_portname(data);
3004 
3005  num = DeviceCapabilitiesW(devname, portname, DC_PAPERS, NULL, dm);
3006  if (num <= 0)
3007  {
3008  FIXME("No papernames found for %s/%s\n", debugstr_w(devname), debugstr_w(portname));
3009  goto end;
3010  }
3011 
3012  words = HeapAlloc(GetProcessHeap(), 0, num * sizeof(WORD));
3013  points = HeapAlloc(GetProcessHeap(), 0, num * sizeof(POINT));
3014 
3015  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERS, (LPWSTR)words, dm))
3016  {
3017  FIXME("Number of returned words is not %d\n", num);
3018  goto end;
3019  }
3020 
3021  if (num != DeviceCapabilitiesW(devname, portname, DC_PAPERSIZE, (LPWSTR)points, dm))
3022  {
3023  FIXME("Number of returned sizes is not %d\n", num);
3024  goto end;
3025  }
3026 
3027  paperword = pagesetup_get_papersize(data);
3028 
3029  for (i = 0; i < num; i++)
3030  if (words[i] == paperword)
3031  break;
3032 
3033  if (i == num)
3034  {
3035  FIXME("Papersize %d not found in list?\n", paperword);
3036  goto end;
3037  }
3038 
3039  /* this is _10ths_ of a millimeter */
3042 
3045 
3046  retval = TRUE;
3047 
3048 end:
3049  HeapFree(GetProcessHeap(), 0, words);
3051  pagesetup_release_a_devname(data, portname);
3054 
3055  return retval;
3056 }
static WORD pagesetup_get_papersize(const pagesetup_data *data)
Definition: printdlg.c:2743
#define DC_PAPERS
Definition: windef.h:363
static POINT * pagesetup_get_papersize_pt(const pagesetup_data *data)
Definition: printdlg.c:2952
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
static LONG tenths_mm_to_size(const pagesetup_data *data, LONG size)
Definition: printdlg.c:2608
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:2816
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 FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
static DEVMODEW * pagesetup_get_devmode(const pagesetup_data *data)
Definition: printdlg.c:2898
#define GetProcessHeap()
Definition: compat.h:484
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:2917
static void swap_point(POINT *pt)
Definition: printdlg.c:2985
static WCHAR * pagesetup_get_portname(const pagesetup_data *data)
Definition: printdlg.c:2821
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2713
#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:2826
#define HeapFree(x, y, z)
Definition: compat.h:483

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

3378 {
3379  WORD msg = HIWORD(wParam);
3380  WORD id = LOWORD(wParam);
3381 
3382  TRACE("loword (lparam) %d, wparam 0x%lx, lparam %08lx\n",
3384  switch (id) {
3385  case IDOK:
3386  EndDialog(hDlg, TRUE);
3387  return TRUE ;
3388 
3389  case IDCANCEL:
3390  EndDialog(hDlg, FALSE);
3391  return FALSE ;
3392 
3393  case psh3: /* Printer... */
3395  return TRUE;
3396 
3397  case rad1: /* Portrait */
3398  case rad2: /* Landscape */
3401  {
3405  update_margin_edits(hDlg, data, 0);
3407  }
3408  break;
3409  case cmb1: /* Printer combo */
3410  if(msg == CBN_SELCHANGE)
3411  {
3412  WCHAR *name;
3413  INT index = SendDlgItemMessageW(hDlg, id, CB_GETCURSEL, 0, 0);
3415  name = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(length+1));
3418  pagesetup_init_combos(hDlg, data);
3420  }
3421  break;
3422  case cmb2: /* Paper combo */
3423  if(msg == CBN_SELCHANGE)
3424  {
3425  DWORD paperword = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA,
3426  SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0), 0);
3427  if (paperword != CB_ERR)
3428  {
3429  pagesetup_set_papersize(data, paperword);
3432  } else
3433  FIXME("could not get dialog text for papersize cmbbox?\n");
3434  }
3435  break;
3436  case cmb3: /* Paper Source */
3437  if(msg == CBN_SELCHANGE)
3438  {
3440  SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0), 0);
3442  }
3443  break;
3444  case psh2: /* Printer Properties button */
3446  break;
3447  case edt4:
3448  case edt5:
3449  case edt6:
3450  case edt7:
3451  margin_edit_notification(hDlg, data, msg, id);
3452  break;
3453  }
3455  return FALSE;
3456 }
static void pagesetup_printer_properties(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3320
#define CB_GETLBTEXTLEN
Definition: winuser.h:1935
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define CB_GETLBTEXT
Definition: winuser.h:1934
static void update_margin_edits(HWND hDlg, const pagesetup_data *data, WORD id)
Definition: printdlg.c:3239
#define CB_GETITEMDATA
Definition: winuser.h:1932
static void pagesetup_change_printer_dialog(HWND hDlg, pagesetup_data *data)
Definition: printdlg.c:3145
#define edt5
Definition: dlgs.h:69
static void pagesetup_set_orientation(pagesetup_data *data, WORD orient)
Definition: printdlg.c:2697
#define psh2
Definition: dlgs.h:113
int32_t INT
Definition: typedefs.h:58
#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 FALSE
Definition: types.h:117
#define psh3
Definition: dlgs.h:114
#define FIXME(fmt,...)
Definition: debug.h:111
#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:2676
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
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:3196
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:3119
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:2992
static void margin_edit_notification(HWND hDlg, const pagesetup_data *data, WORD msg, WORD id)
Definition: printdlg.c:3254
static WORD pagesetup_get_orientation(const pagesetup_data *data)
Definition: printdlg.c:2713
#define cmb2
Definition: dlgs.h:49
static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
Definition: printdlg.c:2759
static void pagesetup_set_papersize(pagesetup_data *data, WORD paper)
Definition: printdlg.c:2729
#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:3064
#define DMORIENT_PORTRAIT
Definition: wingdi.h:1109
#define HIWORD(l)
Definition: typedefs.h:247
static RECT * pagesetup_get_margin_rect(const pagesetup_data *data)
Definition: printdlg.c:2957
#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:483
#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 3929 of file printdlg.c.

3930 {
3932 
3933  data.unicode = FALSE;
3934  data.u.dlga = setupdlg;
3935 
3936  return pagesetup_common(&data);
3937 }
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3848
#define FALSE
Definition: types.h:117
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by test_PageSetupDlgA().

◆ PageSetupDlgW()

BOOL WINAPI PageSetupDlgW ( LPPAGESETUPDLGW  setupdlg)

Definition at line 3944 of file printdlg.c.

3945 {
3947 
3948  data.unicode = TRUE;
3949  data.u.dlgw = setupdlg;
3950 
3951  return pagesetup_common(&data);
3952 }
#define TRUE
Definition: types.h:120
static BOOL pagesetup_common(pagesetup_data *data)
Definition: printdlg.c:3848
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 3986 of file printdlg.c.

3987 {
3988  pdlgex->hDevMode = pdlg->hDevMode;
3989  pdlgex->hDevNames = pdlg->hDevNames;
3990  pdlgex->hDC = pdlg->hDC;
3991  if (!(pdlgex->Flags & PD_NOPAGENUMS) && pdlgex->nPageRanges && pdlgex->lpPageRanges)
3992  {
3993  pdlgex->lpPageRanges[0].nFromPage = pdlg->nFromPage;
3994  pdlgex->lpPageRanges[0].nToPage = pdlg->nToPage;
3995  }
3996  pdlgex->nMinPage = pdlg->nMinPage;
3997  pdlgex->nMaxPage = pdlg->nMaxPage;
3998  pdlgex->nCopies = pdlg->nCopies;
3999 }
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 4007 of file printdlg.c.

4008 {
4009  if (msg == WM_INITDIALOG)
4010  {
4011  PRINTDLGW *pd = (PRINTDLGW *)lp;
4012  struct callback_data *cb = (struct callback_data *)pd->lCustData;
4013 
4014  if (cb->callback)
4015  {
4016  cb->callback->lpVtbl->SelectionChange(cb->callback);
4017  cb->callback->lpVtbl->InitDone(cb->callback);
4018  }
4019  }
4020  else
4021  {
4022 /* FIXME: store interface pointer somewhere in window properties and call it
4023  HRESULT hres;
4024  cb->callback->lpVtbl->HandleMessage(cb->callback, hwnd, msg, wp, lp, &hres);
4025 */
4026  }
4027 
4028  return 0;
4029 }
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 3954 of file printdlg.c.

3955 {
3956  pdlg->lStructSize = sizeof(*pdlg);
3957  pdlg->hwndOwner = pdlgex->hwndOwner;
3958  pdlg->hDevMode = pdlgex->hDevMode;
3959  pdlg->hDevNames = pdlgex->hDevNames;
3960  pdlg->hDC = pdlgex->hDC;
3961  pdlg->Flags = pdlgex->Flags;
3962  if ((pdlgex->Flags & PD_NOPAGENUMS) || !pdlgex->nPageRanges || !pdlgex->lpPageRanges)
3963  {
3964  pdlg->nFromPage = 0;
3965  pdlg->nToPage = 65534;
3966  }
3967  else
3968  {
3969  pdlg->nFromPage = pdlgex->lpPageRanges[0].nFromPage;
3970  pdlg->nToPage = pdlgex->lpPageRanges[0].nToPage;
3971  }
3972  pdlg->nMinPage = pdlgex->nMinPage;
3973  pdlg->nMaxPage = pdlgex->nMaxPage;
3974  pdlg->nCopies = pdlgex->nCopies;
3975  pdlg->hInstance = pdlgex->hInstance;
3976  pdlg->lCustData = 0;
3977  pdlg->lpfnPrintHook = NULL;
3978  pdlg->lpfnSetupHook = NULL;
3979  pdlg->lpPrintTemplateName = pdlgex->lpPrintTemplateName;
3980  pdlg->lpSetupTemplateName = NULL;
3981  pdlg->hPrintTemplate = NULL;
3982  pdlg->hSetupTemplate = NULL;
3983 }
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 1098 of file printdlg.c.

1099 {
1100  LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
1101  LPDEVMODEA lpdm = NULL;
1102  LONG dmSize;
1103  DWORD needed;
1104  HANDLE hprn;
1105 
1106  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1107  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1108  if(!OpenPrinterA(name, &hprn, NULL)) {
1109  ERR("Can't open printer %s\n", name);
1110  return FALSE;
1111  }
1112  GetPrinterA(hprn, 2, NULL, 0, &needed);
1113  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1114  GetPrinterA(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1115  &needed);
1116  GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);
1117  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1118  if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1119  needed, &needed)) {
1120  ERR("GetPrinterDriverA failed for %s, fix your config!\n",PrintStructures->lpPrinterInfo->pPrinterName);
1121  return FALSE;
1122  }
1123  ClosePrinter(hprn);
1124 
1125  PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo);
1126 
1127  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1128  PrintStructures->lpDevMode = NULL;
1129 
1130  dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0);
1131  if(dmSize == -1) {
1132  ERR("DocumentProperties fails on %s\n", debugstr_a(name));
1133  return FALSE;
1134  }
1135  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1136  dmSize = DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, NULL,
1137  DM_OUT_BUFFER);
1138  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1139  !lstrcmpA( (LPSTR) lpdm->dmDeviceName,
1140  (LPSTR) PrintStructures->lpDevMode->dmDeviceName)) {
1141  /* Supplied devicemode matches current printer so try to use it */
1142  DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, lpdm,
1144  }
1145  if(lpdm)
1146  GlobalUnlock(lppd->hDevMode);
1147 
1148  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1149 
1150  if(!(lppd->Flags & PD_PRINTSETUP)) {
1151  /* Print range (All/Range/Selection) */
1152  if(lppd->nFromPage != 0xffff)
1153  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1154  if(lppd->nToPage != 0xffff)
1155  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1156 
1157  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1158  if (lppd->Flags & PD_NOSELECTION)
1159  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1160  else
1161  if (lppd->Flags & PD_SELECTION)
1162  CheckRadioButton(hDlg, rad1, rad3, rad2);
1163  if (lppd->Flags & PD_NOPAGENUMS) {
1164  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1166  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1168  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1169  } else {
1170  if (lppd->Flags & PD_PAGENUMS)
1171  CheckRadioButton(hDlg, rad1, rad3, rad3);
1172  }
1173 
1174  /* Collate pages
1175  *
1176  * FIXME: The ico3 is not displayed for some reason. I don't know why.
1177  */
1178  if (lppd->Flags & PD_COLLATE) {
1180  (LPARAM)PrintStructures->hCollateIcon);
1181  CheckDlgButton(hDlg, chx2, 1);
1182  } else {
1184  (LPARAM)PrintStructures->hNoCollateIcon);
1185  CheckDlgButton(hDlg, chx2, 0);
1186  }
1187 
1188  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1189  /* if printer doesn't support it: no Collate */
1190  if (!(lpdm->dmFields & DM_COLLATE)) {
1191  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1192  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1193  }
1194  }
1195 
1196  /* nCopies */
1197  {
1198  INT copies;
1199  if (lppd->hDevMode == 0)
1200  copies = lppd->nCopies;
1201  else
1202  copies = lpdm->u1.s1.dmCopies;
1203  if(copies == 0) copies = 1;
1204  else if(copies < 0) copies = MAX_COPIES;
1205  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1206  }
1207 
1208  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1209  /* if printer doesn't support it: no nCopies */
1210  if (!(lpdm->dmFields & DM_COPIES)) {
1211  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1212  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1213  }
1214  }
1215 
1216  /* print to file */
1217  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1218  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1219  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1220  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1221  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1222 
1223  /* Fill print quality combo, PrintDlg16 */
1224  if(GetDlgItem(hDlg, cmb1))
1225  {
1226  DWORD numResolutions = DeviceCapabilitiesA(PrintStructures->lpPrinterInfo->pPrinterName,
1227  PrintStructures->lpPrinterInfo->pPortName,
1228  DC_ENUMRESOLUTIONS, NULL, lpdm);
1229 
1230  if(numResolutions != -1)
1231  {
1232  HWND hQuality = GetDlgItem(hDlg, cmb1);
1233  LONG* Resolutions;
1234  char buf[255];
1235  DWORD i;
1236  int dpiX, dpiY;
1237  HDC hPrinterDC = CreateDCA(PrintStructures->lpPrinterInfo->pDriverName,
1238  PrintStructures->lpPrinterInfo->pPrinterName,
1239  0, lpdm);
1240 
1241  Resolutions = HeapAlloc(GetProcessHeap(), 0, numResolutions*sizeof(LONG)*2);
1243  PrintStructures->lpPrinterInfo->pPortName,
1244  DC_ENUMRESOLUTIONS, (LPSTR)Resolutions, lpdm);
1245 
1246  dpiX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
1247  dpiY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
1248  DeleteDC(hPrinterDC);
1249 
1250  SendMessageA(hQuality, CB_RESETCONTENT, 0, 0);
1251  for(i = 0; i < (numResolutions * 2); i += 2)
1252  {
1253  BOOL IsDefault = FALSE;
1254  LRESULT Index;
1255 
1256  if(Resolutions[i] == Resolutions[i+1])
1257  {
1258  if(dpiX == Resolutions[i])
1259  IsDefault = TRUE;
1260  sprintf(buf, "%d dpi", Resolutions[i]);
1261  } else
1262  {
1263  if(dpiX == Resolutions[i] && dpiY == Resolutions[i+1])
1264  IsDefault = TRUE;
1265  sprintf(buf, "%d dpi x %d dpi", Resolutions[i], Resolutions[i+1]);
1266  }
1267 
1268  Index = SendMessageA(hQuality, CB_ADDSTRING, 0, (LPARAM)buf);
1269 
1270  if(IsDefault)
1271  SendMessageA(hQuality, CB_SETCURSEL, Index, 0);
1272 
1273  SendMessageA(hQuality, CB_SETITEMDATA, Index, MAKELONG(dpiX,dpiY));
1274  }
1275  HeapFree(GetProcessHeap(), 0, Resolutions);
1276  }
1277  }
1278  } else { /* PD_PRINTSETUP */
1279  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1280 
1282  PrintStructures->lpPrinterInfo->pPrinterName,
1283  PrintStructures->lpPrinterInfo->pPortName,
1284  lpdm);
1286  PrintStructures->lpPrinterInfo->pPrinterName,
1287  PrintStructures->lpPrinterInfo->pPortName,
1288  lpdm);
1289  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1291  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1292  PrintStructures->hLandscapeIcon));
1293 
1294  }
1295 
1296  /* help button */
1297  if ((lppd->Flags & PD_SHOWHELP)==0) {
1298  /* hide if PD_SHOWHELP not specified */
1300  }
1301  return TRUE;
1302 }
HICON hPortraitIcon
Definition: printdlg.c:68
WINBOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
#define CB_SETITEMDATA
Definition: winuser.h:1948
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define LOGPIXELSX
Definition: wingdi.h:717
#define PD_NOSELECTION
Definition: commdlg.h:149
#define IMAGE_ICON
Definition: winuser.h:212
HICON hNoCollateIcon
Definition: printdlg.c:67
HICON hCollateIcon
Definition: printdlg.c:66
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WINBOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
Definition: printers.c:2033
static HDC
Definition: imagelist.c:92
LPPRINTER_INFO_2A lpPrinterInfo
Definition: printdlg.c:63
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define stc2
Definition: dlgs.h:161
WORD nCopies
Definition: commdlg.h:475
LPPRINTDLGA lpPrintDlg
Definition: printdlg.c:62
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PD_NOPAGENUMS
Definition: commdlg.h:150
char * LPSTR
Definition: xmlstorage.h:182
#define DM_COLLATE
Definition: wingdi.h:1264
int32_t INT
Definition: typedefs.h:58
static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *pi)
Definition: printdlg.c:1021
#define rad2
Definition: dlgs.h:131
static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg, int nIDComboBox, char *PrinterName, char *PortName, LPDEVMODEA dm)
Definition: printdlg.c:798
#define ico1
Definition: dlgs.h:90
#define sprintf(buf, format,...)
Definition: sprintf.c:55
short dmCopies
Definition: wingdi.h: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 FALSE
Definition: types.h:117
#define chx1
Definition: dlgs.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
#define chx2
Definition: dlgs.h:32
long LONG
Definition: pedump.c:60
#define DM_OUT_BUFFER
Definition: windef.h:359
#define stc3
Definition: dlgs.h:162
short dmOrientation
Definition: wingdi.h:1572
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
#define CB_ADDSTRING
Definition: winuser.h:1918
#define MAKELONG(a, b)
Definition: typedefs.h:249
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:666
#define PD_SELECTION
Definition: commdlg.h:147
LONG_PTR LPARAM
Definition: windef.h:208
HICON hLandscapeIcon
Definition: printdlg.c:69
WINBOOL WINAPI OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefault)
Definition: printers.c:2553
#define CB_RESETCONTENT
Definition: winuser.h:1941
LPSTR pPrinterName
Definition: winspool.h:39
#define GetProcessHeap()
Definition: compat.h:484
#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:110
#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:483
#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 1304 of file printdlg.c.

1306 {
1307  LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
1308  LPDEVMODEW lpdm = NULL;
1309  LONG dmSize;
1310  DWORD needed;
1311  HANDLE hprn;
1312 
1313  HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
1314  HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
1315  if(!OpenPrinterW(name, &hprn, NULL)) {
1316  ERR("Can't open printer %s\n", debugstr_w(name));
1317  return FALSE;
1318  }
1319  GetPrinterW(hprn, 2, NULL, 0, &needed);
1320  PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
1321  GetPrinterW(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
1322  &needed);
1323  GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
1324  PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
1325  if (!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
1326  needed, &needed)) {
1327  ERR("GetPrinterDriverA failed for %s, fix your config!\n",debugstr_w(PrintStructures->lpPrinterInfo->pPrinterName));
1328  return FALSE;
1329  }
1330  ClosePrinter(hprn);
1331 
1332  PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo);
1333 
1334  HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
1335  PrintStructures->lpDevMode = NULL;
1336 
1337  dmSize = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
1338  if(dmSize == -1) {
1339  ERR("DocumentProperties fails on %s\n", debugstr_w(name));
1340  return FALSE;
1341  }
1342  PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize);
1343  dmSize = DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, NULL,
1344  DM_OUT_BUFFER);
1345  if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) &&
1346  !lstrcmpW(lpdm->dmDeviceName,
1347  PrintStructures->lpDevMode->dmDeviceName)) {
1348  /* Supplied devicemode matches current printer so try to use it */
1349  DocumentPropertiesW(0, 0, name, PrintStructures->lpDevMode, lpdm,
1351  }
1352  if(lpdm)
1353  GlobalUnlock(lppd->hDevMode);
1354 
1355  lpdm = PrintStructures->lpDevMode; /* use this as a shortcut */
1356 
1357  if(!(lppd->Flags & PD_PRINTSETUP)) {
1358  /* Print range (All/Range/Selection) */
1359  if(lppd->nFromPage != 0xffff)
1360  SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE);
1361  if(lppd->nToPage != 0xffff)
1362  SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);
1363 
1364  CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */
1365  if (lppd->Flags & PD_NOSELECTION)
1366  EnableWindow(GetDlgItem(hDlg, rad2), FALSE);
1367  else
1368  if (lppd->Flags & PD_SELECTION)
1369  CheckRadioButton(hDlg, rad1, rad3, rad2);
1370  if (lppd->Flags & PD_NOPAGENUMS) {
1371  EnableWindow(GetDlgItem(hDlg, rad3), FALSE);
1373  EnableWindow(GetDlgItem(hDlg, edt1), FALSE);
1375  EnableWindow(GetDlgItem(hDlg, edt2), FALSE);
1376  } else {
1377  if (lppd->Flags & PD_PAGENUMS)
1378  CheckRadioButton(hDlg, rad1, rad3, rad3);
1379  }
1380 
1381  /* Collate pages
1382  *
1383  * FIXME: The ico3 is not displayed for some reason. I don't know why.
1384  */
1385  if (lppd->Flags & PD_COLLATE) {
1387  (LPARAM)PrintStructures->hCollateIcon);
1388  CheckDlgButton(hDlg, chx2, 1);
1389  } else {
1391  (LPARAM)PrintStructures->hNoCollateIcon);
1392  CheckDlgButton(hDlg, chx2, 0);
1393  }
1394 
1395  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1396  /* if printer doesn't support it: no Collate */
1397  if (!(lpdm->dmFields & DM_COLLATE)) {
1398  EnableWindow(GetDlgItem(hDlg, chx2), FALSE);
1399  EnableWindow(GetDlgItem(hDlg, ico3), FALSE);
1400  }
1401  }
1402 
1403  /* nCopies */
1404  {
1405  INT copies;
1406  if (lppd->hDevMode == 0)
1407  copies = lppd->nCopies;
1408  else
1409  copies = lpdm->u1.s1.dmCopies;
1410  if(copies == 0) copies = 1;
1411  else if(copies < 0) copies = MAX_COPIES;
1412  SetDlgItemInt(hDlg, edt3, copies, FALSE);
1413  }
1414 
1415  if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
1416  /* if printer doesn't support it: no nCopies */
1417  if (!(lpdm->dmFields & DM_COPIES)) {
1418  EnableWindow(GetDlgItem(hDlg, edt3), FALSE);
1419  EnableWindow(GetDlgItem(hDlg, stc5), FALSE);
1420  }
1421  }
1422 
1423  /* print to file */
1424  CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);
1425  if (lppd->Flags & PD_DISABLEPRINTTOFILE)
1426  EnableWindow(GetDlgItem(hDlg, chx1), FALSE);
1427  if (lppd->Flags & PD_HIDEPRINTTOFILE)
1428  ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
1429 
1430  } else { /* PD_PRINTSETUP */
1431  BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
1432 
1434  PrintStructures->lpPrinterInfo->pPrinterName,
1435  PrintStructures->lpPrinterInfo->pPortName,
1436  lpdm);
1438  PrintStructures->lpPrinterInfo->pPrinterName,
1439  PrintStructures->lpPrinterInfo->pPortName,
1440  lpdm);
1441  CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2);
1443  (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon :
1444  PrintStructures->hLandscapeIcon));
1445 
1446  }
1447 
1448  /* help button */
1449  if ((lppd->Flags & PD_SHOWHELP)==0) {
1450  /* hide if PD_SHOWHELP not specified */
1452  }
1453  return TRUE;
1454 }
#define PD_HIDEPRINTTOFILE
Definition: commdlg.h:168
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define PD_NOSELECTION
Definition: commdlg.h:149
#define IMAGE_ICON
Definition: winuser.h:212
DWORD dmFields
Definition: wingdi.h:1621
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
short dmOrientation
Definition: wingdi.h:1624
#define stc2
Definition: dlgs.h:161
static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *pi)
Definition: printdlg.c:1057
LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
Definition: printers.c:1153
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD Flags
Definition: commdlg.h:491
WINBOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
#define PD_NOPAGENUMS
Definition: commdlg.h:150
#define DM_COLLATE
Definition: wingdi.h:1264
int32_t INT
Definition: typedefs.h:58
#define rad2
Definition: dlgs.h:131
#define ico1
Definition: dlgs.h:90
HICON hPortraitIcon
Definition: printdlg.c:82
LPDRIVER_INFO_3W lpDriverInfo
Definition: printdlg.c:78
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define chx1
Definition: dlgs.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
#define chx2
Definition: dlgs.h:32
long LONG
Definition: pedump.c:60
#define DM_OUT_BUFFER
Definition: windef.h:359
#define debugstr_w
Definition: kernel32.h:32
#define stc3
Definition: dlgs.h:162
HICON hCollateIcon
Definition: printdlg.c:80
WINBOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
#define PD_DISABLEPRINTTOFILE
Definition: commdlg.h:167
HGLOBAL hDevMode
Definition: commdlg.h:488
WORD nCopies
Definition: commdlg.h:496
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:2504
HICON hNoCollateIcon
Definition: printdlg.c:81
#define GetProcessHeap()
Definition: compat.h:484
#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:110
#define cmb2
Definition: dlgs.h:49
WINBOOL WINAPI OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2624
#define DM_IN_BUFFER
Definition: windef.h:357
#define cmb3
Definition: dlgs.h:50
#define DM_COPIES
Definition: wingdi.h: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:907
#define ico3
Definition: dlgs.h:92
#define rad1
Definition: dlgs.h:130
#define HeapFree(x, y, z)
Definition: compat.h:483
#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 2197 of file printdlg.c.

2198 {
2199  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2200  DEVMODEA *pdm = GlobalLock(lppd->hDevMode);
2201 
2202  if(lppd->Flags & PD_RETURNDC) {
2203  lppd->hDC = CreateDCA((char*)pdn + pdn->wDriverOffset,
2204  (char*)pdn + pdn->wDeviceOffset,
2205  (char*)pdn + pdn->wOutputOffset,
2206  pdm );
2207  } else if(lppd->Flags & PD_RETURNIC) {
2208  lppd->hDC = CreateICA((char*)pdn + pdn->wDriverOffset,
2209  (char*)pdn + pdn->wDeviceOffset,
2210  (char*)pdn + pdn->wOutputOffset,
2211  pdm );
2212  }
2213  GlobalUnlock(lppd->hDevNames);
2214  GlobalUnlock(lppd->hDevMode);
2215  return lppd->hDC != NULL;
2216 }
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 2218 of file printdlg.c.

2219 {
2220  DEVNAMES *pdn = GlobalLock(lppd->hDevNames);
2221  DEVMODEW *pdm = GlobalLock(lppd->hDevMode);
2222 
2223  if(lppd->Flags & PD_RETURNDC) {
2224  lppd->hDC = CreateDCW((WCHAR*)pdn + pdn->wDriverOffset,
2225  (WCHAR*)pdn + pdn->wDeviceOffset,
2226  (WCHAR*)pdn + pdn->wOutputOffset,
2227  pdm );
2228  } else if(lppd->Flags & PD_RETURNIC) {
2229  lppd->hDC = CreateICW((WCHAR*)pdn + pdn->wDriverOffset,
2230  (WCHAR*)pdn + pdn->wDeviceOffset,
2231  (WCHAR*)pdn + pdn->wOutputOffset,
2232  pdm );
2233  }
2234  GlobalUnlock(lppd->hDevNames);
2235  GlobalUnlock(lppd->hDevMode);
2236  return lppd->hDC != NULL;
2237 }
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 476 of file printdlg.c.

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

Referenced by PrintDlgA(), and PrintDlgExA().

◆ PRINTDLG_CreateDevNamesW()

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

Definition at line 530 of file printdlg.c.

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

2125 {
2126  HRSRC hResInfo;
2127  HGLOBAL hDlgTmpl;
2128 
2129  if (lppd->Flags & PD_PRINTSETUP) {
2130  if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) {
2131  hDlgTmpl = lppd->hSetupTemplate;
2132  } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) {
2133  hResInfo = FindResourceA(lppd->hInstance,
2135  hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);
2136  } else {
2137  hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP",
2138  (LPSTR)RT_DIALOG);
2139  hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo);
2140  }
2141  } else {
2142  if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) {
2143  hDlgTmpl = lppd->hPrintTemplate;
2144  } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) {
2145  hResInfo = FindResourceA(lppd->hInstance,
2146  lppd->lpPrintTemplateName,
2147  (LPSTR)RT_DIALOG);
2148  hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);
2149  } else {
2150  hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32",
2151  (LPSTR)RT_DIALOG);
2152  hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo);
2153  }
2154  }
2155  return hDlgTmpl;
2156 }