]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/prntdlgg.cpp
Added OS/2 patches to wxGTK.
[wxWidgets.git] / src / generic / prntdlgg.cpp
index 7b83c709ae8fc43eef5428eed01dbe98cca821aa..526a4df7a6a5ce980c90cd26655b9d2ebc35a288 100644 (file)
 // wxWin macros
 // ----------------------------------------------------------------------------
 
+#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()
+#endif
+
+    IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
 
     BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
         EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
@@ -89,6 +92,8 @@
 
 extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
 
+#if wxUSE_POSTSCRIPT
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -125,7 +130,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
     Init(parent);
 }
 
-void wxGenericPrintDialog::Init(wxWindow *parent)
+void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent))
 {
   //    wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
   //                     wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
@@ -234,7 +239,7 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
         wxString f = wxFileSelector(_("PostScript file"),
             wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
             wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
-            "ps", "*.ps", 0, this);
+            _T("ps"), _T("*.ps"), 0, this);
         if ( f.IsEmpty() )
             return;
 
@@ -242,7 +247,10 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
         wxThePrintSetupData->SetPrinterFile(f);
     }
     else
+    {
+        m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER);
         wxThePrintSetupData->SetPrinterMode(wxPRINT_MODE_PRINTER);
+    }
 
     EndModal(wxID_OK);
 }
@@ -265,6 +273,7 @@ void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
 
 void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
 {
+   *wxThePrintSetupData = m_printDialogData.GetPrintData();
     wxGenericPrintSetupDialog *genericPrintSetupDialog =
         new wxGenericPrintSetupDialog(this, wxThePrintSetupData);
     int ret = genericPrintSetupDialog->ShowModal();
@@ -325,8 +334,8 @@ bool wxGenericPrintDialog::TransferDataFromWindow()
     {
         if (m_printDialogData.GetEnablePageNumbers())
         {
-           if(m_fromText) m_printDialogData.SetFromPage(atoi(m_fromText->GetValue()));
-           if(m_toText)   m_printDialogData.SetToPage(atoi(m_toText->GetValue()));
+           if(m_fromText) m_printDialogData.SetFromPage(wxAtoi(m_fromText->GetValue()));
+           if(m_toText)   m_printDialogData.SetToPage(wxAtoi(m_toText->GetValue()));
         }
         if(m_rangeRadioBox)
         {
@@ -341,7 +350,7 @@ bool wxGenericPrintDialog::TransferDataFromWindow()
         m_printDialogData.SetFromPage(1);
         m_printDialogData.SetToPage(32000);
     }
-    m_printDialogData.SetNoCopies(atoi(m_noCopiesText->GetValue()));
+    m_printDialogData.SetNoCopies(wxAtoi(m_noCopiesText->GetValue()));
     m_printDialogData.SetPrintToFile(m_printToFileCheckBox->GetValue());
 
     return TRUE;
@@ -354,7 +363,8 @@ TODO: collate and noCopies should be duplicated across dialog data and print dat
 
 wxDC *wxGenericPrintDialog::GetPrintDC()
 {
-    return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
+  //    return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
+  return new wxPostScriptDC(GetPrintDialogData().GetPrintData());
 }
 
 // ----------------------------------------------------------------------------
@@ -690,9 +700,9 @@ bool wxGenericPageSetupDialog::TransferDataToWindow()
 bool wxGenericPageSetupDialog::TransferDataFromWindow()
 {
     if (m_marginLeftText && m_marginTopText)
-        m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue())));
+        m_pageData.SetMarginTopLeft(wxPoint(wxAtoi((const wxChar *)m_marginLeftText->GetValue()),wxAtoi((const wxChar *)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.SetMarginBottomRight(wxPoint(wxAtoi((const wxChar *)m_marginRightText->GetValue()),wxAtoi((const wxChar *)m_marginBottomText->GetValue())));
 
     if (m_orientationRadioBox)
     {