Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 605 lines (494 sloc) 18.327 kb
eba3580 Dan Savilonis Initial commit - Notepad2 4.1.24
authored
1 /******************************************************************************
2 *
3 *
4 * Notepad2
5 *
6 * Print.cpp
7 * Scintilla Printing Functionality
8 * Mostly taken from SciTE, (c) Neil Hodgson, http://www.scintilla.org
9 *
10 * See Readme.txt for more information about this source code.
11 * Please send me your comments to this work.
12 *
13 * See License.txt for details about distribution and modification.
14 *
e94bb31 Dan Savilonis Notepad2 4.2.25-rc7
authored
15 * (c) Florian Balmer 1996-2011
eba3580 Dan Savilonis Initial commit - Notepad2 4.1.24
authored
16 * florian.balmer@gmail.com
17 * http://www.flos-freeware.ch
18 *
19 *
20 ******************************************************************************/
21 #define _WIN32_WINNT 0x501
22 #include <windows.h>
23 #include <commctrl.h>
24 #include <shlwapi.h>
25 #include <commdlg.h>
26 #include <string.h>
27 #include "platform.h"
28 #include "scintilla.h"
29 #include "scilexer.h"
30 extern "C" {
31 #include "dialogs.h"
32 #include "helpers.h"
33 }
34 #include "resource.h"
35
36
37 extern "C" HINSTANCE g_hInstance;
38
39
40 // Global settings...
41 extern "C" int iPrintHeader;
42 extern "C" int iPrintFooter;
43 extern "C" int iPrintColor;
44 extern "C" int iPrintZoom;
45 extern "C" RECT pagesetupMargin;
46
47
48 // Stored objects...
49 HGLOBAL hDevMode = NULL;
50 HGLOBAL hDevNames = NULL;
51
52
53 //=============================================================================
54 //
55 // EditPrint() - Code from SciTE
56 //
57 extern "C" HWND hwndStatus;
58
59 void StatusUpdatePrintPage(int iPageNum)
60 {
61 WCHAR tch[32];
62
63 FormatString(tch,COUNTOF(tch),IDS_PRINTFILE,iPageNum);
64
65 StatusSetText(hwndStatus,255,tch);
66 StatusSetSimple(hwndStatus,TRUE);
67
68 InvalidateRect(hwndStatus,NULL,TRUE);
69 UpdateWindow(hwndStatus);
70 }
71
72
73 extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
74 {
75
76 // Don't print empty documents
77 if (SendMessage(hwnd,SCI_GETLENGTH,0,0) == 0) {
78 MsgBox(MBINFO,IDS_PRINT_EMPTY);
79 return TRUE;
80 }
81
82 int startPos;
83 int endPos;
84
85 HDC hdc;
86
87 RECT rectMargins;
88 RECT rectPhysMargins;
89 RECT rectSetup;
90 POINT ptPage;
91 POINT ptDpi;
92
93 //RECT rectSetup;
94
95 TEXTMETRIC tm;
96
97 int headerLineHeight;
98 HFONT fontHeader;
99
100 int footerLineHeight;
101 HFONT fontFooter;
102
103 WCHAR dateString[256];
104
105 DOCINFO di = {sizeof(DOCINFO), 0, 0, 0, 0};
106
107 LONG lengthDoc;
108 LONG lengthDocMax;
109 LONG lengthPrinted;
110
111 struct RangeToFormat frPrint;
112
113 int pageNum;
114 BOOL printPage;
115
116 WCHAR pageString[32];
117
118 HPEN pen;
119 HPEN penOld;
120
121 PRINTDLG pdlg = { sizeof(PRINTDLG), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
122 pdlg.hwndOwner = GetParent(hwnd);
123 pdlg.hInstance = g_hInstance;
124 pdlg.Flags = PD_USEDEVMODECOPIES | PD_ALLPAGES | PD_RETURNDC;
125 pdlg.nFromPage = 1;
126 pdlg.nToPage = 1;
127 pdlg.nMinPage = 1;
128 pdlg.nMaxPage = 0xffffU;
129 pdlg.nCopies = 1;
130 pdlg.hDC = 0;
131 pdlg.hDevMode = hDevMode;
132 pdlg.hDevNames = hDevNames;
133
134 startPos = SendMessage(hwnd,SCI_GETSELECTIONSTART,0,0);;
135 endPos = SendMessage(hwnd,SCI_GETSELECTIONEND,0,0);
136
137 if (startPos == endPos) {
138 pdlg.Flags |= PD_NOSELECTION;
139 } else {
140 pdlg.Flags |= PD_SELECTION;
141 }
142 if (0) {
143 // Don't display dialog box, just use the default printer and options
144 pdlg.Flags |= PD_RETURNDEFAULT;
145 }
146 if (!PrintDlg(&pdlg)) {
147 return TRUE; // False means error...
148 }
149
150 hDevMode = pdlg.hDevMode;
151 hDevNames = pdlg.hDevNames;
152
153 hdc = pdlg.hDC;
154
155 // Get printer resolution
156 ptDpi.x = GetDeviceCaps(hdc, LOGPIXELSX); // dpi in X direction
157 ptDpi.y = GetDeviceCaps(hdc, LOGPIXELSY); // dpi in Y direction
158
159 // Start by getting the physical page size (in device units).
160 ptPage.x = GetDeviceCaps(hdc, PHYSICALWIDTH); // device units
161 ptPage.y = GetDeviceCaps(hdc, PHYSICALHEIGHT); // device units
162
163 // Get the dimensions of the unprintable
164 // part of the page (in device units).
165 rectPhysMargins.left = GetDeviceCaps(hdc, PHYSICALOFFSETX);
166 rectPhysMargins.top = GetDeviceCaps(hdc, PHYSICALOFFSETY);
167
168 // To get the right and lower unprintable area,
169 // we take the entire width and height of the paper and
170 // subtract everything else.
171 rectPhysMargins.right = ptPage.x // total paper width
172 - GetDeviceCaps(hdc, HORZRES) // printable width
173 - rectPhysMargins.left; // left unprintable margin
174
175 rectPhysMargins.bottom = ptPage.y // total paper height
176 - GetDeviceCaps(hdc, VERTRES) // printable height
177 - rectPhysMargins.top; // right unprintable margin
178
179 // At this point, rectPhysMargins contains the widths of the
180 // unprintable regions on all four sides of the page in device units.
181
182 // Take in account the page setup given by the user (if one value is not null)
183 if (pagesetupMargin.left != 0 || pagesetupMargin.right != 0 ||
184 pagesetupMargin.top != 0 || pagesetupMargin.bottom != 0) {
185
186 // Convert the hundredths of millimeters (HiMetric) or
187 // thousandths of inches (HiEnglish) margin values
188 // from the Page Setup dialog to device units.
189 // (There are 2540 hundredths of a mm in an inch.)
190
191 WCHAR localeInfo[3];
192 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, localeInfo, 3);
193
194 if (localeInfo[0] == L'0') { // Metric system. L'1' is US System
195 rectSetup.left = MulDiv (pagesetupMargin.left, ptDpi.x, 2540);
196 rectSetup.top = MulDiv (pagesetupMargin.top, ptDpi.y, 2540);
197 rectSetup.right = MulDiv(pagesetupMargin.right, ptDpi.x, 2540);
198 rectSetup.bottom = MulDiv(pagesetupMargin.bottom, ptDpi.y, 2540);
199 } else {
200 rectSetup.left = MulDiv(pagesetupMargin.left, ptDpi.x, 1000);
201 rectSetup.top = MulDiv(pagesetupMargin.top, ptDpi.y, 1000);
202 rectSetup.right = MulDiv(pagesetupMargin.right, ptDpi.x, 1000);
203 rectSetup.bottom = MulDiv(pagesetupMargin.bottom, ptDpi.y, 1000);
204 }
205
206 // Dont reduce margins below the minimum printable area
207 rectMargins.left = max(rectPhysMargins.left, rectSetup.left);
208 rectMargins.top = max(rectPhysMargins.top, rectSetup.top);
209 rectMargins.right = max(rectPhysMargins.right, rectSetup.right);
210 rectMargins.bottom = max(rectPhysMargins.bottom, rectSetup.bottom);
211 } else {
212 rectMargins.left = rectPhysMargins.left;
213 rectMargins.top = rectPhysMargins.top;
214 rectMargins.right = rectPhysMargins.right;
215 rectMargins.bottom = rectPhysMargins.bottom;
216 }
217
218 // rectMargins now contains the values used to shrink the printable
219 // area of the page.
220
221 // Convert device coordinates into logical coordinates
222 DPtoLP(hdc, (LPPOINT)&rectMargins, 2);
223 DPtoLP(hdc, (LPPOINT)&rectPhysMargins, 2);
224
225 // Convert page size to logical units and we're done!
226 DPtoLP(hdc, (LPPOINT) &ptPage, 1);
227
228 headerLineHeight = MulDiv(8,ptDpi.y, 72);
229 fontHeader = CreateFont(headerLineHeight,
230 0, 0, 0,
231 FW_BOLD,
232 0,
233 0,
234 0, 0, 0,
235 0, 0, 0,
236 L"Arial");
237 SelectObject(hdc, fontHeader);
238 GetTextMetrics(hdc, &tm);
239 headerLineHeight = tm.tmHeight + tm.tmExternalLeading;
240
241 if (iPrintHeader == 3)
242 headerLineHeight = 0;
243
244 footerLineHeight = MulDiv(7,ptDpi.y, 72);
245 fontFooter = CreateFont(footerLineHeight,
246 0, 0, 0,
247 FW_NORMAL,
248 0,
249 0,
250 0, 0, 0,
251 0, 0, 0,
252 L"Arial");
253 SelectObject(hdc, fontFooter);
254 GetTextMetrics(hdc, &tm);
255 footerLineHeight = tm.tmHeight + tm.tmExternalLeading;
256
257 if (iPrintFooter == 1)
258 footerLineHeight = 0;
259
260 di.lpszDocName = pszDocTitle;
261 di.lpszOutput = 0;
262 di.lpszDatatype = 0;
263 di.fwType = 0;
264 if (StartDoc(hdc, &di) < 0) {
265 DeleteDC(hdc);
266 if (fontHeader)
267 DeleteObject(fontHeader);
268 if (fontFooter)
269 DeleteObject(fontFooter);
270 return FALSE;
271 }
272
273 // Get current date...
274 SYSTEMTIME st;
275 GetLocalTime(&st);
276 GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,NULL,dateString,256);
277
278 // Get current time...
279 if (iPrintHeader == 0)
280 {
281 WCHAR timeString[128];
282 GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,NULL,timeString,128);
283 lstrcat(dateString,L" ");
284 lstrcat(dateString,timeString);
285 }
286
287 // Set print color mode
288 int printColorModes[5] = {
289 SC_PRINT_NORMAL,
290 SC_PRINT_INVERTLIGHT,
291 SC_PRINT_BLACKONWHITE,
292 SC_PRINT_COLOURONWHITE,
293 SC_PRINT_COLOURONWHITEDEFAULTBG };
294 SendMessage(hwnd,SCI_SETPRINTCOLOURMODE,printColorModes[iPrintColor],0);
295
296 // Set print zoom...
297 SendMessage(hwnd,SCI_SETPRINTMAGNIFICATION,(WPARAM)iPrintZoom,0);
298
299 lengthDoc = SendMessage(hwnd,SCI_GETLENGTH,0,0);
300 lengthDocMax = lengthDoc;
301 lengthPrinted = 0;
302
303 // Requested to print selection
304 if (pdlg.Flags & PD_SELECTION) {
305 if (startPos > endPos) {
306 lengthPrinted = endPos;
307 lengthDoc = startPos;
308 } else {
309 lengthPrinted = startPos;
310 lengthDoc = endPos;
311 }
312
313 if (lengthPrinted < 0)
314 lengthPrinted = 0;
315 if (lengthDoc > lengthDocMax)
316 lengthDoc = lengthDocMax;
317 }
318
319 // We must substract the physical margins from the printable area
320 frPrint.hdc = hdc;
321 frPrint.hdcTarget = hdc;
322 frPrint.rc.left = rectMargins.left - rectPhysMargins.left;
323 frPrint.rc.top = rectMargins.top - rectPhysMargins.top;
324 frPrint.rc.right = ptPage.x - rectMargins.right - rectPhysMargins.left;
325 frPrint.rc.bottom = ptPage.y - rectMargins.bottom - rectPhysMargins.top;
326 frPrint.rcPage.left = 0;
327 frPrint.rcPage.top = 0;
328 frPrint.rcPage.right = ptPage.x - rectPhysMargins.left - rectPhysMargins.right - 1;
329 frPrint.rcPage.bottom = ptPage.y - rectPhysMargins.top - rectPhysMargins.bottom - 1;
330 frPrint.rc.top += headerLineHeight + headerLineHeight / 2;
331 frPrint.rc.bottom -= footerLineHeight + footerLineHeight / 2;
332 // Print each page
333 pageNum = 1;
334
335 while (lengthPrinted < lengthDoc) {
336 printPage = (!(pdlg.Flags & PD_PAGENUMS) ||
337 (pageNum >= pdlg.nFromPage) && (pageNum <= pdlg.nToPage));
338
339 wsprintf(pageString, pszPageFormat, pageNum);
340
341 if (printPage) {
342
343 // Show wait cursor...
e94bb31 Dan Savilonis Notepad2 4.2.25-rc7
authored
344 SendMessage(hwnd,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0);
eba3580 Dan Savilonis Initial commit - Notepad2 4.1.24
authored
345
346 // Display current page number in Statusbar
347 StatusUpdatePrintPage(pageNum);
348
349 StartPage(hdc);
350
351 SetTextColor(hdc, RGB(0,0,0));
352 SetBkColor(hdc, RGB(255,255,255));
353 SelectObject(hdc, fontHeader);
354 UINT ta = SetTextAlign(hdc, TA_BOTTOM);
355 RECT rcw = {frPrint.rc.left, frPrint.rc.top - headerLineHeight - headerLineHeight / 2,
356 frPrint.rc.right, frPrint.rc.top - headerLineHeight / 2};
357 rcw.bottom = rcw.top + headerLineHeight;
358
359 if (iPrintHeader < 3)
360 {
361 ExtTextOut(hdc, frPrint.rc.left + 5, frPrint.rc.top - headerLineHeight / 2,
362 /*ETO_OPAQUE*/0, &rcw, pszDocTitle,
363 lstrlen(pszDocTitle), NULL);
364 }
365
366 // Print date in header
367 if (iPrintHeader == 0 || iPrintHeader == 1)
368 {
369 SIZE sizeInfo;
370 SelectObject(hdc,fontFooter);
371 GetTextExtentPoint32(hdc,dateString,lstrlen(dateString),&sizeInfo);
372 ExtTextOut(hdc, frPrint.rc.right - 5 - sizeInfo.cx, frPrint.rc.top - headerLineHeight / 2,
373 /*ETO_OPAQUE*/0, &rcw, dateString,
374 lstrlen(dateString), NULL);
375 }
376
377 if (iPrintHeader < 3)
378 {
379 SetTextAlign(hdc, ta);
380 pen = CreatePen(0, 1, RGB(0,0,0));
381 penOld = (HPEN)SelectObject(hdc, pen);
382 MoveToEx(hdc, frPrint.rc.left, frPrint.rc.top - headerLineHeight / 4, NULL);
383 LineTo(hdc, frPrint.rc.right, frPrint.rc.top - headerLineHeight / 4);
384 SelectObject(hdc, penOld);
385 DeleteObject(pen);
386 }
387 }
388
389 frPrint.chrg.cpMin = lengthPrinted;
390 frPrint.chrg.cpMax = lengthDoc;
391
392 lengthPrinted = SendMessage(hwnd,SCI_FORMATRANGE,printPage,(LPARAM)&frPrint);
393
394 if (printPage) {
395 SetTextColor(hdc, RGB(0,0,0));
396 SetBkColor(hdc, RGB(255,255,255));
397 SelectObject(hdc, fontFooter);
398 UINT ta = SetTextAlign(hdc, TA_TOP);
399 RECT rcw = {frPrint.rc.left, frPrint.rc.bottom + footerLineHeight / 2,
400 frPrint.rc.right, frPrint.rc.bottom + footerLineHeight + footerLineHeight / 2};
401
402 if (iPrintFooter == 0)
403 {
404 SIZE sizeFooter;
405 GetTextExtentPoint32(hdc,pageString,lstrlen(pageString),&sizeFooter);
406 ExtTextOut(hdc, frPrint.rc.right - 5 - sizeFooter.cx, frPrint.rc.bottom + footerLineHeight / 2,
407 /*ETO_OPAQUE*/0, &rcw, pageString,
408 lstrlen(pageString), NULL);
409
410 SetTextAlign(hdc, ta);
411 pen = ::CreatePen(0, 1, RGB(0,0,0));
412 penOld = (HPEN)SelectObject(hdc, pen);
413 SetBkColor(hdc, RGB(0,0,0));
414 MoveToEx(hdc, frPrint.rc.left, frPrint.rc.bottom + footerLineHeight / 4, NULL);
415 LineTo(hdc, frPrint.rc.right, frPrint.rc.bottom + footerLineHeight / 4);
416 SelectObject(hdc, penOld);
417 DeleteObject(pen);
418 }
419
420 EndPage(hdc);
421 }
422 pageNum++;
423
424 if ((pdlg.Flags & PD_PAGENUMS) && (pageNum > pdlg.nToPage))
425 break;
426 }
427
428 SendMessage(hwnd,SCI_FORMATRANGE, FALSE, 0);
429
430 EndDoc(hdc);
431 DeleteDC(hdc);
432 if (fontHeader)
433 DeleteObject(fontHeader);
434 if (fontFooter)
435 DeleteObject(fontFooter);
436
437 // Reset Statusbar to default mode
438 StatusSetSimple(hwndStatus,FALSE);
439
440 // Remove wait cursor...
e94bb31 Dan Savilonis Notepad2 4.2.25-rc7
authored
441 SendMessage(hwnd,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0);
eba3580 Dan Savilonis Initial commit - Notepad2 4.1.24
authored
442
443 return TRUE;
444 }
445
446
447 //=============================================================================
448 //
449 // EditPrintSetup() - Code from SciTE
450 //
451 // Custom controls: 30 Zoom
452 // 31 Spin
453 // 32 Header
454 // 33 Footer
455 // 34 Colors
456 //
457 extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
458 {
459 switch (uiMsg)
460 {
461 case WM_INITDIALOG:
462 {
463 WCHAR tch[512];
464 WCHAR *p1,*p2;
465
466 SendDlgItemMessage(hwnd,30,EM_LIMITTEXT,32,0);
467
468 SendDlgItemMessage(hwnd,31,UDM_SETRANGE,0,MAKELONG((short)20,(short)-10));
469 SendDlgItemMessage(hwnd,31,UDM_SETPOS,0,MAKELONG((short)iPrintZoom,0));
470
471 // Set header options
472 GetString(IDS_PRINT_HEADER,tch,COUNTOF(tch));
473 lstrcat(tch,L"|");
474 p1 = tch;
475 while (p2 = StrChr(p1,L'|')) {
476 *p2++ = L'\0';
477 if (*p1)
478 SendDlgItemMessage(hwnd,32,CB_ADDSTRING,0,(LPARAM)p1);
479 p1 = p2; }
480 SendDlgItemMessage(hwnd,32,CB_SETCURSEL,(WPARAM)iPrintHeader,0);
481
482 // Set footer options
483 GetString(IDS_PRINT_FOOTER,tch,COUNTOF(tch));
484 lstrcat(tch,L"|");
485 p1 = tch;
486 while (p2 = StrChr(p1,L'|')) {
487 *p2++ = L'\0';
488 if (*p1)
489 SendDlgItemMessage(hwnd,33,CB_ADDSTRING,0,(LPARAM)p1);
490 p1 = p2; }
491 SendDlgItemMessage(hwnd,33,CB_SETCURSEL,(WPARAM)iPrintFooter,0);
492
493 // Set color options
494 GetString(IDS_PRINT_COLOR,tch,COUNTOF(tch));
495 lstrcat(tch,L"|");
496 p1 = tch;
497 while (p2 = StrChr(p1,L'|')) {
498 *p2++ = L'\0';
499 if (*p1)
500 SendDlgItemMessage(hwnd,34,CB_ADDSTRING,0,(LPARAM)p1);
501 p1 = p2; }
502 SendDlgItemMessage(hwnd,34,CB_SETCURSEL,(WPARAM)iPrintColor,0);
503
504 // Make combos handier
505 SendDlgItemMessage(hwnd,32,CB_SETEXTENDEDUI,TRUE,0);
506 SendDlgItemMessage(hwnd,33,CB_SETEXTENDEDUI,TRUE,0);
507 SendDlgItemMessage(hwnd,34,CB_SETEXTENDEDUI,TRUE,0);
508 SendDlgItemMessage(hwnd,1137,CB_SETEXTENDEDUI,TRUE,0);
509 SendDlgItemMessage(hwnd,1138,CB_SETEXTENDEDUI,TRUE,0);
510 }
511 break;
512
513 case WM_COMMAND:
514 if (LOWORD(wParam) == IDOK)
515 {
516 LONG lPos = SendDlgItemMessage(hwnd,31,UDM_GETPOS,0,0);
517 if (HIWORD(lPos) == 0)
518 iPrintZoom = (int)(short)LOWORD(lPos);
519 else
520 iPrintZoom = 0;
521
522 iPrintHeader = SendDlgItemMessage(hwnd,32,CB_GETCURSEL,0,0);
523 iPrintFooter = SendDlgItemMessage(hwnd,33,CB_GETCURSEL,0,0);
524 iPrintColor = SendDlgItemMessage(hwnd,34,CB_GETCURSEL,0,0);
525 }
526 break;
527
528 default:
529 break;
530 }
531 return(0);
532 }
533
534
535 extern "C" void EditPrintSetup(HWND hwnd)
536 {
537 DLGTEMPLATE* pDlgTemplate =
538 LoadThemedDialogTemplate(MAKEINTRESOURCE(IDD_PAGESETUP),g_hInstance);
539
540 PAGESETUPDLG pdlg;
541 ZeroMemory(&pdlg,sizeof(PAGESETUPDLG));
542 pdlg.lStructSize = sizeof(PAGESETUPDLG);
543 pdlg.Flags = PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGESETUPTEMPLATEHANDLE;
544 pdlg.lpfnPageSetupHook = PageSetupHook;
545 pdlg.hPageSetupTemplate = pDlgTemplate;
546 pdlg.hwndOwner = GetParent(hwnd);
547 pdlg.hInstance = g_hInstance;
548
549 if (pagesetupMargin.left != 0 || pagesetupMargin.right != 0 ||
550 pagesetupMargin.top != 0 || pagesetupMargin.bottom != 0) {
551 pdlg.Flags |= PSD_MARGINS;
552
553 pdlg.rtMargin.left = pagesetupMargin.left;
554 pdlg.rtMargin.top = pagesetupMargin.top;
555 pdlg.rtMargin.right = pagesetupMargin.right;
556 pdlg.rtMargin.bottom = pagesetupMargin.bottom;
557 }
558
559 pdlg.hDevMode = hDevMode;
560 pdlg.hDevNames = hDevNames;
561
562 if (PageSetupDlg(&pdlg)) {
563
564 pagesetupMargin.left = pdlg.rtMargin.left;
565 pagesetupMargin.top = pdlg.rtMargin.top;
566 pagesetupMargin.right = pdlg.rtMargin.right;
567 pagesetupMargin.bottom = pdlg.rtMargin.bottom;
568
569 hDevMode = pdlg.hDevMode;
570 hDevNames = pdlg.hDevNames;
571 }
572
573 LocalFree(pDlgTemplate);
574 }
575
576
577 //=============================================================================
578 //
579 // EditPrintInit() - Setup default page margin if no values from registry
580 //
581 extern "C" void EditPrintInit()
582 {
583 if (pagesetupMargin.left == -1 || pagesetupMargin.top == -1 ||
584 pagesetupMargin.right == -1 || pagesetupMargin.bottom == -1)
585 {
586 WCHAR localeInfo[3];
587 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, localeInfo, 3);
588
589 if (localeInfo[0] == L'0') { // Metric system. L'1' is US System
590 pagesetupMargin.left = 2000;
591 pagesetupMargin.top = 2000;
592 pagesetupMargin.right = 2000;
593 pagesetupMargin.bottom = 2000; }
594
595 else {
596 pagesetupMargin.left = 1000;
597 pagesetupMargin.top = 1000;
598 pagesetupMargin.right = 1000;
599 pagesetupMargin.bottom = 1000; }
600 }
601 }
602
603
604 // End of Print.cpp
Something went wrong with that request. Please try again.