From fd64de596c085f81aa3ef7d8ee6b2f4afebbed8e Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 17 Oct 2004 23:00:41 +0000 Subject: [PATCH] Renamed wxPrintNativeData methods to better match those of the preexisting wxMac class. This should make transition of the wxMac classes to the new wxPrintNativeData classes easier. Renamed wxWindowsPrintNativeData to a proper name that is less confusing (GetNativeData -> GetDevMode). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29956 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/prntdlgg.h | 4 +-- include/wx/mac/carbon/printdlg.h | 4 +-- include/wx/msw/printdlg.h | 16 +++++----- include/wx/prntbase.h | 4 +-- src/common/cmndata.cpp | 52 ++++++++++++++++---------------- src/generic/prntdlgg.cpp | 18 +++++------ src/msw/dcprint.cpp | 4 +-- src/msw/printdlg.cpp | 4 +-- 8 files changed, 52 insertions(+), 54 deletions(-) diff --git a/include/wx/generic/prntdlgg.h b/include/wx/generic/prntdlgg.h index 15c632588f..7793f07367 100644 --- a/include/wx/generic/prntdlgg.h +++ b/include/wx/generic/prntdlgg.h @@ -85,8 +85,8 @@ public: wxPostScriptPrintNativeData(); virtual ~wxPostScriptPrintNativeData(); - virtual bool ConvertTo( wxPrintData &data ); - virtual bool ConvertFrom( const wxPrintData &data ); + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); virtual bool Ok() const { return true; } diff --git a/include/wx/mac/carbon/printdlg.h b/include/wx/mac/carbon/printdlg.h index 6c895d2434..c7f92db66c 100644 --- a/include/wx/mac/carbon/printdlg.h +++ b/include/wx/mac/carbon/printdlg.h @@ -33,8 +33,8 @@ public: wxMacPrintNativeData() {}; virtual ~wxMacPrintNativeData() {}; - virtual bool ConvertTo( wxPrintData &data ) { return true; } - virtual bool ConvertFrom( const wxPrintData &data ) { return true; } + virtual bool TransferTo( wxPrintData &data ) { return true; } + virtual bool TransferFrom( const wxPrintData &data ) { return true; } virtual bool Ok() const { return true; } }; diff --git a/include/wx/msw/printdlg.h b/include/wx/msw/printdlg.h index b8bebcc695..681878516c 100644 --- a/include/wx/msw/printdlg.h +++ b/include/wx/msw/printdlg.h @@ -35,19 +35,19 @@ public: wxWindowsPrintNativeData(); virtual ~wxWindowsPrintNativeData(); - virtual bool ConvertTo( wxPrintData &data ); - virtual bool ConvertFrom( const wxPrintData &data ); + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); virtual bool Ok() const; - void* GetNativeData() const { return m_devMode; } - void SetNativeData(void* data) { m_devMode = data; } - void* GetNativeDataDevNames() const { return m_devNames; } - void SetNativeDataDevNames(void* data) { m_devNames = data; } + void* GetDevMode() const { return m_devMode; } + void SetDevMode(void* data) { m_devMode = data; } + void* GetDevNames() const { return m_devNames; } + void SetDevNames(void* data) { m_devNames = data; } private: - void* m_devMode; - void* m_devNames; + void* m_devMode; + void* m_devNames; private: DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) diff --git a/include/wx/prntbase.h b/include/wx/prntbase.h index 4da1b0c9be..5e65d6119b 100644 --- a/include/wx/prntbase.h +++ b/include/wx/prntbase.h @@ -121,8 +121,8 @@ public: wxPrintNativeDataBase(); virtual ~wxPrintNativeDataBase() {} - virtual bool ConvertTo( wxPrintData &data ) = 0; - virtual bool ConvertFrom( const wxPrintData &data ) = 0; + virtual bool TransferTo( wxPrintData &data ) = 0; + virtual bool TransferFrom( const wxPrintData &data ) = 0; virtual bool Ok() const = 0; diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index d24faf8713..9779d87fdb 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -240,7 +240,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(); } @@ -318,7 +318,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 +356,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 +427,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 +648,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 +670,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 +687,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 +762,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; diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index b7538e9d00..42a2299da4 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -113,12 +113,12 @@ wxPostScriptPrintNativeData::~wxPostScriptPrintNativeData() { } -bool wxPostScriptPrintNativeData::ConvertTo( wxPrintData &data ) +bool wxPostScriptPrintNativeData::TransferTo( wxPrintData &data ) { return true; } -bool wxPostScriptPrintNativeData::ConvertFrom( const wxPrintData &data ) +bool wxPostScriptPrintNativeData::TransferFrom( const wxPrintData &data ) { return true; } @@ -253,18 +253,16 @@ int wxGenericPrintDialog::ShowModal() // present, but there might be in future. // TransferDataFromWindow(); - wxGenericPrintSetupDialog *genericPrintSetupDialog = - new wxGenericPrintSetupDialog(this, & m_printDialogData.GetPrintData()); - int ret = genericPrintSetupDialog->ShowModal(); - if ( ret != wxID_CANCEL ) + wxGenericPrintSetupDialog genericPrintSetupDialog( this, &m_printDialogData.GetPrintData() ); + int ret = genericPrintSetupDialog.ShowModal(); + if (ret != wxID_CANCEL) { // Transfer settings to the print dialog's print data. - m_printDialogData.GetPrintData() = genericPrintSetupDialog->GetPrintData(); + m_printDialogData.GetPrintData() = genericPrintSetupDialog.GetPrintData(); } - // genericPrintSetupDialog->Destroy(); - // Restore the wxPrintData settings again (uncomment if any settings become common - // to both dialogs) + // Restore the wxPrintData settings again (uncomment if any settings become + // common to both dialogs) // TransferDataToWindow(); return ret; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index e817ba1989..fc748ce751 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -286,7 +286,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) wxWindowsPrintNativeData *data = (wxWindowsPrintNativeData *) printDataConst.GetNativeData(); - data->ConvertFrom( printDataConst ); + data->TransferFrom( printDataConst ); wxChar* driverName = (wxChar*) NULL; @@ -301,7 +301,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) LPDEVMODE lpDevMode = (LPDEVMODE) NULL; - HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetNativeData(); + HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode(); if ( hDevMode ) lpDevMode = (DEVMODE*) GlobalLock(hDevMode); diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index a24155a4f6..86598e7ca1 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -146,7 +146,7 @@ bool wxWindowsPrintNativeData::Ok() const return (m_devMode != NULL) ; } -bool wxWindowsPrintNativeData::ConvertTo( wxPrintData &data ) +bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data ) { HGLOBAL hDevMode = (HGLOBAL)(DWORD) m_devMode; HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; @@ -308,7 +308,7 @@ bool wxWindowsPrintNativeData::ConvertTo( wxPrintData &data ) return true; } -bool wxWindowsPrintNativeData::ConvertFrom( const wxPrintData &data ) +bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) { HGLOBAL hDevMode = (HGLOBAL)(DWORD) m_devMode; HGLOBAL hDevNames = (HGLOBAL)(DWORD) m_devNames; -- 2.45.2