]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmndata.cpp
Better alphabetized the event handler macros
[wxWidgets.git] / src / common / cmndata.cpp
index d24faf8713319c9522236ee72e35c87759e2af0a..a37373c110b08f53f22777343aebc58894d6cac4 100644 (file)
@@ -49,7 +49,7 @@
     #include "wx/paper.h"
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
-#ifdef __WXMSW__
+#if defined(__WXMSW__) && !defined(__PALMOS__)
     #include <windowsx.h>
     #include "wx/msw/private.h"
 
@@ -171,6 +171,7 @@ wxPrintData::wxPrintData()
     m_nativePrintData = wxNativePrintData::Create() ;
 #endif
     m_bin = wxPRINTBIN_DEFAULT;
+    m_printMode = wxPRINT_MODE_PRINTER;
     m_printOrientation = wxPORTRAIT;
     m_printNoCopies = 1;
     m_printCollate = false;
@@ -228,6 +229,8 @@ void wxPrintData::operator=(const wxPrintData& data)
     m_paperId = data.m_paperId;
     m_paperSize = data.m_paperSize;
     m_bin = data.m_bin;
+    m_printMode = data.m_printMode;
+    m_filename = data.m_filename;   
     
     m_nativeData = data.GetNativeData();
     m_nativeData->m_ref++;
@@ -240,7 +243,7 @@ void wxPrintData::operator=(const wxPrintData& data)
 // Is this data OK for showing the print dialog?
 bool wxPrintData::Ok() const
 {
-    m_nativeData->ConvertFrom( *this );
+    m_nativeData->TransferFrom( *this );
 
     return m_nativeData->Ok();
 }
@@ -265,7 +268,10 @@ wxPrintDialogData::wxPrintDialogData()
     m_printSelection = false;
     m_printEnableSelection = false;
     m_printEnablePageNumbers = true;
-    m_printEnablePrintToFile = true;
+    
+    wxPrintFactory* factory = wxPrintFactory::GetFactory();
+    m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
+    
     m_printEnableHelp = false;
     m_printSetupDialog = false;
 }
@@ -318,7 +324,7 @@ void wxPrintDialogData::ConvertToNative()
 {
     wxWindowsPrintNativeData *data =
         (wxWindowsPrintNativeData *) m_printData.GetNativeData();
-    data->ConvertFrom( m_printData );
+    data->TransferFrom( m_printData );
 
     PRINTDLG *pd = (PRINTDLG*) m_printDlgData;
 
@@ -356,16 +362,16 @@ void wxPrintDialogData::ConvertToNative()
         GlobalFree(pd->hDevNames);
     }
 
-    pd->hDevMode = (HGLOBAL)(DWORD) data->GetNativeData();
+    pd->hDevMode = (HGLOBAL)(DWORD) data->GetDevMode();
 
-    data->SetNativeData((void*) NULL);
+    data->SetDevMode( (void*) NULL);
 
     // Shouldn't assert; we should be able to test Ok-ness at a higher level
     //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
 
-    pd->hDevNames = (HGLOBAL)(DWORD) data->GetNativeDataDevNames();
+    pd->hDevNames = (HGLOBAL)(DWORD) data->GetDevNames();
 
-    data->SetNativeDataDevNames((void*) NULL);
+    data->SetDevNames( (void*) NULL);
 
     pd->hDC = (HDC) NULL;
     pd->nFromPage = (WORD)m_printFromPage;
@@ -427,30 +433,30 @@ void wxPrintDialogData::ConvertFromNative()
     // Pass the devmode data back to the wxPrintData structure where it really belongs.
     if (pd->hDevMode)
     {
-        if (data->GetNativeData())
+        if (data->GetDevMode())
         {
             // Make sure we don't leak memory
-            GlobalFree( (HGLOBAL)(DWORD) data->GetNativeData() );
+            GlobalFree( (HGLOBAL)(DWORD) data->GetDevMode() );
         }
-        data->SetNativeData( (void*)(long) pd->hDevMode );
+        data->SetDevMode( (void*)(long) pd->hDevMode );
         pd->hDevMode = NULL;
     }
 
     // Pass the devnames data back to the wxPrintData structure where it really belongs.
     if (pd->hDevNames)
     {
-        if (data->GetNativeDataDevNames())
+        if (data->GetDevNames())
         {
             // Make sure we don't leak memory
-            GlobalFree((HGLOBAL)(DWORD) data->GetNativeDataDevNames());
+            GlobalFree((HGLOBAL)(DWORD) data->GetDevNames());
         }
-        data->SetNativeDataDevNames((void*)(long) pd->hDevNames);
+        data->SetDevNames((void*)(long) pd->hDevNames);
         pd->hDevNames = NULL;
     }
 
     // Now convert the DEVMODE object, passed down from the PRINTDLG object,
     // into wxWidgets form.
-    data->ConvertTo( m_printData );
+    data->TransferTo( m_printData );
 
     m_printFromPage = pd->nFromPage;
     m_printToPage = pd->nToPage;
@@ -648,7 +654,7 @@ void wxPageSetupDialogData::ConvertToNative()
 {
     wxWindowsPrintNativeData *data =
         (wxWindowsPrintNativeData *) m_printData.GetNativeData();
-    data->ConvertFrom( m_printData );
+    data->TransferFrom( m_printData );
 
     PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageSetupData;
 
@@ -670,9 +676,9 @@ void wxPageSetupDialogData::ConvertToNative()
         pd->hDevMode = NULL;
     }
 
-    pd->hDevMode = (HGLOBAL) data->GetNativeData();
+    pd->hDevMode = (HGLOBAL) data->GetDevMode();
 
-    data->SetNativeData((void*) NULL);
+    data->SetDevMode( (void*) NULL );
 
     // Shouldn't assert; we should be able to test Ok-ness at a higher level
     //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
@@ -687,9 +693,9 @@ void wxPageSetupDialogData::ConvertToNative()
         pd->hDevNames = NULL;
     }
 
-    pd->hDevNames = (HGLOBAL) data->GetNativeDataDevNames();
+    pd->hDevNames = (HGLOBAL) data->GetDevNames();
 
-    data->SetNativeDataDevNames((void*) NULL);
+    data->SetDevNames((void*) NULL);
 
 //        pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
 
@@ -762,30 +768,30 @@ void wxPageSetupDialogData::ConvertFromNative()
     // Pass the devmode data back to the wxPrintData structure where it really belongs.
     if (pd->hDevMode)
     {
-        if (data->GetNativeData())
+        if (data->GetDevMode())
         {
             // Make sure we don't leak memory
-            GlobalFree((HGLOBAL) data->GetNativeData());
+            GlobalFree((HGLOBAL) data->GetDevMode());
         }
-        data->SetNativeData((void*) pd->hDevMode);
+        data->SetDevMode( (void*) pd->hDevMode );
         pd->hDevMode = NULL;
     }
 
-    data->ConvertTo( m_printData );
+    data->TransferTo( m_printData );
 
     // Pass the devnames data back to the wxPrintData structure where it really belongs.
     if (pd->hDevNames)
     {
-        if (data->GetNativeDataDevNames())
+        if (data->GetDevNames())
         {
             // Make sure we don't leak memory
-            GlobalFree((HGLOBAL) data->GetNativeDataDevNames());
+            GlobalFree((HGLOBAL) data->GetDevNames());
         }
-        data->SetNativeDataDevNames((void*) pd->hDevNames);
+        data->SetDevNames((void*) pd->hDevNames);
         pd->hDevNames = NULL;
     }
 
-    data->ConvertTo( m_printData );
+    data->TransferTo( m_printData );
 
     pd->Flags = PSD_MARGINS|PSD_MINMARGINS;