]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmndata.cpp
make cocoa mediactrl usable. Some touchups to carbon mediactrl code. Add notebook...
[wxWidgets.git] / src / common / cmndata.cpp
index d75430ee5d4d728138cede0256b91da5462c405e..e49c5e1d9dee60b9fff04b4d5b45787a80171f09 100644 (file)
@@ -49,7 +49,7 @@
     #include "wx/paper.h"
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
     #include "wx/paper.h"
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
-#if defined(__WXMSW__) && !defined(__PALMOS__)
+#if defined(__WXMSW__)
     #include <windowsx.h>
     #include "wx/msw/private.h"
 
     #include <windowsx.h>
     #include "wx/msw/private.h"
 
@@ -177,7 +177,7 @@ wxPrintData::wxPrintData()
     m_printCollate = false;
 
     // New, 24/3/99
     m_printCollate = false;
 
     // New, 24/3/99
-    m_printerName = wxT("");
+    m_printerName = wxEmptyString;
     m_colour = true;
     m_duplexMode = wxDUPLEX_SIMPLEX;
     m_printQuality = wxPRINT_QUALITY_HIGH;
     m_colour = true;
     m_duplexMode = wxDUPLEX_SIMPLEX;
     m_printQuality = wxPRINT_QUALITY_HIGH;
@@ -190,15 +190,16 @@ wxPrintData::wxPrintData()
 wxPrintData::wxPrintData(const wxPrintData& printData)
     : wxObject()
 {
 wxPrintData::wxPrintData(const wxPrintData& printData)
     : wxObject()
 {
+    m_nativeData = NULL;
     (*this) = printData;
 }
 
 wxPrintData::~wxPrintData()
 {
     m_nativeData->m_ref--;
     (*this) = printData;
 }
 
 wxPrintData::~wxPrintData()
 {
     m_nativeData->m_ref--;
-    if (m_nativeData->m_ref == 0) 
+    if (m_nativeData->m_ref == 0)
         delete m_nativeData;
         delete m_nativeData;
-        
+
 #ifdef __WXMAC__
     delete m_nativePrintData ;
 #endif
 #ifdef __WXMAC__
     delete m_nativePrintData ;
 #endif
@@ -235,16 +236,19 @@ void wxPrintData::operator=(const wxPrintData& data)
     m_paperSize = data.m_paperSize;
     m_bin = data.m_bin;
     m_printMode = data.m_printMode;
     m_paperSize = data.m_paperSize;
     m_bin = data.m_bin;
     m_printMode = data.m_printMode;
-    m_filename = data.m_filename;   
+    m_filename = data.m_filename;
 
 
-    // UnRef old m_nativeData    
-    m_nativeData->m_ref--;
-    if (m_nativeData->m_ref == 0) 
-        delete m_nativeData;
+    // UnRef old m_nativeData
+    if (m_nativeData)
+    {
+        m_nativeData->m_ref--;
+        if (m_nativeData->m_ref == 0)
+            delete m_nativeData;
+    }
     // Set Ref new one
     m_nativeData = data.GetNativeData();
     m_nativeData->m_ref++;
     // Set Ref new one
     m_nativeData = data.GetNativeData();
     m_nativeData->m_ref++;
-    
+
 #ifdef __WXMAC__
     m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
 #endif
 #ifdef __WXMAC__
     m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
 #endif
@@ -258,7 +262,9 @@ bool wxPrintData::Ok() const
     return m_nativeData->Ok();
 }
 
     return m_nativeData->Ok();
 }
 
-#if WXWIN_COMPATIBILITY_2_4
+// What should happen here?  wxPostScriptPrintNativeData is not
+// defined unless all this is true on MSW.
+#if WXWIN_COMPATIBILITY_2_4 && wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
 
 #include "wx/generic/prntdlgg.h"
 
 
 #include "wx/generic/prntdlgg.h"
 
@@ -274,7 +280,7 @@ wxString wxPrintData::GetPrinterCommand() const
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand();
 #endif
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand();
 #endif
-    return wxT("");
+    return wxEmptyString;
 }
 
 wxString wxPrintData::GetPrinterOptions() const
 }
 
 wxString wxPrintData::GetPrinterOptions() const
@@ -283,7 +289,7 @@ wxString wxPrintData::GetPrinterOptions() const
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions();
 #endif
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions();
 #endif
-    return wxT("");
+    return wxEmptyString;
 }
 
 wxString wxPrintData::GetPreviewCommand() const
 }
 
 wxString wxPrintData::GetPreviewCommand() const
@@ -292,7 +298,7 @@ wxString wxPrintData::GetPreviewCommand() const
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand();
 #endif
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand();
 #endif
-    return wxT("");
+    return wxEmptyString;
 }
 
 wxString wxPrintData::GetFontMetricPath() const
 }
 
 wxString wxPrintData::GetFontMetricPath() const
@@ -301,7 +307,7 @@ wxString wxPrintData::GetFontMetricPath() const
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath();
 #endif
     if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
         return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath();
 #endif
-    return wxT("");
+    return wxEmptyString;
 }
 
 double wxPrintData::GetPrinterScaleX() const
 }
 
 double wxPrintData::GetPrinterScaleX() const
@@ -438,10 +444,10 @@ wxPrintDialogData::wxPrintDialogData()
     m_printSelection = false;
     m_printEnableSelection = false;
     m_printEnablePageNumbers = true;
     m_printSelection = false;
     m_printEnableSelection = false;
     m_printEnablePageNumbers = true;
-    
+
     wxPrintFactory* factory = wxPrintFactory::GetFactory();
     m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
     wxPrintFactory* factory = wxPrintFactory::GetFactory();
     m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
-    
+
     m_printEnableHelp = false;
 #if WXWIN_COMPATIBILITY_2_4
     m_printSetupDialog = false;
     m_printEnableHelp = false;
 #if WXWIN_COMPATIBILITY_2_4
     m_printSetupDialog = false;
@@ -604,6 +610,7 @@ wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogD
 wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data)
 {
     m_printData = data;
 wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data)
 {
     m_printData = data;
+    CalculatePaperSizeFromId();
 
     return *this;
 }
 
     return *this;
 }
@@ -655,6 +662,12 @@ void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
     CalculatePaperSizeFromId();
 }
 
     CalculatePaperSizeFromId();
 }
 
+void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData)
+{
+    m_printData = printData;
+    CalculatePaperSizeFromId();
+}
+
 // Use paper size defined in this object to set the wxPrintData
 // paper id
 void wxPageSetupDialogData::CalculateIdFromPaperSize()
 // Use paper size defined in this object to set the wxPrintData
 // paper id
 void wxPageSetupDialogData::CalculateIdFromPaperSize()