]> git.saurik.com Git - wxWidgets.git/commitdiff
more backwards compatibility
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 29 Mar 1999 16:43:40 +0000 (16:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 29 Mar 1999 16:43:40 +0000 (16:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cmndata.cpp
src/common/prntbase.cpp
src/generic/dcpsg.cpp
src/generic/printps.cpp
src/generic/prntdlgg.cpp

index 08bd0fa4de9751f78c4495a059efa9c1b31c03d2..14f157d3fe25e71e0ad00f68f2f63eba211b9d2f 100644 (file)
@@ -9,66 +9,82 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
 #ifdef __GNUG__
 #ifdef __GNUG__
-#pragma implementation "cmndata.h"
+    #pragma implementation "cmndata.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/string.h"
-#include "wx/utils.h"
-#include "wx/app.h"
+    #include <stdio.h>
+    #include "wx/string.h"
+    #include "wx/utils.h"
+    #include "wx/app.h"
 #endif
 
 #include "wx/gdicmn.h"
 #include "wx/cmndata.h"
 #endif
 
 #include "wx/gdicmn.h"
 #include "wx/cmndata.h"
+
 #include "wx/paper.h"
 
 // For compatibility
 #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
 #include "wx/paper.h"
 
 // For compatibility
 #if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
-#include "wx/generic/dcpsg.h"
+    #define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
 #endif
 
 #endif
 
-#ifdef __WXMSW__
-#include <windows.h>
-
-#if !defined(__WIN32__)
-#include <print.h>
-#include <commdlg.h>
+#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
+    #include "wx/generic/dcpsg.h"
 #endif
 
 #endif
 
-#if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
-#include <windowsx.h>
-#include <commdlg.h>
-#endif
+#ifdef __WXMSW__
+    #include <windows.h>
 
 
-#endif
+    #if !defined(__WIN32__)
+        #include <print.h>
+        #include <commdlg.h>
+    #endif // Win16
+
+    #if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
+        #include <windowsx.h>
+        #include <commdlg.h>
+    #endif
+#endif // MSW
 
 #if !USE_SHARED_LIBRARY
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
 #endif
 
 #endif
 
-/*
-* wxColourData
-*/
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxColourData
+// ----------------------------------------------------------------------------
 
 wxColourData::wxColourData()
 {
     int i;
     for (i = 0; i < 16; i++)
         custColours[i].Set(255, 255, 255);
 
 wxColourData::wxColourData()
 {
     int i;
     for (i = 0; i < 16; i++)
         custColours[i].Set(255, 255, 255);
-    
+
     chooseFull = FALSE;
     dataColour.Set(0,0,0);
 }
     chooseFull = FALSE;
     dataColour.Set(0,0,0);
 }
@@ -86,7 +102,7 @@ void wxColourData::SetCustomColour(int i, wxColour& colour)
 {
     if (i > 15 || i < 0)
         return;
 {
     if (i > 15 || i < 0)
         return;
-    
+
     custColours[i] = colour;
 }
 
     custColours[i] = colour;
 }
 
@@ -94,7 +110,7 @@ wxColour wxColourData::GetCustomColour(int i)
 {
     if (i > 15 || i < 0)
         return wxColour(0,0,0);
 {
     if (i > 15 || i < 0)
         return wxColour(0,0,0);
-    
+
     return custColours[i];
 }
 
     return custColours[i];
 }
 
@@ -103,20 +119,20 @@ void wxColourData::operator=(const wxColourData& data)
     int i;
     for (i = 0; i < 16; i++)
         custColours[i] = data.custColours[i];
     int i;
     for (i = 0; i < 16; i++)
         custColours[i] = data.custColours[i];
-    
+
     dataColour = (wxColour&)data.dataColour;
     chooseFull = data.chooseFull;
 }
 
     dataColour = (wxColour&)data.dataColour;
     chooseFull = data.chooseFull;
 }
 
-/*
-* Font data
-*/
+// ----------------------------------------------------------------------------
+// Font data
+// ----------------------------------------------------------------------------
 
 wxFontData::wxFontData()
 {
     // Intialize colour to black.
     fontColour.Set(0, 0, 0);
 
 wxFontData::wxFontData()
 {
     // Intialize colour to black.
     fontColour.Set(0, 0, 0);
-    
+
     showHelp = FALSE;
     allowSymbols = TRUE;
     enableEffects = TRUE;
     showHelp = FALSE;
     allowSymbols = TRUE;
     enableEffects = TRUE;
@@ -145,9 +161,9 @@ void wxFontData::operator=(const wxFontData& data)
     maxSize = data.maxSize;
 }
 
     maxSize = data.maxSize;
 }
 
-/*
-* Print data
-*/
+// ----------------------------------------------------------------------------
+// Print data
+// ----------------------------------------------------------------------------
 
 wxPrintData::wxPrintData()
 {
 
 wxPrintData::wxPrintData()
 {
@@ -157,7 +173,7 @@ wxPrintData::wxPrintData()
     m_printOrientation = wxPORTRAIT;
     m_printNoCopies = 1;
     m_printCollate = FALSE;
     m_printOrientation = wxPORTRAIT;
     m_printNoCopies = 1;
     m_printCollate = FALSE;
-    
+
     // New, 24/3/99
     m_printerName = "";
     m_colour = TRUE;
     // New, 24/3/99
     m_printerName = "";
     m_colour = TRUE;
@@ -209,7 +225,7 @@ void wxPrintData::ConvertToNative()
     {
         // Use PRINTDLG as a way of creating a DEVMODE object
         PRINTDLG *pd = new PRINTDLG;
     {
         // Use PRINTDLG as a way of creating a DEVMODE object
         PRINTDLG *pd = new PRINTDLG;
-        
+
         // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
 #ifdef __GNUWIN32__
         pd->lStructSize    = 66 ;
         // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
 #ifdef __GNUWIN32__
         pd->lStructSize    = 66 ;
@@ -222,10 +238,10 @@ void wxPrintData::ConvertToNative()
         pd->hwndOwner      = (HWND)NULL;
         pd->hDevMode       = NULL; // Will be created by PrintDlg
         pd->hDevNames      = NULL; // Ditto
         pd->hwndOwner      = (HWND)NULL;
         pd->hDevMode       = NULL; // Will be created by PrintDlg
         pd->hDevNames      = NULL; // Ditto
-        
+
         pd->Flags          = PD_RETURNDEFAULT;
         pd->nCopies        = 1;
         pd->Flags          = PD_RETURNDEFAULT;
         pd->nCopies        = 1;
-        
+
         // Fill out the DEVMODE structure
         // so we can use it as input in the 'real' PrintDlg
         if (!PrintDlg(pd))
         // Fill out the DEVMODE structure
         // so we can use it as input in the 'real' PrintDlg
         if (!PrintDlg(pd))
@@ -250,28 +266,28 @@ void wxPrintData::ConvertToNative()
 
         delete pd;
     }
 
         delete pd;
     }
-    
+
     if ( hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
     if ( hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
-        
+
         //// Orientation
         //// Orientation
-        
+
         devMode->dmOrientation = m_printOrientation;
         devMode->dmFields = DM_ORIENTATION;
         devMode->dmOrientation = m_printOrientation;
         devMode->dmFields = DM_ORIENTATION;
-        
+
         //// Collation
         //// Collation
-        
+
         devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
         devMode->dmFields |= DM_COLLATE;
         devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
         devMode->dmFields |= DM_COLLATE;
-        
+
         //// Number of copies
         //// Number of copies
-        
+
         devMode->dmCopies = m_printNoCopies;
         devMode->dmFields |= DM_COPIES;
         devMode->dmCopies = m_printNoCopies;
         devMode->dmFields |= DM_COPIES;
-        
+
         //// Printer name
         //// Printer name
-        
+
         if (m_printerName != "")
         {
             // TODO: make this Unicode compatible
         if (m_printerName != "")
         {
             // TODO: make this Unicode compatible
@@ -281,18 +297,18 @@ void wxPrintData::ConvertToNative()
                 devMode->dmDeviceName[i] = m_printerName.GetChar(i);
             devMode->dmDeviceName[i] = 0;
         }
                 devMode->dmDeviceName[i] = m_printerName.GetChar(i);
             devMode->dmDeviceName[i] = 0;
         }
-        
+
         //// Colour
         //// Colour
-        
+
         if (m_colour)
             devMode->dmColor = DMCOLOR_COLOR;
         else
             devMode->dmColor = DMCOLOR_MONOCHROME;
         if (m_colour)
             devMode->dmColor = DMCOLOR_COLOR;
         else
             devMode->dmColor = DMCOLOR_MONOCHROME;
-        
+
         devMode->dmFields |= DM_COLOR;
         devMode->dmFields |= DM_COLOR;
-        
+
         //// Paper size
         //// Paper size
-        
+
         if (m_paperId == wxPAPER_NONE)
         {
             devMode->dmPaperWidth = m_paperSize.x * 10;
         if (m_paperId == wxPAPER_NONE)
         {
             devMode->dmPaperWidth = m_paperSize.x * 10;
@@ -312,9 +328,9 @@ void wxPrintData::ConvertToNative()
                 }
             }
         }
                 }
             }
         }
-        
+
         //// Duplex
         //// Duplex
-        
+
         int duplex;
         switch (m_duplexMode)
         {
         int duplex;
         switch (m_duplexMode)
         {
@@ -331,9 +347,9 @@ void wxPrintData::ConvertToNative()
         }
         devMode->dmDuplex = duplex;
         devMode->dmFields |= DM_DUPLEX;
         }
         devMode->dmDuplex = duplex;
         devMode->dmFields |= DM_DUPLEX;
-        
+
         //// Quality
         //// Quality
-        
+
         int quality;
         switch (m_printQuality)
         {
         int quality;
         switch (m_printQuality)
         {
@@ -355,7 +371,7 @@ void wxPrintData::ConvertToNative()
         }
         devMode->dmPrintQuality = quality;
         devMode->dmFields |= DM_PRINTQUALITY;
         }
         devMode->dmPrintQuality = quality;
         devMode->dmFields |= DM_PRINTQUALITY;
-        
+
         GlobalUnlock(hDevMode);
     }
 }
         GlobalUnlock(hDevMode);
     }
 }
@@ -370,14 +386,14 @@ void wxPrintData::ConvertFromNative()
     if ( hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
     if ( hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode);
-        
+
         //// Orientation
         //// Orientation
-        
+
         if (devMode->dmFields & DM_ORIENTATION)
             m_printOrientation = devMode->dmOrientation;
         if (devMode->dmFields & DM_ORIENTATION)
             m_printOrientation = devMode->dmOrientation;
-        
+
         //// Collation
         //// Collation
-        
+
         if (devMode->dmFields & DM_COLLATE)
         {
             if (devMode->dmCollate == DMCOLLATE_TRUE)
         if (devMode->dmFields & DM_COLLATE)
         {
             if (devMode->dmCollate == DMCOLLATE_TRUE)
@@ -385,16 +401,16 @@ void wxPrintData::ConvertFromNative()
             else
                 m_printCollate = FALSE;
         }
             else
                 m_printCollate = FALSE;
         }
-        
+
         //// Number of copies
         //// Number of copies
-        
+
         if (devMode->dmFields & DM_COPIES)
         {
             m_printNoCopies = devMode->dmCopies;
         }
         if (devMode->dmFields & DM_COPIES)
         {
             m_printNoCopies = devMode->dmCopies;
         }
-        
+
         //// Printer name
         //// Printer name
-        
+
         if (devMode->dmDeviceName[0] != 0)
         {
             // TODO: make this Unicode compatible
         if (devMode->dmDeviceName[0] != 0)
         {
             // TODO: make this Unicode compatible
@@ -406,12 +422,12 @@ void wxPrintData::ConvertFromNative()
                 i ++;
             }
             buf[i] = 0;
                 i ++;
             }
             buf[i] = 0;
-            
+
             m_printerName = buf;
         }
             m_printerName = buf;
         }
-        
+
         //// Colour
         //// Colour
-        
+
         if (devMode->dmFields & DM_COLOR)
         {
             if (devMode->dmColor == DMCOLOR_COLOR)
         if (devMode->dmFields & DM_COLOR)
         {
             if (devMode->dmColor == DMCOLOR_COLOR)
@@ -421,9 +437,9 @@ void wxPrintData::ConvertFromNative()
         }
         else
             m_colour = TRUE;
         }
         else
             m_colour = TRUE;
-        
+
         //// Paper size
         //// Paper size
-        
+
         if (devMode->dmFields & DM_PAPERSIZE)
         {
             if (wxThePrintPaperDatabase)
         if (devMode->dmFields & DM_PAPERSIZE)
         {
             if (wxThePrintPaperDatabase)
@@ -439,7 +455,7 @@ void wxPrintData::ConvertFromNative()
                 {
                     // Shouldn't really get here
                     wxFAIL_MSG("Couldn't find paper size in paper database.");
                 {
                     // Shouldn't really get here
                     wxFAIL_MSG("Couldn't find paper size in paper database.");
-                    
+
                     m_paperId = wxPAPER_NONE;
                     m_paperSize.x = 0;
                     m_paperSize.y = 0;
                     m_paperId = wxPAPER_NONE;
                     m_paperSize.x = 0;
                     m_paperSize.y = 0;
@@ -449,7 +465,7 @@ void wxPrintData::ConvertFromNative()
             {
                 // Shouldn't really get here
                 wxFAIL_MSG("Paper database wasn't initialized in wxPrintData::ConvertFromNative.");
             {
                 // Shouldn't really get here
                 wxFAIL_MSG("Paper database wasn't initialized in wxPrintData::ConvertFromNative.");
-                
+
                 m_paperId = wxPAPER_NONE;
                 m_paperSize.x = 0;
                 m_paperSize.y = 0;
                 m_paperId = wxPAPER_NONE;
                 m_paperSize.x = 0;
                 m_paperSize.y = 0;
@@ -465,15 +481,15 @@ void wxPrintData::ConvertFromNative()
         {
             // Shouldn't really get here
             wxFAIL_MSG("Couldn't find paper size from DEVMODE.");
         {
             // Shouldn't really get here
             wxFAIL_MSG("Couldn't find paper size from DEVMODE.");
-            
+
             m_paperSize.x = 0;
             m_paperSize.y = 0;
             m_paperId = wxPAPER_NONE;
         }
             m_paperSize.x = 0;
             m_paperSize.y = 0;
             m_paperId = wxPAPER_NONE;
         }
-        
-        
+
+
         //// Duplex
         //// Duplex
-        
+
         if (devMode->dmFields & DM_DUPLEX)
         {
             switch (devMode->dmDuplex)
         if (devMode->dmFields & DM_DUPLEX)
         {
             switch (devMode->dmDuplex)
@@ -492,9 +508,9 @@ void wxPrintData::ConvertFromNative()
         }
         else
             m_duplexMode = wxDUPLEX_SIMPLEX;
         }
         else
             m_duplexMode = wxDUPLEX_SIMPLEX;
-        
+
         //// Quality
         //// Quality
-        
+
         if (devMode->dmFields & DM_PRINTQUALITY)
         {
             switch (devMode->dmPrintQuality)
         if (devMode->dmFields & DM_PRINTQUALITY)
         {
             switch (devMode->dmPrintQuality)
@@ -517,13 +533,13 @@ void wxPrintData::ConvertFromNative()
                     // will the application know if it's high, low, draft etc.??
                     //                    wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
                     m_printQuality = devMode->dmPrintQuality; break;
                     // will the application know if it's high, low, draft etc.??
                     //                    wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
                     m_printQuality = devMode->dmPrintQuality; break;
-                    
+
                 }
             }
         }
         else
             m_printQuality = wxPRINT_QUALITY_HIGH;
                 }
             }
         }
         else
             m_printQuality = wxPRINT_QUALITY_HIGH;
-        
+
         GlobalUnlock(hDevMode);
     }
 }
         GlobalUnlock(hDevMode);
     }
 }
@@ -556,7 +572,7 @@ void wxPrintData::operator=(const wxPrintData& data)
 }
 
 // For compatibility
 }
 
 // For compatibility
-#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
+#if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
 void wxPrintData::operator=(const wxPrintSetupData& setupData)
 {
     SetPrinterCommand(setupData.GetPrinterCommand());
 void wxPrintData::operator=(const wxPrintSetupData& setupData)
 {
     SetPrinterCommand(setupData.GetPrinterCommand());
@@ -579,12 +595,12 @@ void wxPrintData::operator=(const wxPrintSetupData& setupData)
     SetColour(setupData.GetColour());
     SetFilename(setupData.GetPrinterFile());
 }
     SetColour(setupData.GetColour());
     SetFilename(setupData.GetPrinterFile());
 }
-#endif
-    
+#endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
 
 
-/*
- * Print dialog data
- */
+
+// ----------------------------------------------------------------------------
+// Print dialog data
+// ----------------------------------------------------------------------------
 
 wxPrintDialogData::wxPrintDialogData()
 {
 
 wxPrintDialogData::wxPrintDialogData()
 {
@@ -689,7 +705,7 @@ void wxPrintDialogData::ConvertToNative()
     pd->nMinPage = (UINT)m_printMinPage;
     pd->nMaxPage = (UINT)m_printMaxPage;
     pd->nCopies = (UINT)m_printNoCopies;
     pd->nMinPage = (UINT)m_printMinPage;
     pd->nMaxPage = (UINT)m_printMaxPage;
     pd->nCopies = (UINT)m_printNoCopies;
-    
+
     pd->Flags = PD_RETURNDC ;
 
 #ifdef __GNUWIN32__
     pd->Flags = PD_RETURNDC ;
 
 #ifdef __GNUWIN32__
@@ -708,7 +724,7 @@ void wxPrintDialogData::ConvertToNative()
     pd->lpSetupTemplateName = NULL;
     pd->hPrintTemplate = (HGLOBAL) NULL;
     pd->hSetupTemplate = (HGLOBAL) NULL;
     pd->lpSetupTemplateName = NULL;
     pd->hPrintTemplate = (HGLOBAL) NULL;
     pd->hSetupTemplate = (HGLOBAL) NULL;
-    
+
     if ( m_printAllPages )
         pd->Flags |= PD_ALLPAGES;
     if ( m_printCollate )
     if ( m_printAllPages )
         pd->Flags |= PD_ALLPAGES;
     if ( m_printCollate )
@@ -754,7 +770,7 @@ void wxPrintDialogData::ConvertFromNative()
     m_printMinPage = pd->nMinPage ;
     m_printMaxPage = pd->nMaxPage ;
     m_printNoCopies = pd->nCopies ;
     m_printMinPage = pd->nMinPage ;
     m_printMaxPage = pd->nMaxPage ;
     m_printNoCopies = pd->nCopies ;
-    
+
     m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
     m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
     m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
     m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
     m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
     m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
@@ -773,7 +789,7 @@ void wxPrintDialogData::ConvertFromNative()
             m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
             wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
             GlobalUnlock(pd->hDevNames);
             m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
             wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
             GlobalUnlock(pd->hDevNames);
-            
+
 //            wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
         }
     }
 //            wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
         }
     }
@@ -784,14 +800,14 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
 {
     if ( m_printDlgData == NULL )
         ConvertToNative();
 {
     if ( m_printDlgData == NULL )
         ConvertToNative();
-    
+
     if ( m_printDlgData != NULL && win != NULL)
     {
         PRINTDLG *pd = (PRINTDLG *) m_printDlgData ;
         pd->hwndOwner=(HWND) win->GetHWND();
     }
 }
     if ( m_printDlgData != NULL && win != NULL)
     {
         PRINTDLG *pd = (PRINTDLG *) m_printDlgData ;
         pd->hwndOwner=(HWND) win->GetHWND();
     }
 }
-#endif
+#endif // MSW
 
 void wxPrintDialogData::operator=(const wxPrintDialogData& data)
 {
 
 void wxPrintDialogData::operator=(const wxPrintDialogData& data)
 {
@@ -817,9 +833,9 @@ void wxPrintDialogData::operator=(const wxPrintData& data)
     m_printData = data;
 }
 
     m_printData = data;
 }
 
-/*
- * wxPageSetupDialogData
- */
+// ----------------------------------------------------------------------------
+// wxPageSetupDialogData
+// ----------------------------------------------------------------------------
 
 wxPageSetupDialogData::wxPageSetupDialogData()
 {
 
 wxPageSetupDialogData::wxPageSetupDialogData()
 {
@@ -911,7 +927,7 @@ void wxPageSetupDialogData::operator=(const wxPrintData& data)
     m_printData = data;
 }
 
     m_printData = data;
 }
 
-#if defined(__WXMSW__) && defined(__WIN95__)
+#if defined(__WIN95__)
 void wxPageSetupDialogData::ConvertToNative()
 {
     m_printData.ConvertToNative();
 void wxPageSetupDialogData::ConvertToNative()
 {
     m_printData.ConvertToNative();
@@ -945,7 +961,7 @@ void wxPageSetupDialogData::ConvertToNative()
 //        pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
 
     pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
 //        pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
 
     pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
-    
+
     if ( m_defaultMinMargins )
         pd->Flags |= PSD_DEFAULTMINMARGINS;
     if ( !m_enableMargins )
     if ( m_defaultMinMargins )
         pd->Flags |= PSD_DEFAULTMINMARGINS;
     if ( !m_enableMargins )
@@ -968,27 +984,27 @@ void wxPageSetupDialogData::ConvertToNative()
     pd->hwndOwner=(HWND)NULL;
     pd->hDevNames=(HWND)NULL;
     pd->hInstance=(HINSTANCE)NULL;
     pd->hwndOwner=(HWND)NULL;
     pd->hDevNames=(HWND)NULL;
     pd->hInstance=(HINSTANCE)NULL;
-    
+
     pd->ptPaperSize.x = m_paperSize.x * 100;
     pd->ptPaperSize.y = m_paperSize.y * 100;
     pd->ptPaperSize.x = m_paperSize.x * 100;
     pd->ptPaperSize.y = m_paperSize.y * 100;
-    
+
     pd->rtMinMargin.left = m_minMarginTopLeft.x * 100;
     pd->rtMinMargin.top = m_minMarginTopLeft.y * 100;
     pd->rtMinMargin.right = m_minMarginBottomRight.x * 100;
     pd->rtMinMargin.bottom = m_minMarginBottomRight.y * 100;
     pd->rtMinMargin.left = m_minMarginTopLeft.x * 100;
     pd->rtMinMargin.top = m_minMarginTopLeft.y * 100;
     pd->rtMinMargin.right = m_minMarginBottomRight.x * 100;
     pd->rtMinMargin.bottom = m_minMarginBottomRight.y * 100;
-    
+
     pd->rtMargin.left = m_marginTopLeft.x * 100;
     pd->rtMargin.top = m_marginTopLeft.y * 100;
     pd->rtMargin.right = m_marginBottomRight.x * 100;
     pd->rtMargin.bottom = m_marginBottomRight.y * 100;
     pd->rtMargin.left = m_marginTopLeft.x * 100;
     pd->rtMargin.top = m_marginTopLeft.y * 100;
     pd->rtMargin.right = m_marginBottomRight.x * 100;
     pd->rtMargin.bottom = m_marginBottomRight.y * 100;
-    
+
     pd->lCustData = 0;
     pd->lpfnPageSetupHook = NULL;
     pd->lpfnPagePaintHook = NULL;
     pd->hPageSetupTemplate = NULL;
     pd->lpPageSetupTemplateName = NULL;
 
     pd->lCustData = 0;
     pd->lpfnPageSetupHook = NULL;
     pd->lpfnPagePaintHook = NULL;
     pd->hPageSetupTemplate = NULL;
     pd->lpPageSetupTemplateName = NULL;
 
-/*    
+/*
     if ( pd->hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
     if ( pd->hDevMode )
     {
         DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
@@ -1006,7 +1022,7 @@ void wxPageSetupDialogData::ConvertFromNative()
     PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
     if ( !pd )
         return;
     PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
     if ( !pd )
         return;
-    
+
     // Pass the devmode data back to the wxPrintData structure where it really belongs.
     if (pd->hDevMode)
     {
     // Pass the devmode data back to the wxPrintData structure where it really belongs.
     if (pd->hDevMode)
     {
@@ -1022,7 +1038,7 @@ void wxPageSetupDialogData::ConvertFromNative()
     m_printData.ConvertFromNative();
 
     pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
     m_printData.ConvertFromNative();
 
     pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
-    
+
     m_defaultMinMargins = ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS);
     m_enableMargins = ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS);
     m_enableOrientation = ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION);
     m_defaultMinMargins = ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS);
     m_enableMargins = ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS);
     m_enableOrientation = ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION);
@@ -1030,15 +1046,15 @@ void wxPageSetupDialogData::ConvertFromNative()
     m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
     m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
     m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
     m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
     m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
     m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
-    
+
     m_paperSize.x = pd->ptPaperSize.x / 100;
     m_paperSize.y = pd->ptPaperSize.y / 100;
     m_paperSize.x = pd->ptPaperSize.x / 100;
     m_paperSize.y = pd->ptPaperSize.y / 100;
-    
+
     m_minMarginTopLeft.x = pd->rtMinMargin.left / 100;
     m_minMarginTopLeft.y = pd->rtMinMargin.top / 100;
     m_minMarginBottomRight.x = pd->rtMinMargin.right / 100;
     m_minMarginBottomRight.y = pd->rtMinMargin.bottom / 100;
     m_minMarginTopLeft.x = pd->rtMinMargin.left / 100;
     m_minMarginTopLeft.y = pd->rtMinMargin.top / 100;
     m_minMarginBottomRight.x = pd->rtMinMargin.right / 100;
     m_minMarginBottomRight.y = pd->rtMinMargin.bottom / 100;
-    
+
     m_marginTopLeft.x = pd->rtMargin.left / 100 ;
     m_marginTopLeft.y = pd->rtMargin.top / 100 ;
     m_marginBottomRight.x = pd->rtMargin.right / 100 ;
     m_marginTopLeft.x = pd->rtMargin.left / 100 ;
     m_marginTopLeft.y = pd->rtMargin.top / 100 ;
     m_marginBottomRight.x = pd->rtMargin.right / 100 ;
@@ -1049,14 +1065,14 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
 {
     if ( m_pageSetupData == NULL )
         ConvertToNative();
 {
     if ( m_pageSetupData == NULL )
         ConvertToNative();
-    
+
     if ( m_pageSetupData != NULL && win != NULL)
     {
         PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
         pd->hwndOwner=(HWND) win->GetHWND();
     }
 }
     if ( m_pageSetupData != NULL && win != NULL)
     {
         PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
         pd->hwndOwner=(HWND) win->GetHWND();
     }
 }
-#endif
+#endif // Win95
 
 // If a corresponding paper type is found in the paper database, will set the m_printData
 // paper size id member as well.
 
 // If a corresponding paper type is found in the paper database, will set the m_printData
 // paper size id member as well.
@@ -1079,7 +1095,9 @@ void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
 // paper id
 void wxPageSetupDialogData::CalculateIdFromPaperSize()
 {
 // paper id
 void wxPageSetupDialogData::CalculateIdFromPaperSize()
 {
-    wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), "wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects." );
+    wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
+                  "wxThePrintPaperDatabase should not be NULL. "
+                  "Do not create global print dialog data objects." );
 
     wxSize sz = GetPaperSize();
 
 
     wxSize sz = GetPaperSize();
 
@@ -1089,11 +1107,13 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize()
         m_printData.SetPaperId(id);
     }
 }
         m_printData.SetPaperId(id);
     }
 }
-    
+
 // Use paper id in wxPrintData to set this object's paper size
 void wxPageSetupDialogData::CalculatePaperSizeFromId()
 {
 // Use paper id in wxPrintData to set this object's paper size
 void wxPageSetupDialogData::CalculatePaperSizeFromId()
 {
-    wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL), "wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects." );
+    wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
+                  "wxThePrintPaperDatabase should not be NULL. "
+                  "Do not create global print dialog data objects." );
 
     wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
 
 
     wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
 
@@ -1104,3 +1124,4 @@ void wxPageSetupDialogData::CalculatePaperSizeFromId()
         m_paperSize.y = sz.y * 10;
     }
 }
         m_paperSize.y = sz.y * 10;
     }
 }
+
index be9ab9a52f7e062727c72dedc3a16857951b3fd3..26a1a2f52a61842b55898d18ace4d14bb27f76a2 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:       wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -110,12 +110,12 @@ wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout *WXUNUSE
 {
     wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE);
     (void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
 {
     wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE);
     (void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
-    
+
     wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
     wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
-    
+
     dialog->Fit();
     button->Centre(wxHORIZONTAL);
     dialog->Fit();
     button->Centre(wxHORIZONTAL);
-    
+
     dialog->Centre();
     return dialog;
 }
     dialog->Centre();
     return dialog;
 }
@@ -189,7 +189,7 @@ wxScrolledWindow(parent, -1, pos, size, style, name)
 {
     m_printPreview = preview;
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
 {
     m_printPreview = preview;
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
-    
+
     SetScrollbars(15, 18, 100, 100);
 }
 
     SetScrollbars(15, 18, 100, 100);
 }
 
@@ -201,7 +201,7 @@ void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
     PrepareDC( dc );
 {
     wxPaintDC dc(this);
     PrepareDC( dc );
-    
+
     if (m_printPreview)
     {
         m_printPreview->PaintPage(this, dc);
     if (m_printPreview)
     {
         m_printPreview->PaintPage(this, dc);
@@ -213,7 +213,7 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
     Refresh();
 {
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
     Refresh();
-    
+
     // Propagate the event to the non-top-level children
     wxWindow::OnSysColourChanged(event);
 }
     // Propagate the event to the non-top-level children
     wxWindow::OnSysColourChanged(event);
 }
@@ -223,12 +223,12 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
 */
 
 BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
 */
 
 BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
-EVT_BUTTON(wxID_PREVIEW_CLOSE,                 wxPreviewControlBar::OnWindowClose)
-EVT_BUTTON(wxID_PREVIEW_PRINT,                 wxPreviewControlBar::OnPrint)
-EVT_BUTTON(wxID_PREVIEW_PREVIOUS,      wxPreviewControlBar::OnPrevious)
-EVT_BUTTON(wxID_PREVIEW_NEXT,          wxPreviewControlBar::OnNext)
-EVT_CHOICE(wxID_PREVIEW_ZOOM,          wxPreviewControlBar::OnZoom)
-EVT_PAINT(wxPreviewControlBar::OnPaint)
+    EVT_BUTTON(wxID_PREVIEW_CLOSE,    wxPreviewControlBar::OnWindowClose)
+    EVT_BUTTON(wxID_PREVIEW_PRINT,    wxPreviewControlBar::OnPrint)
+    EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
+    EVT_BUTTON(wxID_PREVIEW_NEXT,     wxPreviewControlBar::OnNext)
+    EVT_CHOICE(wxID_PREVIEW_ZOOM,     wxPreviewControlBar::OnZoom)
+    EVT_PAINT(wxPreviewControlBar::OnPaint)
 END_EVENT_TABLE()
 
 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
 END_EVENT_TABLE()
 
 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
@@ -252,7 +252,7 @@ wxPreviewControlBar::~wxPreviewControlBar()
 void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
-    
+
     int w, h;
     GetSize(&w, &h);
     dc.SetPen(*wxBLACK_PEN);
     int w, h;
     GetSize(&w, &h);
     dc.SetPen(*wxBLACK_PEN);
@@ -312,60 +312,60 @@ void wxPreviewControlBar::OnZoom(wxCommandEvent& WXUNUSED(event))
 void wxPreviewControlBar::CreateButtons()
 {
     SetSize(0, 0, 400, 40);
 void wxPreviewControlBar::CreateButtons()
 {
     SetSize(0, 0, 400, 40);
-    
+
     /*
     #ifdef __WXMSW__
     int fontSize = 9;
     #else
     int fontSize = 10;
     #endif
     /*
     #ifdef __WXMSW__
     int fontSize = 9;
     #else
     int fontSize = 10;
     #endif
-    
+
       wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
       SetFont(buttonFont);
     */
       wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
       SetFont(buttonFont);
     */
-    
+
     int buttonWidth = 65;
 #ifdef __WXGTK__
     int buttonHeight = -1;
 #else
     int buttonHeight = 24;
 #endif
     int buttonWidth = 65;
 #ifdef __WXGTK__
     int buttonHeight = -1;
 #else
     int buttonHeight = 24;
 #endif
-    
+
     int x = 5;
     int y = 5;
     int x = 5;
     int y = 5;
-    
+
 #ifdef __WXMOTIF__
     int gap = 15;
 #else
     int gap = 5;
 #endif
 #ifdef __WXMOTIF__
     int gap = 15;
 #else
     int gap = 5;
 #endif
-    
+
     m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"),
         wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
     m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"),
         wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
-    
+
     x += gap + buttonWidth;
     x += gap + buttonWidth;
-    
+
     if (m_buttonFlags & wxPREVIEW_PRINT)
     {
         m_printButton =  new wxButton(this, wxID_PREVIEW_PRINT, _("Print..."), wxPoint(x, y),
             wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
     if (m_buttonFlags & wxPREVIEW_PRINT)
     {
         m_printButton =  new wxButton(this, wxID_PREVIEW_PRINT, _("Print..."), wxPoint(x, y),
             wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
-    
+
     if (m_buttonFlags & wxPREVIEW_PREVIOUS)
     {
         m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y),
             wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
     if (m_buttonFlags & wxPREVIEW_PREVIOUS)
     {
         m_previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y),
             wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
-    
+
     if (m_buttonFlags & wxPREVIEW_NEXT)
     {
         m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>",
             wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
     if (m_buttonFlags & wxPREVIEW_NEXT)
     {
         m_nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>",
             wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
         x += gap + buttonWidth;
     }
-    
+
     // Yes, this look stupid, but this is because gcc gives up otherwise.
     wxString *choices = new wxString[23];
     choices[0] = "10%";
     // Yes, this look stupid, but this is because gcc gives up otherwise.
     wxString *choices = new wxString[23];
     choices[0] = "10%";
@@ -391,7 +391,7 @@ void wxPreviewControlBar::CreateButtons()
     choices[20] = "120%";
     choices[21] = "150%";
     choices[22] = "200%";
     choices[20] = "120%";
     choices[21] = "150%";
     choices[22] = "200%";
-    
+
     int n = 23;
     if (m_buttonFlags & wxPREVIEW_ZOOM)
     {
     int n = 23;
     if (m_buttonFlags & wxPREVIEW_ZOOM)
     {
@@ -399,9 +399,9 @@ void wxPreviewControlBar::CreateButtons()
             wxSize(100, -1), n, (wxString *)choices);
         SetZoomControl(m_printPreview->GetZoom());
     }
             wxSize(100, -1), n, (wxString *)choices);
         SetZoomControl(m_printPreview->GetZoom());
     }
-    
+
     delete[] choices;
     delete[] choices;
-    
+
     //  m_closeButton->SetDefault();
 }
 
     //  m_closeButton->SetDefault();
 }
 
@@ -450,7 +450,7 @@ wxPreviewFrame::~wxPreviewFrame()
 void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
 {
     MakeModal(FALSE);
 void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
 {
     MakeModal(FALSE);
-    
+
     // Need to delete the printout and the print preview
     wxPrintout *printout = m_printPreview->GetPrintout();
     if (printout)
     // Need to delete the printout and the print preview
     wxPrintout *printout = m_printPreview->GetPrintout();
     if (printout)
@@ -461,22 +461,22 @@ void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
         m_printPreview->SetFrame(NULL);
     }
     delete m_printPreview;
         m_printPreview->SetFrame(NULL);
     }
     delete m_printPreview;
-    
+
     Destroy();
 }
 
 void wxPreviewFrame::Initialize()
 {
     CreateStatusBar();
     Destroy();
 }
 
 void wxPreviewFrame::Initialize()
 {
     CreateStatusBar();
-    
+
     CreateCanvas();
     CreateControlBar();
     CreateCanvas();
     CreateControlBar();
-    
+
     m_printPreview->SetCanvas(m_previewCanvas);
     m_printPreview->SetFrame(this);
     m_printPreview->SetCanvas(m_previewCanvas);
     m_printPreview->SetFrame(this);
-    
+
     // Set layout constraints here
     // Set layout constraints here
-    
+
     // Control bar constraints
     wxLayoutConstraints *c1 = new wxLayoutConstraints;
     //  int w, h;
     // Control bar constraints
     wxLayoutConstraints *c1 = new wxLayoutConstraints;
     //  int w, h;
@@ -487,28 +487,28 @@ void wxPreviewFrame::Initialize()
 #else
     h = 60;
 #endif
 #else
     h = 60;
 #endif
-    
+
     c1->left.SameAs       (this, wxLeft);
     c1->top.SameAs        (this, wxTop);
     c1->right.SameAs      (this, wxRight);
     c1->height.Absolute   (h);
     c1->left.SameAs       (this, wxLeft);
     c1->top.SameAs        (this, wxTop);
     c1->right.SameAs      (this, wxRight);
     c1->height.Absolute   (h);
-    
+
     m_controlBar->SetConstraints(c1);
     m_controlBar->SetConstraints(c1);
-    
+
     // Canvas constraints
     wxLayoutConstraints *c2 = new wxLayoutConstraints;
     // Canvas constraints
     wxLayoutConstraints *c2 = new wxLayoutConstraints;
-    
+
     c2->left.SameAs       (this, wxLeft);
     c2->top.Below         (m_controlBar);
     c2->right.SameAs      (this, wxRight);
     c2->bottom.SameAs     (this, wxBottom);
     c2->left.SameAs       (this, wxLeft);
     c2->top.Below         (m_controlBar);
     c2->right.SameAs      (this, wxRight);
     c2->bottom.SameAs     (this, wxBottom);
-    
+
     m_previewCanvas->SetConstraints(c2);
     m_previewCanvas->SetConstraints(c2);
-    
+
     SetAutoLayout(TRUE);
     SetAutoLayout(TRUE);
-    
+
     MakeModal(TRUE);
     MakeModal(TRUE);
-    
+
     Layout();
 }
 
     Layout();
 }
 
@@ -522,7 +522,7 @@ void wxPreviewFrame::CreateControlBar()
     long buttons = wxPREVIEW_DEFAULT;
     if (m_printPreview->GetPrintoutForPrinting())
         buttons |= wxPREVIEW_PRINT;
     long buttons = wxPREVIEW_DEFAULT;
     if (m_printPreview->GetPrintoutForPrinting())
         buttons |= wxPREVIEW_PRINT;
-    
+
     m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
     m_controlBar->CreateButtons();
 }
     m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
     m_controlBar->CreateButtons();
 }
@@ -531,17 +531,36 @@ void wxPreviewFrame::CreateControlBar()
 * Print preview
 */
 
 * Print preview
 */
 
-wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data)
+wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout,
+                                       wxPrintout *printoutForPrinting,
+                                       wxPrintData *data)
+{
+    if (data)
+        m_printDialogData = (*data);
+
+    Init(printout, printoutForPrinting);
+}
+
+wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout,
+                                       wxPrintout *printoutForPrinting,
+                                       wxPrintDialogData *data)
+{
+    if (data)
+        m_printDialogData = (*data);
+
+    Init(printout, printoutForPrinting);
+}
+
+void wxPrintPreviewBase::Init(wxPrintout *printout,
+                              wxPrintout *printoutForPrinting)
 {
     m_isOk = TRUE;
     m_previewPrintout = printout;
     if (m_previewPrintout)
         m_previewPrintout->SetIsPreview(TRUE);
 {
     m_isOk = TRUE;
     m_previewPrintout = printout;
     if (m_previewPrintout)
         m_previewPrintout->SetIsPreview(TRUE);
-    
+
     m_printPrintout = printoutForPrinting;
     m_printPrintout = printoutForPrinting;
-    if (data)
-        m_printDialogData = (*data);
-    
+
     m_previewCanvas = NULL;
     m_previewFrame = NULL;
     m_previewBitmap = NULL;
     m_previewCanvas = NULL;
     m_previewFrame = NULL;
     m_previewBitmap = NULL;
@@ -551,9 +570,9 @@ wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printou
     m_leftMargin = 40;
     m_pageWidth = 0;
     m_pageHeight = 0;
     m_leftMargin = 40;
     m_pageWidth = 0;
     m_pageHeight = 0;
-    
+
     printout->OnPreparePrinting();
     printout->OnPreparePrinting();
-    
+
     // Get some parameters from the printout, if defined
     int selFrom, selTo;
     printout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
     // Get some parameters from the printout, if defined
     int selFrom, selTo;
     printout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
@@ -573,14 +592,14 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
 {
     if (m_currentPage == pageNum)
         return TRUE;
 {
     if (m_currentPage == pageNum)
         return TRUE;
-    
+
     m_currentPage = pageNum;
     if (m_previewBitmap)
     {
         delete m_previewBitmap;
         m_previewBitmap = NULL;
     }
     m_currentPage = pageNum;
     if (m_previewBitmap)
     {
         delete m_previewBitmap;
         m_previewBitmap = NULL;
     }
-    
+
     if (m_previewCanvas)
     {
         RenderPage(pageNum);
     if (m_previewCanvas)
     {
         RenderPage(pageNum);
@@ -592,42 +611,42 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
 bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
 {
     DrawBlankPage(canvas, dc);
 bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
 {
     DrawBlankPage(canvas, dc);
-    
+
     if (!m_previewBitmap)
         RenderPage(m_currentPage);
     if (!m_previewBitmap)
         RenderPage(m_currentPage);
-    
+
     if (!m_previewBitmap)
         return FALSE;
     if (!m_previewBitmap)
         return FALSE;
-    
+
     if (!canvas)
         return FALSE;
     if (!canvas)
         return FALSE;
-    
+
     int canvasWidth, canvasHeight;
     canvas->GetSize(&canvasWidth, &canvasHeight);
     int canvasWidth, canvasHeight;
     canvas->GetSize(&canvasWidth, &canvasHeight);
-    
+
     double zoomScale = ((float)m_currentZoom/(float)100);
     double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
     //  float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
     double zoomScale = ((float)m_currentZoom/(float)100);
     double actualWidth = (zoomScale*m_pageWidth*m_previewScale);
     //  float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
-    
+
     int x = (int) ((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = m_leftMargin;
     int y = m_topMargin;
     int x = (int) ((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = m_leftMargin;
     int y = m_topMargin;
-    
+
     wxMemoryDC temp_dc;
     temp_dc.SelectObject(*m_previewBitmap);
     wxMemoryDC temp_dc;
     temp_dc.SelectObject(*m_previewBitmap);
-    
+
     dc.Blit(x, y, m_previewBitmap->GetWidth(), m_previewBitmap->GetHeight(), &temp_dc, 0, 0);
     dc.Blit(x, y, m_previewBitmap->GetWidth(), m_previewBitmap->GetHeight(), &temp_dc, 0, 0);
-    
+
     temp_dc.SelectObject(wxNullBitmap);
     temp_dc.SelectObject(wxNullBitmap);
-    
+
     return TRUE;
 }
 
 bool wxPrintPreviewBase::RenderPage(int pageNum)
 {
     int canvasWidth, canvasHeight;
     return TRUE;
 }
 
 bool wxPrintPreviewBase::RenderPage(int pageNum)
 {
     int canvasWidth, canvasHeight;
-    
+
     if (!m_previewCanvas)
     {
         wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"),
     if (!m_previewCanvas)
     {
         wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"),
@@ -635,17 +654,17 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
         return FALSE;
     }
     m_previewCanvas->GetSize(&canvasWidth, &canvasHeight);
         return FALSE;
     }
     m_previewCanvas->GetSize(&canvasWidth, &canvasHeight);
-    
+
     double zoomScale = (m_currentZoom/100.0);
     int actualWidth = (int)(zoomScale*m_pageWidth*m_previewScale);
     int actualHeight = (int)(zoomScale*m_pageHeight*m_previewScale);
     double zoomScale = (m_currentZoom/100.0);
     int actualWidth = (int)(zoomScale*m_pageWidth*m_previewScale);
     int actualHeight = (int)(zoomScale*m_pageHeight*m_previewScale);
-    
+
     int x = (int)((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = m_leftMargin;
     //  int y = m_topMargin;
     int x = (int)((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = m_leftMargin;
     //  int y = m_topMargin;
-    
-    
+
+
     if (!m_previewBitmap)
     {
         m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
     if (!m_previewBitmap)
     {
         m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
@@ -657,44 +676,44 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
             return FALSE;
         }
     }
             return FALSE;
         }
     }
-    
+
     wxMemoryDC memoryDC;
     memoryDC.SelectObject(*m_previewBitmap);
     wxMemoryDC memoryDC;
     memoryDC.SelectObject(*m_previewBitmap);
-    
+
     memoryDC.Clear();
     memoryDC.Clear();
-    
+
     m_previewPrintout->SetDC(&memoryDC);
     m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
     m_previewPrintout->SetDC(&memoryDC);
     m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
-    
+
     m_previewPrintout->OnBeginPrinting();
 
     if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
     {
         wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
     m_previewPrintout->OnBeginPrinting();
 
     if (!m_previewPrintout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
     {
         wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK);
-        
+
         memoryDC.SelectObject(wxNullBitmap);
         memoryDC.SelectObject(wxNullBitmap);
-        
+
         delete m_previewBitmap;
         return FALSE;
     }
         delete m_previewBitmap;
         return FALSE;
     }
-    
+
     m_previewPrintout->OnPrintPage(pageNum);
     m_previewPrintout->OnEndDocument();
     m_previewPrintout->OnEndPrinting();
     m_previewPrintout->OnPrintPage(pageNum);
     m_previewPrintout->OnEndDocument();
     m_previewPrintout->OnEndPrinting();
-    
+
     m_previewPrintout->SetDC(NULL);
     m_previewPrintout->SetDC(NULL);
-    
+
     memoryDC.SelectObject(wxNullBitmap);
     memoryDC.SelectObject(wxNullBitmap);
-    
+
     char buf[200];
     if (m_maxPage != 0)
         sprintf(buf, _("Page %d of %d"), pageNum, m_maxPage);
     else
         sprintf(buf, _("Page %d"), pageNum);
     char buf[200];
     if (m_maxPage != 0)
         sprintf(buf, _("Page %d of %d"), pageNum, m_maxPage);
     else
         sprintf(buf, _("Page %d"), pageNum);
-    
+
     if (m_previewFrame)
         m_previewFrame->SetStatusText(buf);
     if (m_previewFrame)
         m_previewFrame->SetStatusText(buf);
-    
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -703,16 +722,16 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
 {
     int canvasWidth, canvasHeight;
     canvas->GetSize(&canvasWidth, &canvasHeight);
 {
     int canvasWidth, canvasHeight;
     canvas->GetSize(&canvasWidth, &canvasHeight);
-    
+
     float zoomScale = (float)((float)m_currentZoom/(float)100);
     float actualWidth = zoomScale*m_pageWidth*m_previewScale;
     float actualHeight = zoomScale*m_pageHeight*m_previewScale;
     float zoomScale = (float)((float)m_currentZoom/(float)100);
     float actualWidth = zoomScale*m_pageWidth*m_previewScale;
     float actualHeight = zoomScale*m_pageHeight*m_previewScale;
-    
+
     float x = (float)((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = (float)m_leftMargin;
     float y = (float)m_topMargin;
     float x = (float)((canvasWidth - actualWidth)/2.0);
     if (x < m_leftMargin)
         x = (float)m_leftMargin;
     float y = (float)m_topMargin;
-    
+
     // Draw shadow, allowing for 1-pixel border AROUND the actual page
     int shadowOffset = 4;
     dc.SetPen(*wxBLACK_PEN);
     // Draw shadow, allowing for 1-pixel border AROUND the actual page
     int shadowOffset = 4;
     dc.SetPen(*wxBLACK_PEN);
@@ -722,20 +741,20 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
     */
     dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
     dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
     */
     dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
     dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
-    
+
     // Draw blank page allowing for 1-pixel border AROUND the actual page
     dc.SetPen(*wxBLACK_PEN);
     dc.SetBrush(*wxWHITE_BRUSH);
     // Draw blank page allowing for 1-pixel border AROUND the actual page
     dc.SetPen(*wxBLACK_PEN);
     dc.SetBrush(*wxWHITE_BRUSH);
-    
+
     /*
     wxRegion update_region = canvas->GetUpdateRegion();
     wxRect r = update_region.GetBox();
     /*
     wxRegion update_region = canvas->GetUpdateRegion();
     wxRect r = update_region.GetBox();
-    
+
       printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
     */
       printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
     */
-    
+
     dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
     dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
-    
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -743,7 +762,7 @@ void wxPrintPreviewBase::SetZoom(int percent)
 {
     if (m_currentZoom == percent)
         return;
 {
     if (m_currentZoom == percent)
         return;
-    
+
     m_currentZoom = percent;
     if (m_previewBitmap)
     {
     m_currentZoom = percent;
     if (m_previewBitmap)
     {
@@ -751,7 +770,7 @@ void wxPrintPreviewBase::SetZoom(int percent)
         m_previewBitmap = NULL;
     }
     RenderPage(m_currentPage);
         m_previewBitmap = NULL;
     }
     RenderPage(m_currentPage);
-    
+
     if (m_previewCanvas)
     {
         m_previewCanvas->Clear();
     if (m_previewCanvas)
     {
         m_previewCanvas->Clear();
index 725f9565be3325628a8f5f25fb5af0739f1d245b..d8b97e48f70f02a8f9dadd635f52574e262bb228 100644 (file)
@@ -1935,7 +1935,7 @@ wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxStri
    radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
 
   // @@@ Configuration hook
    radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
 
   // @@@ Configuration hook
-   if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
+   if ( !wxThePrintSetupData->GetPrintPreviewCommand() )
       wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
 
    //   wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
       wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
 
    //   wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->m_previewCommand);
index f64a03b5e4dfd75716eeba66842159ca9cf55629..389fb5c7e152b395cdf08e4c0ff5298a650f2cce 100644 (file)
@@ -6,28 +6,36 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 /////////////////////////////////////////////////////////////////////////////
 
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
 #ifdef __GNUG__
 #ifdef __GNUG__
-#pragma implementation "printps.h"
+    #pragma implementation "printps.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #include "wx/defs.h"
 
 #ifndef WX_PRECOMP
 #endif
 
 #include "wx/defs.h"
 
 #ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/dc.h"
-#include "wx/app.h"
-#include "wx/msgdlg.h"
-#include <wx/intl.h>
+    #include "wx/utils.h"
+    #include "wx/dc.h"
+    #include "wx/app.h"
+    #include "wx/msgdlg.h"
+    #include <wx/intl.h>
 #endif
 
 #include "wx/generic/printps.h"
 #endif
 
 #include "wx/generic/printps.h"
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
 #if !USE_SHARED_LIBRARY
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
-IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
+    IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
+    IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
 #endif
 
 #endif
 
-/*
-* Printer
-*/
+// ============================================================================
+// implementation
+// ============================================================================
 
 
-wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data):
-wxPrinterBase(data)
+// ----------------------------------------------------------------------------
+// Printer
+// ----------------------------------------------------------------------------
+
+wxPostScriptPrinter::wxPostScriptPrinter(wxPrintDialogData *data)
+                   : wxPrinterBase(data)
 {
 }
 
 {
 }
 
-wxPostScriptPrinter::~wxPostScriptPrinter(void)
+wxPostScriptPrinter::~wxPostScriptPrinter()
 {
 }
 
 {
 }
 
@@ -60,21 +76,21 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
 {
     sm_abortIt = FALSE;
     sm_abortWindow = (wxWindow *) NULL;
 {
     sm_abortIt = FALSE;
     sm_abortWindow = (wxWindow *) NULL;
-    
+
     if (!printout)
         return FALSE;
     if (!printout)
         return FALSE;
-    
+
     printout->SetIsPreview(FALSE);
     printout->OnPreparePrinting();
     printout->SetIsPreview(FALSE);
     printout->OnPreparePrinting();
-    
+
     // Get some parameters from the printout, if defined
     int fromPage, toPage;
     int minPage, maxPage;
     printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
     // Get some parameters from the printout, if defined
     int fromPage, toPage;
     int minPage, maxPage;
     printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-    
+
     if (maxPage == 0)
         return FALSE;
     if (maxPage == 0)
         return FALSE;
-    
+
     m_printDialogData.SetMinPage(minPage);
     m_printDialogData.SetMaxPage(maxPage);
     if (fromPage != 0)
     m_printDialogData.SetMinPage(minPage);
     m_printDialogData.SetMaxPage(maxPage);
     if (fromPage != 0)
@@ -97,7 +113,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
     else
         m_printDialogData.EnablePageNumbers(FALSE);
 
     else
         m_printDialogData.EnablePageNumbers(FALSE);
 
-    // Create a suitable device context  
+    // Create a suitable device context
     wxDC *dc = (wxDC *) NULL;
     if (prompt)
     {
     wxDC *dc = (wxDC *) NULL;
     if (prompt)
     {
@@ -109,50 +125,50 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
     {
         dc = new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
     }
     {
         dc = new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
     }
-    
+
     // May have pressed cancel.
     if (!dc || !dc->Ok())
     {
         if (dc) delete dc;
         return FALSE;
     }
     // May have pressed cancel.
     if (!dc || !dc->Ok())
     {
         if (dc) delete dc;
         return FALSE;
     }
-    
+
     int logPPIScreenX = 0;
     int logPPIScreenY = 0;
     int logPPIPrinterX = 0;
     int logPPIPrinterY = 0;
     int logPPIScreenX = 0;
     int logPPIScreenY = 0;
     int logPPIPrinterX = 0;
     int logPPIPrinterY = 0;
-    
+
     logPPIScreenX = 100;
     logPPIScreenY = 100;
     logPPIScreenX = 100;
     logPPIScreenY = 100;
-    
+
     /*
     // Correct values for X/PostScript?
     logPPIPrinterX = 100;
     logPPIPrinterY = 100;
     */
     /*
     // Correct values for X/PostScript?
     logPPIPrinterX = 100;
     logPPIPrinterY = 100;
     */
-    
+
     logPPIPrinterX = 72;
     logPPIPrinterY = 72;
     logPPIPrinterX = 72;
     logPPIPrinterY = 72;
-    
+
     printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
     printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
     printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
     printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
-    
-    // Set printout parameters  
+
+    // Set printout parameters
     printout->SetDC(dc);
     printout->SetDC(dc);
-    
+
     int w, h;
     dc->GetSize(&w, &h);
     printout->SetPageSizePixels((int)w, (int)h);
     dc->GetSizeMM(&w, &h);
     printout->SetPageSizeMM((int)w, (int)h);
     int w, h;
     dc->GetSize(&w, &h);
     printout->SetPageSizePixels((int)w, (int)h);
     dc->GetSizeMM(&w, &h);
     printout->SetPageSizeMM((int)w, (int)h);
-    
+
     // Create an abort window
     wxBeginBusyCursor();
     // Create an abort window
     wxBeginBusyCursor();
-    
+
     printout->OnBeginPrinting();
     printout->OnBeginPrinting();
-    
+
     bool keepGoing = TRUE;
     bool keepGoing = TRUE;
-    
+
     int copyCount;
     for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
     {
     int copyCount;
     for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
     {
@@ -164,7 +180,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
         }
         if (sm_abortIt)
             break;
         }
         if (sm_abortIt)
             break;
-        
+
         int pn;
         for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
         pn++)
         int pn;
         for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
         pn++)
@@ -183,13 +199,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
         }
         printout->OnEndDocument();
     }
         }
         printout->OnEndDocument();
     }
-    
+
     printout->OnEndPrinting();
     printout->OnEndPrinting();
-    
+
     wxEndBusyCursor();
     wxEndBusyCursor();
-    
+
     delete dc;
     delete dc;
-    
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -225,18 +241,34 @@ bool wxPostScriptPrinter::Setup(wxWindow *parent)
     return (ret == wxID_OK);
 }
 
     return (ret == wxID_OK);
 }
 
-/*
-* Print preview
-*/
+// ----------------------------------------------------------------------------
+// Print preview
+// ----------------------------------------------------------------------------
 
 
-wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintDialogData *data):
-wxPrintPreviewBase(printout, printoutForPrinting, data)
+void wxPostScriptPrintPreview::Init(wxPrintout * WXUNUSED(printout),
+                                    wxPrintout * WXUNUSED(printoutForPrinting))
 {
     // Have to call it here since base constructor can't call it
     DetermineScaling();
 }
 
 {
     // Have to call it here since base constructor can't call it
     DetermineScaling();
 }
 
-wxPostScriptPrintPreview::~wxPostScriptPrintPreview(void)
+wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout,
+                                                   wxPrintout *printoutForPrinting,
+                                                   wxPrintDialogData *data)
+                        : wxPrintPreviewBase(printout, printoutForPrinting, data)
+{
+    Init(printout, printoutForPrinting);
+}
+
+wxPostScriptPrintPreview::wxPostScriptPrintPreview(wxPrintout *printout,
+                                                   wxPrintout *printoutForPrinting,
+                                                   wxPrintData *data)
+                        : wxPrintPreviewBase(printout, printoutForPrinting, data)
+{
+    Init(printout, printoutForPrinting);
+}
+
+wxPostScriptPrintPreview::~wxPostScriptPrintPreview()
 {
 }
 
 {
 }
 
@@ -248,12 +280,12 @@ bool wxPostScriptPrintPreview::Print(bool interactive)
     return printer.Print(m_previewFrame, m_printPrintout, interactive);
 }
 
     return printer.Print(m_previewFrame, m_printPrintout, interactive);
 }
 
-void wxPostScriptPrintPreview::DetermineScaling(void)
+void wxPostScriptPrintPreview::DetermineScaling()
 {
     wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
     if (paperType == wxPAPER_NONE)
         paperType = wxPAPER_NONE;
 {
     wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
     if (paperType == wxPAPER_NONE)
         paperType = wxPAPER_NONE;
-    
+
     wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
     if (!paper)
         paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
     wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
     if (!paper)
         paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
@@ -263,7 +295,7 @@ void wxPostScriptPrintPreview::DetermineScaling(void)
         m_previewPrintout->SetPPIScreen(100, 100);
         //      m_previewPrintout->SetPPIPrinter(100, 100);
         m_previewPrintout->SetPPIPrinter(72, 72);
         m_previewPrintout->SetPPIScreen(100, 100);
         //      m_previewPrintout->SetPPIPrinter(100, 100);
         m_previewPrintout->SetPPIPrinter(72, 72);
-        
+
         wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
         wxSize sizeTenthsMM(paper->GetSize());
         wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
         wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
         wxSize sizeTenthsMM(paper->GetSize());
         wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
@@ -283,7 +315,7 @@ void wxPostScriptPrintPreview::DetermineScaling(void)
             m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
             m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
         }
             m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
             m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
         }
-        
+
         // At 100%, the page should look about page-size on the screen.
         m_previewScale = (float)0.8;
     }
         // At 100%, the page should look about page-size on the screen.
         m_previewScale = (float)0.8;
     }
index 688edb11da2736849a2b331a15ea85ba36980536..c5ea11ae15b0fb80506a96a7457a31f095adde9b 100644 (file)
@@ -6,42 +6,50 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 /////////////////////////////////////////////////////////////////////////////
 
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
 #ifdef __GNUG__
 #ifdef __GNUG__
-#pragma implementation "prntdlgg.h"
+    #pragma implementation "prntdlgg.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #include "wx/defs.h"
 
 #ifndef WX_PRECOMP
 #endif
 
 #include "wx/defs.h"
 
 #ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/dc.h"
-#include "wx/app.h"
-#include "wx/frame.h"
-#include "wx/stattext.h"
-#include "wx/statbox.h"
-#include "wx/button.h"
-#include "wx/checkbox.h"
-#include "wx/textctrl.h"
-#include "wx/radiobox.h"
-#include "wx/filedlg.h"
-#include "wx/choice.h"
-#include <wx/intl.h>
+    #include "wx/utils.h"
+    #include "wx/dc.h"
+    #include "wx/app.h"
+    #include "wx/frame.h"
+    #include "wx/stattext.h"
+    #include "wx/statbox.h"
+    #include "wx/button.h"
+    #include "wx/checkbox.h"
+    #include "wx/textctrl.h"
+    #include "wx/radiobox.h"
+    #include "wx/filedlg.h"
+    #include "wx/choice.h"
+    #include <wx/intl.h>
 #endif
 
 #include "wx/generic/prntdlgg.h"
 
 #if wxUSE_POSTSCRIPT
 #endif
 
 #include "wx/generic/prntdlgg.h"
 
 #if wxUSE_POSTSCRIPT
-#include "wx/generic/dcpsg.h"
+    #include "wx/generic/dcpsg.h"
 #endif
 
 #include "wx/printdlg.h"
 #endif
 
 #include "wx/printdlg.h"
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
 #if wxUSE_POSTSCRIPT
 
 #if !USE_SHARED_LIBRARY
 #if wxUSE_POSTSCRIPT
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
-IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
-IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
-
-BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
-EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
-EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
-EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
-EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
-END_EVENT_TABLE()
-#endif
+    IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
+    IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
+    IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
+
+    BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
+        EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
+        EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
+        EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
+    END_EVENT_TABLE()
+
+    BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
+        EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
+    END_EVENT_TABLE()
+#endif // USE_SHARED_LIBRARY
+
+// ----------------------------------------------------------------------------
+// global vars
+// ----------------------------------------------------------------------------
 
 extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
 
 
 extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
 
-/*
-* Generic print dialog for non-Windows printing use.
-*/
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Generic print dialog for non-Windows printing use.
+// ----------------------------------------------------------------------------
+
+wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
+                                           wxPrintDialogData* data)
+                    : wxDialog(parent, -1, _("Print"),
+                               wxPoint(0, 0), wxSize(600, 600),
+                               wxDEFAULT_DIALOG_STYLE |
+                               wxDIALOG_MODAL |
+                               wxTAB_TRAVERSAL)
+{
+    if ( data )
+        m_printDialogData = *data;
 
 
+    Init(parent);
+}
 
 
-wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data):
-wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
+wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
+                                           wxPrintData* data)
 {
     if ( data )
         m_printDialogData = *data;
 {
     if ( data )
         m_printDialogData = *data;
-    
+
+    Init(parent);
+}
+
+void wxGenericPrintDialog::Init(wxWindow *parent)
+{
+    wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
+                     wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
+
     (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
     (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
-    
+
     m_printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
     m_printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
-    
+
     m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
     m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
-    
+
     wxString *choices = new wxString[2];
     choices[0] = _("All");
     choices[1] = _("Pages");
     wxString *choices = new wxString[2];
     choices[0] = _("All");
     choices[1] = _("Pages");
-    
+
     m_fromText = (wxTextCtrl*)NULL;
     m_fromText = (wxTextCtrl*)NULL;
-    
+
     if (m_printDialogData.GetFromPage() != 0)
     {
         m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
     if (m_printDialogData.GetFromPage() != 0)
     {
         m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
-            wxPoint(5, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL);
+                                         wxPoint(5, 80), wxSize(-1, -1),
+                                         2, choices,
+                                         1, wxRA_VERTICAL);
         m_rangeRadioBox->SetSelection(1);
     }
         m_rangeRadioBox->SetSelection(1);
     }
-    
+
     if(m_printDialogData.GetFromPage() != 0)
     {
         (void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
     if(m_printDialogData.GetFromPage() != 0)
     {
         (void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
-        
+
         m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
         m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
-        
+
         (void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
         (void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
-        
+
         m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
     }
         m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
     }
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
-    
+
     m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
     m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
-    
+
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
-    
+
     okButton->SetDefault();
     okButton->SetFocus();
     Fit();
     Centre(wxBOTH);
     okButton->SetDefault();
     okButton->SetFocus();
     Fit();
     Centre(wxBOTH);
-    
+
     // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
     InitDialog();
     delete[] choices;
     // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
     InitDialog();
     delete[] choices;
@@ -171,7 +214,7 @@ wxGenericPrintDialog::~wxGenericPrintDialog()
 void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
 {
     TransferDataFromWindow();
 void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
 {
     TransferDataFromWindow();
-    
+
     // There are some interactions between the global setup data
     // and the standard print dialog. The global printing 'mode'
     // is determined by whether the user checks Print to file
     // There are some interactions between the global setup data
     // and the standard print dialog. The global printing 'mode'
     // is determined by whether the user checks Print to file
@@ -180,27 +223,27 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
     {
         m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
         wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_FILE);
     {
         m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
         wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_FILE);
-        
+
         wxString f = wxFileSelector(_("PostScript file"),
             wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
             wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
             "ps", "*.ps", 0, this);
         if ( f.IsEmpty() )
             return;
         wxString f = wxFileSelector(_("PostScript file"),
             wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
             wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
             "ps", "*.ps", 0, this);
         if ( f.IsEmpty() )
             return;
-        
+
         m_printDialogData.GetPrintData().SetFilename(f);
         wxThePrintSetupData->SetPrinterFile(f);
     }
     else
         wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
         m_printDialogData.GetPrintData().SetFilename(f);
         wxThePrintSetupData->SetPrinterFile(f);
     }
     else
         wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
-    
+
     EndModal(wxID_OK);
 }
 
 void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
 {
     if (!m_fromText) return;
     EndModal(wxID_OK);
 }
 
 void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
 {
     if (!m_fromText) return;
-    
+
     if (event.GetInt() == 0)
     {
         m_fromText->Enable(FALSE);
     if (event.GetInt() == 0)
     {
         m_fromText->Enable(FALSE);
@@ -223,26 +266,26 @@ void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
         *wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
         m_printDialogData = genericPrintSetupDialog->GetPrintData();
     }
         *wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
         m_printDialogData = genericPrintSetupDialog->GetPrintData();
     }
-    
+
     genericPrintSetupDialog->Close(TRUE);
 }
 
 bool wxGenericPrintDialog::TransferDataToWindow()
 {
     char buf[10];
     genericPrintSetupDialog->Close(TRUE);
 }
 
 bool wxGenericPrintDialog::TransferDataToWindow()
 {
     char buf[10];
-    
+
     if(m_printDialogData.GetFromPage() != 0)
     {
         if (m_printDialogData.GetEnablePageNumbers())
         {
             m_fromText->Enable(TRUE);
             m_toText->Enable(TRUE);
     if(m_printDialogData.GetFromPage() != 0)
     {
         if (m_printDialogData.GetEnablePageNumbers())
         {
             m_fromText->Enable(TRUE);
             m_toText->Enable(TRUE);
-            
+
             sprintf(buf, "%d", m_printDialogData.GetFromPage());
             m_fromText->SetValue(buf);
             sprintf(buf, "%d", m_printDialogData.GetToPage());
             m_toText->SetValue(buf);
             sprintf(buf, "%d", m_printDialogData.GetFromPage());
             m_fromText->SetValue(buf);
             sprintf(buf, "%d", m_printDialogData.GetToPage());
             m_toText->SetValue(buf);
-            
+
             if (m_printDialogData.GetAllPages())
                 m_rangeRadioBox->SetSelection(0);
             else
             if (m_printDialogData.GetAllPages())
                 m_rangeRadioBox->SetSelection(0);
             else
@@ -258,7 +301,7 @@ bool wxGenericPrintDialog::TransferDataToWindow()
     }
     sprintf(buf, "%d", m_printDialogData.GetNoCopies());
     m_noCopiesText->SetValue(buf);
     }
     sprintf(buf, "%d", m_printDialogData.GetNoCopies());
     m_noCopiesText->SetValue(buf);
-    
+
     m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
     m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
     return TRUE;
     m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
     m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
     return TRUE;
@@ -299,9 +342,9 @@ wxDC *wxGenericPrintDialog::GetPrintDC()
     return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
 }
 
     return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
 }
 
-/*
-* Generic print setup dialog
-*/
+// ----------------------------------------------------------------------------
+// Generic print setup dialog
+// ----------------------------------------------------------------------------
 
 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
 wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
 
 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
 wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
@@ -328,50 +371,50 @@ void wxGenericPrintSetupDialog::Init(wxPrintData* data)
         m_printData = *data;
 
     int staticBoxWidth = 300;
         m_printData = *data;
 
     int staticBoxWidth = 300;
-    
+
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth, 60) );
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth, 60) );
-    
+
     int xPos = 20;
     int yPos = 30;
     m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
     int xPos = 20;
     int yPos = 30;
     m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
-    
+
     wxString *choices =  new wxString[2];
     choices[0] = _("Portrait");
     choices[1] = _("Landscape");
     wxString *choices =  new wxString[2];
     choices[0] = _("Portrait");
     choices[1] = _("Landscape");
-    
+
     m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
         wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
     m_orientationRadioBox->SetSelection(0);
     m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
         wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
     m_orientationRadioBox->SetSelection(0);
-    
+
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
-    
+
     int colourYPos = 145;
     int colourYPos = 145;
-    
+
 #ifdef __WXMOTIF__
     colourYPos = 150;
 #endif
 #ifdef __WXMOTIF__
     colourYPos = 150;
 #endif
-    
+
     m_colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourYPos));
 
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
     m_colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourYPos));
 
     (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
-    
+
     m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(360, 55), wxSize(150, -1));
     m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(360, 55), wxSize(150, -1));
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
-    
+
     m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1));
     m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1));
-    
+
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
-    
+
     okButton->SetDefault();
     okButton->SetFocus();
     okButton->SetDefault();
     okButton->SetFocus();
-    
+
     Fit();
     Centre(wxBOTH);
     Fit();
     Centre(wxBOTH);
-    
+
     InitDialog();
     delete[] choices;
 }
     InitDialog();
     delete[] choices;
 }
@@ -388,7 +431,7 @@ bool wxGenericPrintSetupDialog::TransferDataToWindow()
         m_printerOptionsText->SetValue(m_printData.GetPrinterOptions());
     if (m_colourCheckBox)
         m_colourCheckBox->SetValue(m_printData.GetColour());
         m_printerOptionsText->SetValue(m_printData.GetPrinterOptions());
     if (m_colourCheckBox)
         m_colourCheckBox->SetValue(m_printData.GetColour());
-    
+
     if (m_orientationRadioBox)
     {
         if (m_printData.GetOrientation() == wxPORTRAIT)
     if (m_orientationRadioBox)
     {
         if (m_printData.GetOrientation() == wxPORTRAIT)
@@ -447,7 +490,7 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
         if (m_printData.GetPaperId() == paper->GetId())
             sel = i;
     }
         if (m_printData.GetPaperId() == paper->GetId())
             sel = i;
     }
-    
+
     int width = 250;
 
     wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
     int width = 250;
 
     wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
@@ -456,16 +499,15 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
     //    SetFont(thisFont);
 
     delete[] choices;
     //    SetFont(thisFont);
 
     delete[] choices;
-    
+
     choice->SetSelection(sel);
     return choice;
 }
     choice->SetSelection(sel);
     return choice;
 }
-#endif
-// wxUSE_POSTSCRIPT
+#endif // wxUSE_POSTSCRIPT
 
 
-/*
- * Generic page setup dialog
- */
+// ----------------------------------------------------------------------------
+// Generic page setup dialog
+// ----------------------------------------------------------------------------
 
 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
 {
 
 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
 {
@@ -503,89 +545,89 @@ wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_
 {
     if ( data )
         m_pageData = *data;
 {
     if ( data )
         m_pageData = *data;
-    
+
     int buttonWidth = 75;
     int buttonHeight = 25;
     int spacing = 5;
 #ifdef __WXMOTIF__
     spacing = 15;
 #endif
     int buttonWidth = 75;
     int buttonHeight = 25;
     int spacing = 5;
 #ifdef __WXMOTIF__
     spacing = 15;
 #endif
-    
+
     int yPos = 5;
     int xPos = 5;
     int yPos = 5;
     int xPos = 5;
-    
+
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
     wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
     (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
-    
+
     m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
     m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
-    
+
     if ( !m_pageData.GetEnablePrinter() )
         m_printerButton->Enable(FALSE);
     if ( !m_pageData.GetEnablePrinter() )
         m_printerButton->Enable(FALSE);
-    
+
     //  if (m_printData.GetEnableHelp())
     //  wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
     //  if (m_printData.GetEnableHelp())
     //  wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
-    
+
     okButton->SetDefault();
     okButton->SetFocus();
     okButton->SetDefault();
     okButton->SetFocus();
-    
+
     xPos = 5;
     yPos += 35;
     xPos = 5;
     yPos += 35;
-    
+
 #ifdef __WXMOTIF__
     yPos += 10;
 #endif
 #ifdef __WXMOTIF__
     yPos += 10;
 #endif
-    
+
     m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
     m_paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
-    
+
     xPos = 5;
     xPos = 5;
-    
+
     wxString *choices = new wxString[2];
     choices[0] = _("Portrait");
     choices[1] = _("Landscape");
     m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
         wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
     m_orientationRadioBox->SetSelection(0);
     wxString *choices = new wxString[2];
     choices[0] = _("Portrait");
     choices[1] = _("Landscape");
     m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
         wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
     m_orientationRadioBox->SetSelection(0);
-    
+
     xPos = 5;
     yPos += 60;
     xPos = 5;
     yPos += 60;
-    
+
     int staticWidth = 110;
 #ifdef __WXMOTIF__
     staticWidth += 20;
 #endif
     int staticWidth = 110;
 #ifdef __WXMOTIF__
     staticWidth += 20;
 #endif
-    
+
     int textWidth = 60;
     spacing = 10;
     int textWidth = 60;
     spacing = 10;
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
-    
+
     m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
     m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
-    
+
     m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
     m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
-    
+
     yPos += 35;
     xPos = 5;
     yPos += 35;
     xPos = 5;
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
-    
+
     m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
     m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     xPos += textWidth + spacing;
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
     xPos += staticWidth;
-    
+
     m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
     m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
-    
+
     Fit();
     Centre(wxBOTH);
     Fit();
     Centre(wxBOTH);
-    
+
     InitDialog();
     delete [] choices;
 }
     InitDialog();
     delete [] choices;
 }
@@ -604,7 +646,7 @@ bool wxGenericPageSetupDialog::TransferDataToWindow()
         m_marginRightText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().x));
     if (m_marginBottomText)
         m_marginBottomText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().y));
         m_marginRightText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().x));
     if (m_marginBottomText)
         m_marginBottomText->SetValue(IntToString((int) m_pageData.GetMarginBottomRight().y));
-    
+
     if (m_orientationRadioBox)
     {
         if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT)
     if (m_orientationRadioBox)
     {
         if (m_pageData.GetPrintData().GetOrientation() == wxPORTRAIT)
@@ -636,7 +678,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
         m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
     if (m_marginRightText && m_marginBottomText)
         m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue())));
         m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
     if (m_marginRightText && m_marginBottomText)
         m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue())));
-    
+
     if (m_orientationRadioBox)
     {
         int sel = m_orientationRadioBox->GetSelection();
     if (m_orientationRadioBox)
     {
         int sel = m_orientationRadioBox->GetSelection();
@@ -668,7 +710,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
             }
         }
     }
             }
         }
     }
-    
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -690,15 +732,15 @@ wxChoice *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
         wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
         choices[i] = paper->GetName();
     }
         wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
         choices[i] = paper->GetName();
     }
-    
+
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
     *y += 25;
     (void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
     *y += 25;
-    
+
     wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(300, -1), n,
         choices);
     *y += 35;
     delete[] choices;
     wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(300, -1), n,
         choices);
     *y += 35;
     delete[] choices;
-    
+
 //    choice->SetSelection(sel);
     return choice;
 }
 //    choice->SetSelection(sel);
     return choice;
 }