]> git.saurik.com Git - wxWidgets.git/blame - src/common/cmndata.cpp
BIG glitch.
[wxWidgets.git] / src / common / cmndata.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: cmndata.cpp
3// Purpose: Common GDI data
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
8bbe427f 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
8826f46f
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
c801d85f 20#ifdef __GNUG__
8826f46f 21 #pragma implementation "cmndata.h"
c801d85f
KB
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
8826f46f 28 #pragma hdrstop
c801d85f
KB
29#endif
30
31#ifndef WX_PRECOMP
8826f46f
VZ
32 #include <stdio.h>
33 #include "wx/string.h"
34 #include "wx/utils.h"
35 #include "wx/app.h"
c801d85f
KB
36#endif
37
38#include "wx/gdicmn.h"
39#include "wx/cmndata.h"
8826f46f 40
7bcb11d3
JS
41#include "wx/paper.h"
42
43// For compatibility
44#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
8826f46f 45 #define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
7bcb11d3 46#endif
c801d85f 47
8826f46f
VZ
48#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
49 #include "wx/generic/dcpsg.h"
c801d85f 50#endif
7be1f0d9 51
8826f46f
VZ
52#ifdef __WXMSW__
53 #include <windows.h>
6aa55ce7 54 #include <wx/msw/private.h>
7be1f0d9 55
8826f46f
VZ
56 #if !defined(__WIN32__)
57 #include <print.h>
58 #include <commdlg.h>
59 #endif // Win16
60
61 #if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
62 #include <windowsx.h>
63 #include <commdlg.h>
64 #endif
65#endif // MSW
c801d85f
KB
66
67#if !USE_SHARED_LIBRARY
8826f46f
VZ
68 IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
69 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
70 IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
71 IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
72 IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
c801d85f
KB
73#endif
74
8826f46f
VZ
75// ============================================================================
76// implementation
77// ============================================================================
78
79// ----------------------------------------------------------------------------
80// wxColourData
81// ----------------------------------------------------------------------------
c801d85f 82
8bbe427f 83wxColourData::wxColourData()
c801d85f 84{
7bcb11d3
JS
85 int i;
86 for (i = 0; i < 16; i++)
87 custColours[i].Set(255, 255, 255);
8826f46f 88
7bcb11d3
JS
89 chooseFull = FALSE;
90 dataColour.Set(0,0,0);
91}
c801d85f 92
7bcb11d3
JS
93wxColourData::wxColourData(const wxColourData& data)
94{
95 (*this) = data;
8bbe427f 96}
c801d85f 97
8bbe427f 98wxColourData::~wxColourData()
c801d85f
KB
99{
100}
101
102void wxColourData::SetCustomColour(int i, wxColour& colour)
103{
7bcb11d3
JS
104 if (i > 15 || i < 0)
105 return;
8826f46f 106
7bcb11d3 107 custColours[i] = colour;
c801d85f
KB
108}
109
110wxColour wxColourData::GetCustomColour(int i)
111{
7bcb11d3
JS
112 if (i > 15 || i < 0)
113 return wxColour(0,0,0);
8826f46f 114
7bcb11d3 115 return custColours[i];
c801d85f
KB
116}
117
118void wxColourData::operator=(const wxColourData& data)
119{
7bcb11d3
JS
120 int i;
121 for (i = 0; i < 16; i++)
122 custColours[i] = data.custColours[i];
8826f46f 123
7bcb11d3
JS
124 dataColour = (wxColour&)data.dataColour;
125 chooseFull = data.chooseFull;
c801d85f
KB
126}
127
8826f46f
VZ
128// ----------------------------------------------------------------------------
129// Font data
130// ----------------------------------------------------------------------------
c801d85f 131
8bbe427f 132wxFontData::wxFontData()
c801d85f 133{
7bcb11d3
JS
134 // Intialize colour to black.
135 fontColour.Set(0, 0, 0);
8826f46f 136
7bcb11d3
JS
137 showHelp = FALSE;
138 allowSymbols = TRUE;
139 enableEffects = TRUE;
140 minSize = 0;
141 maxSize = 0;
142}
c801d85f 143
7bcb11d3
JS
144wxFontData::wxFontData(const wxFontData& data)
145{
146 (*this) = data;
c801d85f
KB
147}
148
8bbe427f 149wxFontData::~wxFontData()
c801d85f
KB
150{
151}
152
153void wxFontData::operator=(const wxFontData& data)
154{
7bcb11d3
JS
155 fontColour = data.fontColour;
156 showHelp = data.showHelp;
157 allowSymbols = data.allowSymbols;
158 enableEffects = data.enableEffects;
159 initialFont = data.initialFont;
160 chosenFont = data.chosenFont;
161 minSize = data.minSize;
162 maxSize = data.maxSize;
c801d85f
KB
163}
164
8826f46f
VZ
165// ----------------------------------------------------------------------------
166// Print data
167// ----------------------------------------------------------------------------
c801d85f 168
8bbe427f 169wxPrintData::wxPrintData()
c801d85f 170{
2049ba38 171#ifdef __WXMSW__
7bcb11d3 172 m_devMode = NULL;
c801d85f 173#endif
7bcb11d3
JS
174 m_printOrientation = wxPORTRAIT;
175 m_printNoCopies = 1;
176 m_printCollate = FALSE;
8826f46f 177
7bcb11d3
JS
178 // New, 24/3/99
179 m_printerName = "";
180 m_colour = TRUE;
181 m_duplexMode = wxDUPLEX_SIMPLEX;
182 m_printQuality = wxPRINT_QUALITY_HIGH;
183 m_paperId = wxPAPER_A4;
184 m_paperSize = wxSize(210, 297);
185
186 // PostScript-specific data
187 m_printerCommand = "";
188 m_previewCommand = "";
189 m_printerOptions = "";
190 m_filename = "";
191 m_afmPath = "";
192 m_printerScaleX = 1.0;
193 m_printerScaleY = 1.0;
194 m_printerTranslateX = 0;
195 m_printerTranslateY = 0;
196 m_printMode = wxPRINT_MODE_FILE;
197}
198
199wxPrintData::wxPrintData(const wxPrintData& printData)
200{
58abfef6
JS
201#ifdef __WXMSW__
202 m_devMode = NULL;
203#endif
204
7bcb11d3 205 (*this) = printData;
c801d85f
KB
206}
207
8bbe427f 208wxPrintData::~wxPrintData()
c801d85f 209{
2049ba38 210#ifdef __WXMSW__
348675e1 211 HGLOBAL hDevMode = (HGLOBAL) m_devMode;
7bcb11d3
JS
212 if (hDevMode )
213 GlobalFree(hDevMode);
c801d85f
KB
214#endif
215}
216
58a33cb4 217#if defined(__WXMSW__) && defined(__WIN32__)
7bcb11d3 218
6aa55ce7
JS
219static wxString wxGetPrintDlgError()
220{
221 DWORD err = CommDlgExtendedError();
222 wxString msg = "Unknown";
223 switch (err)
224 {
225 case CDERR_FINDRESFAILURE: msg = "CDERR_FINDRESFAILURE"; break;
226 case CDERR_INITIALIZATION: msg = "CDERR_INITIALIZATION"; break;
227 case CDERR_LOADRESFAILURE: msg = "CDERR_LOADRESFAILURE"; break;
228 case CDERR_LOADSTRFAILURE: msg = "CDERR_LOADSTRFAILURE"; break;
229 case CDERR_LOCKRESFAILURE: msg = "CDERR_LOCKRESFAILURE"; break;
230 case CDERR_MEMALLOCFAILURE: msg = "CDERR_MEMALLOCFAILURE"; break;
231 case CDERR_MEMLOCKFAILURE: msg = "CDERR_MEMLOCKFAILURE"; break;
232 case CDERR_NOHINSTANCE: msg = "CDERR_NOHINSTANCE"; break;
233 case CDERR_NOHOOK: msg = "CDERR_NOHOOK"; break;
234 case CDERR_NOTEMPLATE: msg = "CDERR_NOTEMPLATE"; break;
235 case CDERR_STRUCTSIZE: msg = "CDERR_STRUCTSIZE"; break;
236 case PDERR_RETDEFFAILURE: msg = "PDERR_RETDEFFAILURE"; break;
237 case PDERR_PRINTERNOTFOUND: msg = "PDERR_PRINTERNOTFOUND"; break;
238 case PDERR_PARSEFAILURE: msg = "PDERR_PARSEFAILURE"; break;
239 case PDERR_NODEVICES: msg = "PDERR_NODEVICES"; break;
240 case PDERR_NODEFAULTPRN: msg = "PDERR_NODEFAULTPRN"; break;
241 case PDERR_LOADDRVFAILURE: msg = "PDERR_LOADDRVFAILURE"; break;
242 case PDERR_INITFAILURE: msg = "PDERR_INITFAILURE"; break;
243 case PDERR_GETDEVMODEFAIL: msg = "PDERR_GETDEVMODEFAIL"; break;
244 case PDERR_DNDMMISMATCH: msg = "PDERR_DNDMMISMATCH"; break;
245 case PDERR_DEFAULTDIFFERENT: msg = "PDERR_DEFAULTDIFFERENT"; break;
246 case PDERR_CREATEICFAILURE: msg = "PDERR_CREATEICFAILURE"; break;
247 default: break;
248 }
249 return msg;
250}
251
252
253
8bbe427f 254void wxPrintData::ConvertToNative()
c801d85f 255{
7bcb11d3
JS
256 HGLOBAL hDevMode = (HGLOBAL) m_devMode;
257 if (!hDevMode)
c801d85f 258 {
7bcb11d3
JS
259 // Use PRINTDLG as a way of creating a DEVMODE object
260 PRINTDLG *pd = new PRINTDLG;
8826f46f 261
c801d85f 262 // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
7bcb11d3 263#ifdef __GNUWIN32__
6aa55ce7 264 memset(pd, 0, 66);
c801d85f 265 pd->lStructSize = 66 ;
7bcb11d3 266#else
7bcb11d3 267 memset(pd, 0, sizeof(PRINTDLG));
6aa55ce7 268 pd->lStructSize = sizeof(PRINTDLG);
7bcb11d3
JS
269#endif
270
c801d85f
KB
271 pd->hwndOwner = (HWND)NULL;
272 pd->hDevMode = NULL; // Will be created by PrintDlg
273 pd->hDevNames = NULL; // Ditto
6aa55ce7 274 pd->hInstance = (HINSTANCE) wxGetInstance();
8826f46f 275
c801d85f
KB
276 pd->Flags = PD_RETURNDEFAULT;
277 pd->nCopies = 1;
8826f46f 278
c801d85f
KB
279 // Fill out the DEVMODE structure
280 // so we can use it as input in the 'real' PrintDlg
281 if (!PrintDlg(pd))
282 {
283 if ( pd->hDevMode )
284 GlobalFree(pd->hDevMode);
285 if ( pd->hDevNames )
286 GlobalFree(pd->hDevNames);
287 pd->hDevMode = NULL;
288 pd->hDevNames = NULL;
58a33cb4
JS
289
290#if defined(__WXDEBUG__) && defined(__WIN32__)
6aa55ce7
JS
291 wxString str("Printing error: ");
292 str += wxGetPrintDlgError();
293 wxLogDebug(str);
294#endif
c801d85f
KB
295 }
296 else
297 {
298 if ( pd->hDevNames )
299 GlobalFree(pd->hDevNames);
300 pd->hDevNames = NULL;
7bcb11d3
JS
301
302 hDevMode = pd->hDevMode;
303 m_devMode = (void*) hDevMode;
304 pd->hDevMode = NULL;
c801d85f 305 }
c801d85f 306
7bcb11d3
JS
307 delete pd;
308 }
8826f46f 309
7bcb11d3 310 if ( hDevMode )
c801d85f 311 {
7bcb11d3 312 DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
8826f46f 313
7bcb11d3 314 //// Orientation
8826f46f 315
7bcb11d3 316 devMode->dmOrientation = m_printOrientation;
c801d85f 317 devMode->dmFields = DM_ORIENTATION;
8826f46f 318
7bcb11d3 319 //// Collation
8826f46f 320
7bcb11d3
JS
321 devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
322 devMode->dmFields |= DM_COLLATE;
8826f46f 323
7bcb11d3 324 //// Number of copies
8826f46f 325
7bcb11d3
JS
326 devMode->dmCopies = m_printNoCopies;
327 devMode->dmFields |= DM_COPIES;
8826f46f 328
7bcb11d3 329 //// Printer name
8826f46f 330
7bcb11d3
JS
331 if (m_printerName != "")
332 {
333 // TODO: make this Unicode compatible
334 int len = wxMin(31, m_printerName.Len());
335 int i;
336 for (i = 0; i < len; i++)
337 devMode->dmDeviceName[i] = m_printerName.GetChar(i);
338 devMode->dmDeviceName[i] = 0;
339 }
8826f46f 340
7bcb11d3 341 //// Colour
8826f46f 342
7bcb11d3
JS
343 if (m_colour)
344 devMode->dmColor = DMCOLOR_COLOR;
345 else
346 devMode->dmColor = DMCOLOR_MONOCHROME;
8826f46f 347
7bcb11d3 348 devMode->dmFields |= DM_COLOR;
8826f46f 349
7bcb11d3 350 //// Paper size
8826f46f 351
7bcb11d3
JS
352 if (m_paperId == wxPAPER_NONE)
353 {
354 devMode->dmPaperWidth = m_paperSize.x * 10;
355 devMode->dmPaperLength = m_paperSize.y * 10;
356 devMode->dmFields |= DM_PAPERWIDTH;
357 devMode->dmFields |= DM_PAPERLENGTH;
358 }
359 else
360 {
361 if (wxThePrintPaperDatabase)
362 {
363 wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType(m_paperId);
364 if (paper)
365 {
366 devMode->dmPaperSize = paper->GetPlatformId();
367 devMode->dmFields |= DM_PAPERSIZE;
368 }
369 }
370 }
8826f46f 371
7bcb11d3 372 //// Duplex
8826f46f 373
7bcb11d3
JS
374 int duplex;
375 switch (m_duplexMode)
376 {
377 case wxDUPLEX_HORIZONTAL: {
378 duplex = DMDUP_HORIZONTAL; break;
379 }
380 case wxDUPLEX_VERTICAL: {
381 duplex = DMDUP_VERTICAL; break;
382 }
383 default:
384 case wxDUPLEX_SIMPLEX: {
385 duplex = DMDUP_SIMPLEX; break;
386 }
387 }
388 devMode->dmDuplex = duplex;
389 devMode->dmFields |= DM_DUPLEX;
8826f46f 390
7bcb11d3 391 //// Quality
8826f46f 392
7bcb11d3
JS
393 int quality;
394 switch (m_printQuality)
395 {
396 case wxPRINT_QUALITY_MEDIUM: {
397 quality = DMRES_MEDIUM; break;
398 }
399 case wxPRINT_QUALITY_LOW: {
400 quality = DMRES_LOW; break;
401 }
402 case wxPRINT_QUALITY_DRAFT: {
403 quality = DMRES_DRAFT; break;
404 }
405 case wxPRINT_QUALITY_HIGH: {
406 quality = DMRES_HIGH; break;
407 }
408 default: {
409 quality = m_printQuality; break;
410 }
411 }
412 devMode->dmPrintQuality = quality;
413 devMode->dmFields |= DM_PRINTQUALITY;
8826f46f 414
7bcb11d3 415 GlobalUnlock(hDevMode);
c801d85f 416 }
7bcb11d3
JS
417}
418
419void wxPrintData::ConvertFromNative()
420{
421 HGLOBAL hDevMode = (HGLOBAL) m_devMode;
422
423 if (!hDevMode)
424 return;
425
426 if ( hDevMode )
427 {
428 DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
8826f46f 429
7bcb11d3 430 //// Orientation
8826f46f 431
7bcb11d3
JS
432 if (devMode->dmFields & DM_ORIENTATION)
433 m_printOrientation = devMode->dmOrientation;
8826f46f 434
7bcb11d3 435 //// Collation
8826f46f 436
7bcb11d3
JS
437 if (devMode->dmFields & DM_COLLATE)
438 {
439 if (devMode->dmCollate == DMCOLLATE_TRUE)
440 m_printCollate = TRUE;
441 else
442 m_printCollate = FALSE;
443 }
8826f46f 444
7bcb11d3 445 //// Number of copies
8826f46f 446
7bcb11d3
JS
447 if (devMode->dmFields & DM_COPIES)
448 {
449 m_printNoCopies = devMode->dmCopies;
450 }
8826f46f 451
7bcb11d3 452 //// Printer name
8826f46f 453
7bcb11d3
JS
454 if (devMode->dmDeviceName[0] != 0)
455 {
456 // TODO: make this Unicode compatible
457 char buf[32];
458 int i = 0;
459 while (devMode->dmDeviceName[i] != 0)
460 {
461 buf[i] = devMode->dmDeviceName[i];
462 i ++;
463 }
464 buf[i] = 0;
8826f46f 465
7bcb11d3
JS
466 m_printerName = buf;
467 }
8826f46f 468
7bcb11d3 469 //// Colour
8826f46f 470
7bcb11d3
JS
471 if (devMode->dmFields & DM_COLOR)
472 {
473 if (devMode->dmColor == DMCOLOR_COLOR)
474 m_colour = TRUE;
475 else
476 m_colour = FALSE;
477 }
478 else
479 m_colour = TRUE;
8826f46f 480
7bcb11d3 481 //// Paper size
8826f46f 482
7bcb11d3
JS
483 if (devMode->dmFields & DM_PAPERSIZE)
484 {
485 if (wxThePrintPaperDatabase)
486 {
487 wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperTypeByPlatformId(devMode->dmPaperSize);
488 if (paper)
489 {
490 m_paperId = paper->GetId();
491 m_paperSize.x = paper->GetWidth() / 10 ;
492 m_paperSize.y = paper->GetHeight() / 10 ;
493 }
494 else
495 {
496 // Shouldn't really get here
497 wxFAIL_MSG("Couldn't find paper size in paper database.");
8826f46f 498
7bcb11d3
JS
499 m_paperId = wxPAPER_NONE;
500 m_paperSize.x = 0;
501 m_paperSize.y = 0;
502 }
503 }
504 else
505 {
506 // Shouldn't really get here
507 wxFAIL_MSG("Paper database wasn't initialized in wxPrintData::ConvertFromNative.");
8826f46f 508
7bcb11d3
JS
509 m_paperId = wxPAPER_NONE;
510 m_paperSize.x = 0;
511 m_paperSize.y = 0;
512 }
513 }
514 else if ((devMode->dmFields & DM_PAPERWIDTH) && (devMode->dmFields & DM_PAPERLENGTH))
515 {
516 m_paperSize.x = devMode->dmPaperWidth / 10;
517 m_paperSize.y = devMode->dmPaperLength / 10;
518 m_paperId = wxPAPER_NONE;
519 }
520 else
521 {
522 // Shouldn't really get here
523 wxFAIL_MSG("Couldn't find paper size from DEVMODE.");
8826f46f 524
7bcb11d3
JS
525 m_paperSize.x = 0;
526 m_paperSize.y = 0;
527 m_paperId = wxPAPER_NONE;
528 }
8826f46f
VZ
529
530
7bcb11d3 531 //// Duplex
8826f46f 532
7bcb11d3
JS
533 if (devMode->dmFields & DM_DUPLEX)
534 {
535 switch (devMode->dmDuplex)
536 {
537 case DMDUP_HORIZONTAL: {
538 m_duplexMode = wxDUPLEX_HORIZONTAL; break;
539 }
540 case DMDUP_VERTICAL: {
541 m_duplexMode = wxDUPLEX_VERTICAL; break;
542 }
543 default:
544 case DMDUP_SIMPLEX: {
545 m_duplexMode = wxDUPLEX_SIMPLEX; break;
546 }
547 }
548 }
549 else
550 m_duplexMode = wxDUPLEX_SIMPLEX;
8826f46f 551
7bcb11d3 552 //// Quality
8826f46f 553
7bcb11d3
JS
554 if (devMode->dmFields & DM_PRINTQUALITY)
555 {
556 switch (devMode->dmPrintQuality)
557 {
558 case DMRES_MEDIUM: {
559 m_printQuality = wxPRINT_QUALITY_MEDIUM; break;
560 }
561 case DMRES_LOW: {
562 m_printQuality = wxPRINT_QUALITY_LOW; break;
563 }
564 case DMRES_DRAFT: {
565 m_printQuality = wxPRINT_QUALITY_DRAFT; break;
566 }
567 case DMRES_HIGH: {
568 m_printQuality = wxPRINT_QUALITY_HIGH; break;
569 }
570 default:
571 {
572 // TODO: if the printer fills in the resolution in DPI, how
573 // will the application know if it's high, low, draft etc.??
574 // wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
575 m_printQuality = devMode->dmPrintQuality; break;
8826f46f 576
7bcb11d3
JS
577 }
578 }
579 }
580 else
581 m_printQuality = wxPRINT_QUALITY_HIGH;
8826f46f 582
7bcb11d3
JS
583 GlobalUnlock(hDevMode);
584 }
585}
c801d85f 586
7bcb11d3
JS
587#endif
588
589void wxPrintData::operator=(const wxPrintData& data)
590{
591 m_printNoCopies = data.m_printNoCopies;
592 m_printCollate = data.m_printCollate;
593 m_printOrientation = data.m_printOrientation;
594 m_printerName = data.m_printerName;
595 m_colour = data.m_colour;
596 m_duplexMode = data.m_duplexMode;
597 m_printQuality = data.m_printQuality;
598 m_paperId = data.m_paperId;
599 m_paperSize = data.m_paperSize;
600
601 // PostScript-specific data
602 m_printerCommand = data.m_printerCommand;
603 m_previewCommand = data.m_previewCommand;
604 m_printerOptions = data.m_printerOptions;
605 m_filename = data.m_filename;
606 m_afmPath = data.m_afmPath;
607 m_printerScaleX = data.m_printerScaleX;
608 m_printerScaleY = data.m_printerScaleY;
609 m_printerTranslateX = data.m_printerTranslateX;
610 m_printerTranslateY = data.m_printerTranslateY;
611 m_printMode = data.m_printMode;
612}
613
614// For compatibility
8826f46f 615#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
7bcb11d3
JS
616void wxPrintData::operator=(const wxPrintSetupData& setupData)
617{
618 SetPrinterCommand(setupData.GetPrinterCommand());
619 SetPreviewCommand(setupData.GetPrintPreviewCommand());
620 SetPrinterOptions(setupData.GetPrinterOptions());
621
622 long xt, yt;
623 setupData.GetPrinterTranslation(& xt, & yt);
624 SetPrinterTranslation(xt, yt);
625
626 double xs, ys;
627 setupData.GetPrinterScaling(& xs, & ys);
628 SetPrinterScaling(xs, ys);
629
630 SetOrientation(setupData.GetPrinterOrientation());
631 SetPrintMode((wxPrintMode) setupData.GetPrinterMode());
632 SetFontMetricPath(setupData.GetAFMPath());
633 if (setupData.GetPaperName() != "")
634 SetPaperId(wxThePrintPaperDatabase->ConvertNameToId(setupData.GetPaperName()));
635 SetColour(setupData.GetColour());
636 SetFilename(setupData.GetPrinterFile());
637}
8826f46f 638#endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
7bcb11d3 639
8826f46f
VZ
640
641// ----------------------------------------------------------------------------
642// Print dialog data
643// ----------------------------------------------------------------------------
7bcb11d3
JS
644
645wxPrintDialogData::wxPrintDialogData()
646{
647#ifdef __WXMSW__
648 m_printDlgData = NULL;
649#endif
650 m_printFromPage = 0;
651 m_printToPage = 0;
652 m_printMinPage = 0;
653 m_printMaxPage = 0;
654 m_printNoCopies = 1;
655 m_printAllPages = FALSE;
656 m_printCollate = FALSE;
657 m_printToFile = FALSE;
658 m_printEnableSelection = FALSE;
659 m_printEnablePageNumbers = TRUE;
660 m_printEnablePrintToFile = TRUE;
661 m_printEnableHelp = FALSE;
662 m_printSetupDialog = FALSE;
663}
664
665wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
666{
667 (*this) = dialogData;
668}
669
670wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData)
671{
672#ifdef __WXMSW__
673 m_printDlgData = NULL;
674#endif
675 m_printFromPage = 0;
676 m_printToPage = 0;
677 m_printMinPage = 0;
678 m_printMaxPage = 0;
679 m_printNoCopies = 1;
680 m_printAllPages = FALSE;
681 m_printCollate = FALSE;
682 m_printToFile = FALSE;
683 m_printEnableSelection = FALSE;
684 m_printEnablePageNumbers = TRUE;
685 m_printEnablePrintToFile = TRUE;
686 m_printEnableHelp = FALSE;
687 m_printSetupDialog = FALSE;
688
689 m_printData = printData;
690}
691
692wxPrintDialogData::~wxPrintDialogData()
693{
694#ifdef __WXMSW__
695 PRINTDLG *pd = (PRINTDLG *) m_printDlgData;
696 if ( pd && pd->hDevMode )
697 GlobalFree(pd->hDevMode);
698 if ( pd )
699 delete pd;
700#endif
701}
702
703#ifdef __WXMSW__
704void wxPrintDialogData::ConvertToNative()
705{
706 m_printData.ConvertToNative();
707
708 PRINTDLG *pd = (PRINTDLG*) m_printDlgData;
709
710 if (!pd)
711 {
712 pd = new PRINTDLG;
713 m_printDlgData = (void*) pd;
714
715 // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
716#ifdef __GNUWIN32__
717 pd->lStructSize = 66 ;
718#else
719#endif
720 pd->lStructSize = sizeof(PRINTDLG);
721 pd->hwndOwner = (HWND)NULL;
722 pd->hDevMode = NULL; // Will be created by PrintDlg
723 pd->hDevNames = NULL; // Ditto
724
725 pd->Flags = PD_RETURNDEFAULT;
726 pd->nCopies = 1;
727 }
728
729 // Pass the devmode data to the PRINTDLG structure, since it'll
730 // be needed when PrintDlg is called.
731 if (pd->hDevMode)
732 {
733 GlobalFree(pd->hDevMode);
734 }
735
736 pd->hDevMode = (HGLOBAL) m_printData.GetNativeData();
737
738 m_printData.SetNativeData((void*) NULL);
739
740 wxASSERT_MSG( (pd->hDevMode), "hDevMode must be non-NULL in ConvertToNative!");
741
742 pd->hDC = (HDC) NULL;
743 pd->nFromPage = (UINT)m_printFromPage;
744 pd->nToPage = (UINT)m_printToPage;
745 pd->nMinPage = (UINT)m_printMinPage;
746 pd->nMaxPage = (UINT)m_printMaxPage;
747 pd->nCopies = (UINT)m_printNoCopies;
8826f46f 748
c801d85f 749 pd->Flags = PD_RETURNDC ;
7bcb11d3
JS
750
751#ifdef __GNUWIN32__
c801d85f 752 pd->lStructSize = 66 ;
7bcb11d3
JS
753#else
754 pd->lStructSize = sizeof( PRINTDLG );
755#endif
756
8b9518ee 757 pd->hwndOwner=(HWND)NULL;
c801d85f
KB
758 pd->hDevNames=(HANDLE)NULL;
759 pd->hInstance=(HINSTANCE)NULL;
760 pd->lCustData = (LPARAM) NULL;
761 pd->lpfnPrintHook = NULL;
762 pd->lpfnSetupHook = NULL;
763 pd->lpPrintTemplateName = NULL;
764 pd->lpSetupTemplateName = NULL;
765 pd->hPrintTemplate = (HGLOBAL) NULL;
766 pd->hSetupTemplate = (HGLOBAL) NULL;
8826f46f 767
7bcb11d3 768 if ( m_printAllPages )
c801d85f 769 pd->Flags |= PD_ALLPAGES;
7bcb11d3 770 if ( m_printCollate )
c801d85f 771 pd->Flags |= PD_COLLATE;
7bcb11d3 772 if ( m_printToFile )
c801d85f 773 pd->Flags |= PD_PRINTTOFILE;
7bcb11d3 774 if ( !m_printEnablePrintToFile )
c801d85f 775 pd->Flags |= PD_DISABLEPRINTTOFILE;
7bcb11d3
JS
776 if ( !m_printEnableSelection )
777 pd->Flags |= PD_NOSELECTION;
778 if ( !m_printEnablePageNumbers )
779 pd->Flags |= PD_NOPAGENUMS;
780 if ( m_printEnableHelp )
781 pd->Flags |= PD_SHOWHELP;
782 if ( m_printSetupDialog )
783 pd->Flags |= PD_PRINTSETUP;
c801d85f
KB
784}
785
7bcb11d3 786void wxPrintDialogData::ConvertFromNative()
c801d85f 787{
7bcb11d3 788 PRINTDLG *pd = (PRINTDLG*) m_printDlgData;
c801d85f
KB
789 if ( pd == NULL )
790 return;
791
7bcb11d3
JS
792 // Pass the devmode data back to the wxPrintData structure where it really belongs.
793 if (pd->hDevMode)
c801d85f 794 {
7bcb11d3
JS
795 if (m_printData.GetNativeData())
796 {
797 // Make sure we don't leak memory
798 GlobalFree((HGLOBAL) m_printData.GetNativeData());
799 }
800 m_printData.SetNativeData((void*) pd->hDevMode);
801 pd->hDevMode = NULL;
c801d85f 802 }
c801d85f 803
7bcb11d3
JS
804 // Now convert the DEVMODE object, passed down from the PRINTDLG object,
805 // into wxWindows form.
806 m_printData.ConvertFromNative();
807
808 m_printFromPage = pd->nFromPage ;
809 m_printToPage = pd->nToPage ;
810 m_printMinPage = pd->nMinPage ;
811 m_printMaxPage = pd->nMaxPage ;
812 m_printNoCopies = pd->nCopies ;
8826f46f 813
7bcb11d3
JS
814 m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
815 m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
816 m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
817 m_printEnablePrintToFile = ((pd->Flags & PD_DISABLEPRINTTOFILE) != PD_DISABLEPRINTTOFILE);
818 m_printEnableSelection = ((pd->Flags & PD_NOSELECTION) != PD_NOSELECTION);
819 m_printEnablePageNumbers = ((pd->Flags & PD_NOPAGENUMS) != PD_NOPAGENUMS);
820 m_printEnableHelp = ((pd->Flags & PD_SHOWHELP) == PD_SHOWHELP);
821 m_printSetupDialog = ((pd->Flags & PD_PRINTSETUP) == PD_PRINTSETUP);
822
823/* port is obsolete in WIN32
824 // Get the port name
825 if (pd->hDevNames)
826 {
827 LPDEVNAMES lpDevNames = (LPDEVNAMES)GlobalLock(pd->hDevNames);
828 if (lpDevNames) {
829 m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
830 wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
831 GlobalUnlock(pd->hDevNames);
8826f46f 832
7bcb11d3
JS
833// wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
834 }
835 }
836*/
c801d85f
KB
837}
838
7bcb11d3 839void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
c801d85f 840{
7bcb11d3 841 if ( m_printDlgData == NULL )
c801d85f 842 ConvertToNative();
8826f46f 843
7bcb11d3 844 if ( m_printDlgData != NULL && win != NULL)
c801d85f 845 {
7bcb11d3
JS
846 PRINTDLG *pd = (PRINTDLG *) m_printDlgData ;
847 pd->hwndOwner=(HWND) win->GetHWND();
c801d85f
KB
848 }
849}
8826f46f 850#endif // MSW
c801d85f 851
7bcb11d3 852void wxPrintDialogData::operator=(const wxPrintDialogData& data)
c801d85f 853{
7bcb11d3
JS
854 m_printFromPage = data.m_printFromPage;
855 m_printToPage = data.m_printToPage;
856 m_printMinPage = data.m_printMinPage;
857 m_printMaxPage = data.m_printMaxPage;
858 m_printNoCopies = data.m_printNoCopies;
859 m_printAllPages = data.m_printAllPages;
860 m_printCollate = data.m_printCollate;
861 m_printToFile = data.m_printToFile;
862 m_printEnableSelection = data.m_printEnableSelection;
863 m_printEnablePageNumbers = data.m_printEnablePageNumbers;
864 m_printEnableHelp = data.m_printEnableHelp;
865 m_printEnablePrintToFile = data.m_printEnablePrintToFile;
866 m_printSetupDialog = data.m_printSetupDialog;
867
868 m_printData = data.m_printData;
869}
870
871void wxPrintDialogData::operator=(const wxPrintData& data)
872{
873 m_printData = data;
c801d85f
KB
874}
875
8826f46f
VZ
876// ----------------------------------------------------------------------------
877// wxPageSetupDialogData
878// ----------------------------------------------------------------------------
c801d85f 879
7bcb11d3 880wxPageSetupDialogData::wxPageSetupDialogData()
c801d85f
KB
881{
882#if defined(__WIN95__)
7bcb11d3 883 m_pageSetupData = NULL;
c801d85f 884#endif
7bcb11d3
JS
885 m_paperSize = wxSize(0, 0);
886
887 CalculatePaperSizeFromId();
888
889 m_minMarginTopLeft = wxPoint(0, 0);
890 m_minMarginBottomRight = wxPoint(0, 0);
891 m_marginTopLeft = wxPoint(0, 0);
892 m_marginBottomRight = wxPoint(0, 0);
893
894 // Flags
895 m_defaultMinMargins = FALSE;
896 m_enableMargins = TRUE;
897 m_enableOrientation = TRUE;
898 m_enablePaper = TRUE;
899 m_enablePrinter = TRUE;
900 m_enableHelp = FALSE;
901 m_getDefaultInfo = FALSE;
902}
c801d85f 903
7bcb11d3
JS
904wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
905{
906 (*this) = dialogData;
907}
908
909wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
910{
911#if defined(__WIN95__)
912 m_pageSetupData = NULL;
913#endif
914 m_paperSize = wxSize(0, 0);
915 m_minMarginTopLeft = wxPoint(0, 0);
916 m_minMarginBottomRight = wxPoint(0, 0);
917 m_marginTopLeft = wxPoint(0, 0);
918 m_marginBottomRight = wxPoint(0, 0);
919
920 // Flags
921 m_defaultMinMargins = FALSE;
922 m_enableMargins = TRUE;
923 m_enableOrientation = TRUE;
924 m_enablePaper = TRUE;
925 m_enablePrinter = TRUE;
926 m_enableHelp = FALSE;
927 m_getDefaultInfo = FALSE;
928
929 m_printData = printData;
930
931 // The wxPrintData paper size overrides these values, unless the size cannot
932 // be found.
933 CalculatePaperSizeFromId();
c801d85f
KB
934}
935
7bcb11d3 936wxPageSetupDialogData::~wxPageSetupDialogData()
c801d85f 937{
34138703 938#if defined(__WIN95__) && defined(__WXMSW__)
c801d85f
KB
939 PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageSetupData;
940 if ( pd && pd->hDevMode )
941 GlobalFree(pd->hDevMode);
942 if ( pd )
943 delete pd;
944#endif
945}
946
7bcb11d3 947void wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data)
c801d85f 948{
7bcb11d3
JS
949 m_paperSize = data.m_paperSize;
950 m_minMarginTopLeft = data.m_minMarginTopLeft;
951 m_minMarginBottomRight = data.m_minMarginBottomRight;
952 m_marginTopLeft = data.m_marginTopLeft;
953 m_marginBottomRight = data.m_marginBottomRight;
954 m_defaultMinMargins = data.m_defaultMinMargins;
955 m_enableMargins = data.m_enableMargins;
956 m_enableOrientation = data.m_enableOrientation;
957 m_enablePaper = data.m_enablePaper;
958 m_enablePrinter = data.m_enablePrinter;
959 m_getDefaultInfo = data.m_getDefaultInfo;;
960 m_enableHelp = data.m_enableHelp;
961
962 m_printData = data.m_printData;
963}
c801d85f 964
7bcb11d3
JS
965void wxPageSetupDialogData::operator=(const wxPrintData& data)
966{
967 m_printData = data;
c801d85f
KB
968}
969
8826f46f 970#if defined(__WIN95__)
7bcb11d3 971void wxPageSetupDialogData::ConvertToNative()
c801d85f 972{
7bcb11d3
JS
973 m_printData.ConvertToNative();
974
c801d85f 975 PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageSetupData;
7bcb11d3 976
c801d85f
KB
977 if ( m_pageSetupData == NULL )
978 {
7bcb11d3
JS
979 pd = new PAGESETUPDLG;
980 pd->hDevMode = NULL;
981 m_pageSetupData = (void *)pd;
c801d85f 982 }
8bbe427f 983
7bcb11d3
JS
984 // Pass the devmode data (created in m_printData.ConvertToNative)
985 // to the PRINTDLG structure, since it'll
986 // be needed when PrintDlg is called.
987
988 if (pd->hDevMode)
989 {
990 GlobalFree(pd->hDevMode);
991 pd->hDevMode = NULL;
992 }
993
994
995 pd->hDevMode = (HGLOBAL) m_printData.GetNativeData();
996
997 m_printData.SetNativeData((void*) NULL);
998
999 wxASSERT_MSG( (pd->hDevMode), "hDevMode must be non-NULL in ConvertToNative!");
1000
1001// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
c801d85f 1002
7bcb11d3 1003 pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
8826f46f 1004
c801d85f
KB
1005 if ( m_defaultMinMargins )
1006 pd->Flags |= PSD_DEFAULTMINMARGINS;
1007 if ( !m_enableMargins )
1008 pd->Flags |= PSD_DISABLEMARGINS;
1009 if ( !m_enableOrientation )
1010 pd->Flags |= PSD_DISABLEORIENTATION;
1011 if ( !m_enablePaper )
1012 pd->Flags |= PSD_DISABLEPAPER;
1013 if ( !m_enablePrinter )
1014 pd->Flags |= PSD_DISABLEPRINTER;
1015 if ( m_getDefaultInfo )
1016 pd->Flags |= PSD_RETURNDEFAULT;
1017 if ( m_enableHelp )
1018 pd->Flags |= PSD_SHOWHELP;
1019
7bcb11d3
JS
1020 // We want the units to be in hundredths of a millimetre
1021 pd->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
1022
c801d85f 1023 pd->lStructSize = sizeof( PAGESETUPDLG );
c4e7c2aa 1024 pd->hwndOwner=(HWND)NULL;
c801d85f
KB
1025 pd->hDevNames=(HWND)NULL;
1026 pd->hInstance=(HINSTANCE)NULL;
8826f46f 1027
7bcb11d3
JS
1028 pd->ptPaperSize.x = m_paperSize.x * 100;
1029 pd->ptPaperSize.y = m_paperSize.y * 100;
8826f46f 1030
7bcb11d3
JS
1031 pd->rtMinMargin.left = m_minMarginTopLeft.x * 100;
1032 pd->rtMinMargin.top = m_minMarginTopLeft.y * 100;
1033 pd->rtMinMargin.right = m_minMarginBottomRight.x * 100;
1034 pd->rtMinMargin.bottom = m_minMarginBottomRight.y * 100;
8826f46f 1035
7bcb11d3
JS
1036 pd->rtMargin.left = m_marginTopLeft.x * 100;
1037 pd->rtMargin.top = m_marginTopLeft.y * 100;
1038 pd->rtMargin.right = m_marginBottomRight.x * 100;
1039 pd->rtMargin.bottom = m_marginBottomRight.y * 100;
8826f46f 1040
c801d85f
KB
1041 pd->lCustData = 0;
1042 pd->lpfnPageSetupHook = NULL;
1043 pd->lpfnPagePaintHook = NULL;
1044 pd->hPageSetupTemplate = NULL;
1045 pd->lpPageSetupTemplateName = NULL;
1046
8826f46f 1047/*
c801d85f
KB
1048 if ( pd->hDevMode )
1049 {
1050 DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
1051 memset(devMode, 0, sizeof(DEVMODE));
1052 devMode->dmSize = sizeof(DEVMODE);
1053 devMode->dmOrientation = m_orientation;
1054 devMode->dmFields = DM_ORIENTATION;
1055 GlobalUnlock(pd->hDevMode);
1056 }
7bcb11d3 1057*/
c801d85f
KB
1058}
1059
7bcb11d3 1060void wxPageSetupDialogData::ConvertFromNative()
c801d85f
KB
1061{
1062 PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
1063 if ( !pd )
1064 return;
8826f46f 1065
7bcb11d3
JS
1066 // Pass the devmode data back to the wxPrintData structure where it really belongs.
1067 if (pd->hDevMode)
1068 {
1069 if (m_printData.GetNativeData())
1070 {
1071 // Make sure we don't leak memory
1072 GlobalFree((HGLOBAL) m_printData.GetNativeData());
1073 }
1074 m_printData.SetNativeData((void*) pd->hDevMode);
1075 pd->hDevMode = NULL;
1076 }
c801d85f 1077
7bcb11d3 1078 m_printData.ConvertFromNative();
c801d85f 1079
7bcb11d3 1080 pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
8826f46f 1081
c801d85f
KB
1082 m_defaultMinMargins = ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS);
1083 m_enableMargins = ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS);
1084 m_enableOrientation = ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION);
1085 m_enablePaper = ((pd->Flags & PSD_DISABLEPAPER) != PSD_DISABLEPAPER);
1086 m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
1087 m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
1088 m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
8826f46f 1089
7bcb11d3
JS
1090 m_paperSize.x = pd->ptPaperSize.x / 100;
1091 m_paperSize.y = pd->ptPaperSize.y / 100;
8826f46f 1092
7bcb11d3
JS
1093 m_minMarginTopLeft.x = pd->rtMinMargin.left / 100;
1094 m_minMarginTopLeft.y = pd->rtMinMargin.top / 100;
1095 m_minMarginBottomRight.x = pd->rtMinMargin.right / 100;
1096 m_minMarginBottomRight.y = pd->rtMinMargin.bottom / 100;
8826f46f 1097
7bcb11d3
JS
1098 m_marginTopLeft.x = pd->rtMargin.left / 100 ;
1099 m_marginTopLeft.y = pd->rtMargin.top / 100 ;
1100 m_marginBottomRight.x = pd->rtMargin.right / 100 ;
1101 m_marginBottomRight.y = pd->rtMargin.bottom / 100 ;
1102}
c801d85f 1103
7bcb11d3
JS
1104void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
1105{
1106 if ( m_pageSetupData == NULL )
1107 ConvertToNative();
8826f46f 1108
7bcb11d3
JS
1109 if ( m_pageSetupData != NULL && win != NULL)
1110 {
1111 PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
1112 pd->hwndOwner=(HWND) win->GetHWND();
1113 }
1114}
8826f46f 1115#endif // Win95
c801d85f 1116
7bcb11d3
JS
1117// If a corresponding paper type is found in the paper database, will set the m_printData
1118// paper size id member as well.
1119void wxPageSetupDialogData::SetPaperSize(const wxSize& sz)
1120{
1121 m_paperSize = sz;
c801d85f 1122
7bcb11d3
JS
1123 CalculateIdFromPaperSize();
1124}
c801d85f 1125
7bcb11d3
JS
1126// Sets the wxPrintData id, plus the paper width/height if found in the paper database.
1127void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
1128{
1129 m_printData.SetPaperId(id);
1130
1131 CalculatePaperSizeFromId();
c801d85f
KB
1132}
1133
7bcb11d3
JS
1134// Use paper size defined in this object to set the wxPrintData
1135// paper id
1136void wxPageSetupDialogData::CalculateIdFromPaperSize()
c801d85f 1137{
8826f46f 1138 wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
50920146
OK
1139 _T("wxThePrintPaperDatabase should not be NULL. "
1140 "Do not create global print dialog data objects.") );
c801d85f 1141
7bcb11d3
JS
1142 wxSize sz = GetPaperSize();
1143
1144 wxPaperSize id = wxThePrintPaperDatabase->GetSize(wxSize(sz.x* 10, sz.y * 10));
1145 if (id != wxPAPER_NONE)
c801d85f 1146 {
7bcb11d3 1147 m_printData.SetPaperId(id);
c801d85f
KB
1148 }
1149}
8826f46f 1150
7bcb11d3
JS
1151// Use paper id in wxPrintData to set this object's paper size
1152void wxPageSetupDialogData::CalculatePaperSizeFromId()
1153{
8826f46f 1154 wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
50920146
OK
1155 _T("wxThePrintPaperDatabase should not be NULL. "
1156 "Do not create global print dialog data objects.") );
7bcb11d3
JS
1157
1158 wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
c801d85f 1159
7bcb11d3
JS
1160 if (sz.x != 0)
1161 {
1162 // sz is in 10ths of a mm, so multiply by 10.
1163 m_paperSize.x = sz.x * 10;
1164 m_paperSize.y = sz.y * 10;
1165 }
1166}
8826f46f 1167