Moved the wxPageSetupDialogData <-> native conversion
code for MSW to the appropriate file in src/msw/printdlg.cpp Removed the now obsolete printer setup dialog code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
072a99f431
commit
b45dfd0a8b
@ -275,8 +275,9 @@ public:
|
|||||||
bool GetSelection() const { return m_printSelection; };
|
bool GetSelection() const { return m_printSelection; };
|
||||||
bool GetCollate() const { return m_printCollate; };
|
bool GetCollate() const { return m_printCollate; };
|
||||||
bool GetPrintToFile() const { return m_printToFile; };
|
bool GetPrintToFile() const { return m_printToFile; };
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
bool GetSetupDialog() const { return m_printSetupDialog; };
|
bool GetSetupDialog() const { return m_printSetupDialog; };
|
||||||
|
#endif
|
||||||
void SetFromPage(int v) { m_printFromPage = v; };
|
void SetFromPage(int v) { m_printFromPage = v; };
|
||||||
void SetToPage(int v) { m_printToPage = v; };
|
void SetToPage(int v) { m_printToPage = v; };
|
||||||
void SetMinPage(int v) { m_printMinPage = v; };
|
void SetMinPage(int v) { m_printMinPage = v; };
|
||||||
@ -286,8 +287,9 @@ public:
|
|||||||
void SetSelection(bool flag) { m_printSelection = flag; };
|
void SetSelection(bool flag) { m_printSelection = flag; };
|
||||||
void SetCollate(bool flag) { m_printCollate = flag; };
|
void SetCollate(bool flag) { m_printCollate = flag; };
|
||||||
void SetPrintToFile(bool flag) { m_printToFile = flag; };
|
void SetPrintToFile(bool flag) { m_printToFile = flag; };
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
|
void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
|
||||||
|
#endif
|
||||||
void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
|
void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
|
||||||
void EnableSelection(bool flag) { m_printEnableSelection = flag; };
|
void EnableSelection(bool flag) { m_printEnableSelection = flag; };
|
||||||
void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
|
void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
|
||||||
@ -326,7 +328,9 @@ private:
|
|||||||
bool m_printEnablePageNumbers;
|
bool m_printEnablePageNumbers;
|
||||||
bool m_printEnableHelp;
|
bool m_printEnableHelp;
|
||||||
bool m_printEnablePrintToFile;
|
bool m_printEnablePrintToFile;
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
bool m_printSetupDialog;
|
bool m_printSetupDialog;
|
||||||
|
#endif
|
||||||
wxPrintData m_printData;
|
wxPrintData m_printData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -388,13 +392,7 @@ public:
|
|||||||
void EnablePrinter(bool flag) { m_enablePrinter = flag; };
|
void EnablePrinter(bool flag) { m_enablePrinter = flag; };
|
||||||
void EnableHelp(bool flag) { m_enableHelp = flag; };
|
void EnableHelp(bool flag) { m_enableHelp = flag; };
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WXMAC__)
|
||||||
// Convert to/from the PAGESETUPDLG structure
|
|
||||||
void ConvertToNative();
|
|
||||||
void ConvertFromNative();
|
|
||||||
void SetOwnerWindow(wxWindow* win);
|
|
||||||
void* GetNativeData() const { return m_pageSetupData; }
|
|
||||||
#elif defined(__WXMAC__)
|
|
||||||
void ConvertToNative();
|
void ConvertToNative();
|
||||||
void ConvertFromNative();
|
void ConvertFromNative();
|
||||||
#endif
|
#endif
|
||||||
@ -412,10 +410,6 @@ public:
|
|||||||
wxPrintData& GetPrintData() { return m_printData; }
|
wxPrintData& GetPrintData() { return m_printData; }
|
||||||
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
|
||||||
void* m_pageSetupData;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
|
wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
|
||||||
wxPoint m_minMarginTopLeft;
|
wxPoint m_minMarginTopLeft;
|
||||||
|
@ -331,7 +331,6 @@ public:
|
|||||||
void OnFileSave(wxCommandEvent& event);
|
void OnFileSave(wxCommandEvent& event);
|
||||||
void OnFileSaveAs(wxCommandEvent& event);
|
void OnFileSaveAs(wxCommandEvent& event);
|
||||||
void OnPrint(wxCommandEvent& event);
|
void OnPrint(wxCommandEvent& event);
|
||||||
void OnPrintSetup(wxCommandEvent& event);
|
|
||||||
void OnPreview(wxCommandEvent& event);
|
void OnPreview(wxCommandEvent& event);
|
||||||
void OnUndo(wxCommandEvent& event);
|
void OnUndo(wxCommandEvent& event);
|
||||||
void OnRedo(wxCommandEvent& event);
|
void OnRedo(wxCommandEvent& event);
|
||||||
@ -347,7 +346,6 @@ public:
|
|||||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
void OnUpdatePrint(wxUpdateUIEvent& event);
|
void OnUpdatePrint(wxUpdateUIEvent& event);
|
||||||
void OnUpdatePrintSetup(wxUpdateUIEvent& event);
|
|
||||||
void OnUpdatePreview(wxUpdateUIEvent& event);
|
void OnUpdatePreview(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
// Extend event processing to search the view's event table
|
// Extend event processing to search the view's event table
|
||||||
|
@ -232,7 +232,6 @@ public:
|
|||||||
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
||||||
// Print file / html-text w/o preview
|
// Print file / html-text w/o preview
|
||||||
|
|
||||||
void PrinterSetup();
|
|
||||||
void PageSetup();
|
void PageSetup();
|
||||||
// pop up printer or page setup dialog
|
// pop up printer or page setup dialog
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ bool MyApp::OnInit(void)
|
|||||||
wxMenu *file_menu = new wxMenu;
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
|
||||||
file_menu->Append(WXPRINT_PRINT, _T("&Print..."), _T("Print"));
|
file_menu->Append(WXPRINT_PRINT, _T("&Print..."), _T("Print"));
|
||||||
file_menu->Append(WXPRINT_PRINT_SETUP, _T("Print &Setup..."), _T("Setup printer properties"));
|
|
||||||
file_menu->Append(WXPRINT_PAGE_SETUP, _T("Page Set&up..."), _T("Page setup"));
|
file_menu->Append(WXPRINT_PAGE_SETUP, _T("Page Set&up..."), _T("Page setup"));
|
||||||
file_menu->Append(WXPRINT_PREVIEW, _T("Print Pre&view"), _T("Preview"));
|
file_menu->Append(WXPRINT_PREVIEW, _T("Print Pre&view"), _T("Preview"));
|
||||||
|
|
||||||
@ -105,7 +104,6 @@ bool MyApp::OnInit(void)
|
|||||||
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
||||||
file_menu->AppendSeparator();
|
file_menu->AppendSeparator();
|
||||||
file_menu->Append(WXPRINT_PRINT_PS, _T("Print PostScript..."), _T("Print (PostScript)"));
|
file_menu->Append(WXPRINT_PRINT_PS, _T("Print PostScript..."), _T("Print (PostScript)"));
|
||||||
file_menu->Append(WXPRINT_PRINT_SETUP_PS, _T("Print Setup PostScript..."), _T("Setup printer properties (PostScript)"));
|
|
||||||
file_menu->Append(WXPRINT_PAGE_SETUP_PS, _T("Page Setup PostScript..."), _T("Page setup (PostScript)"));
|
file_menu->Append(WXPRINT_PAGE_SETUP_PS, _T("Page Setup PostScript..."), _T("Page setup (PostScript)"));
|
||||||
file_menu->Append(WXPRINT_PREVIEW_PS, _T("Print Preview PostScript"), _T("Preview (PostScript)"));
|
file_menu->Append(WXPRINT_PREVIEW_PS, _T("Print Preview PostScript"), _T("Preview (PostScript)"));
|
||||||
#endif
|
#endif
|
||||||
@ -153,13 +151,11 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
|
EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
|
||||||
EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
|
EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
|
||||||
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
|
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
|
||||||
EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
|
|
||||||
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
|
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
|
||||||
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
|
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
|
||||||
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
||||||
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
|
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
|
||||||
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
|
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
|
||||||
EVT_MENU(WXPRINT_PRINT_SETUP_PS, MyFrame::OnPrintSetupPS)
|
|
||||||
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
|
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
|
||||||
#endif
|
#endif
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@ -213,17 +209,6 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
|
|||||||
frame->Show();
|
frame->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
wxPrintDialogData printDialogData(* g_printData);
|
|
||||||
wxPrintDialog printerDialog(this, & printDialogData);
|
|
||||||
|
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(true /*show print setup dialog*/);
|
|
||||||
printerDialog.ShowModal();
|
|
||||||
|
|
||||||
(*g_printData) = printerDialog.GetPrintDialogData().GetPrintData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
(*g_pageSetupData) = * g_printData;
|
(*g_pageSetupData) = * g_printData;
|
||||||
@ -256,17 +241,6 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
|
|||||||
frame->Show();
|
frame->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
wxPrintDialogData printDialogData(* g_printData);
|
|
||||||
wxGenericPrintDialog printerDialog(this, & printDialogData);
|
|
||||||
|
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(true /*show print setup dialog*/);
|
|
||||||
printerDialog.ShowModal();
|
|
||||||
|
|
||||||
(*g_printData) = printerDialog.GetPrintDialogData().GetPrintData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
(*g_pageSetupData) = * g_printData;
|
(*g_pageSetupData) = * g_printData;
|
||||||
|
@ -40,12 +40,10 @@ class MyFrame: public wxFrame
|
|||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnPrint(wxCommandEvent& event);
|
void OnPrint(wxCommandEvent& event);
|
||||||
void OnPrintPreview(wxCommandEvent& event);
|
void OnPrintPreview(wxCommandEvent& event);
|
||||||
void OnPrintSetup(wxCommandEvent& event);
|
|
||||||
void OnPageSetup(wxCommandEvent& event);
|
void OnPageSetup(wxCommandEvent& event);
|
||||||
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
|
||||||
void OnPrintPS(wxCommandEvent& event);
|
void OnPrintPS(wxCommandEvent& event);
|
||||||
void OnPrintPreviewPS(wxCommandEvent& event);
|
void OnPrintPreviewPS(wxCommandEvent& event);
|
||||||
void OnPrintSetupPS(wxCommandEvent& event);
|
|
||||||
void OnPageSetupPS(wxCommandEvent& event);
|
void OnPageSetupPS(wxCommandEvent& event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -82,12 +80,10 @@ class MyPrintout: public wxPrintout
|
|||||||
|
|
||||||
#define WXPRINT_QUIT 100
|
#define WXPRINT_QUIT 100
|
||||||
#define WXPRINT_PRINT 101
|
#define WXPRINT_PRINT 101
|
||||||
#define WXPRINT_PRINT_SETUP 102
|
|
||||||
#define WXPRINT_PAGE_SETUP 103
|
#define WXPRINT_PAGE_SETUP 103
|
||||||
#define WXPRINT_PREVIEW 104
|
#define WXPRINT_PREVIEW 104
|
||||||
|
|
||||||
#define WXPRINT_PRINT_PS 105
|
#define WXPRINT_PRINT_PS 105
|
||||||
#define WXPRINT_PRINT_SETUP_PS 106
|
|
||||||
#define WXPRINT_PAGE_SETUP_PS 107
|
#define WXPRINT_PAGE_SETUP_PS 107
|
||||||
#define WXPRINT_PREVIEW_PS 108
|
#define WXPRINT_PREVIEW_PS 108
|
||||||
|
|
||||||
|
@ -276,7 +276,9 @@ wxPrintDialogData::wxPrintDialogData()
|
|||||||
m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
|
m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
|
||||||
|
|
||||||
m_printEnableHelp = false;
|
m_printEnableHelp = false;
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
m_printSetupDialog = false;
|
m_printSetupDialog = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
|
wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
|
||||||
@ -300,8 +302,9 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData)
|
|||||||
m_printEnablePageNumbers = true;
|
m_printEnablePageNumbers = true;
|
||||||
m_printEnablePrintToFile = true;
|
m_printEnablePrintToFile = true;
|
||||||
m_printEnableHelp = false;
|
m_printEnableHelp = false;
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
m_printSetupDialog = false;
|
m_printSetupDialog = false;
|
||||||
|
#endif
|
||||||
m_printData = printData;
|
m_printData = printData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,8 +344,9 @@ void wxPrintDialogData::operator=(const wxPrintDialogData& data)
|
|||||||
m_printEnablePageNumbers = data.m_printEnablePageNumbers;
|
m_printEnablePageNumbers = data.m_printEnablePageNumbers;
|
||||||
m_printEnableHelp = data.m_printEnableHelp;
|
m_printEnableHelp = data.m_printEnableHelp;
|
||||||
m_printEnablePrintToFile = data.m_printEnablePrintToFile;
|
m_printEnablePrintToFile = data.m_printEnablePrintToFile;
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
m_printSetupDialog = data.m_printSetupDialog;
|
m_printSetupDialog = data.m_printSetupDialog;
|
||||||
|
#endif
|
||||||
m_printData = data.m_printData;
|
m_printData = data.m_printData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,9 +361,6 @@ void wxPrintDialogData::operator=(const wxPrintData& data)
|
|||||||
|
|
||||||
wxPageSetupDialogData::wxPageSetupDialogData()
|
wxPageSetupDialogData::wxPageSetupDialogData()
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__)
|
|
||||||
m_pageSetupData = NULL;
|
|
||||||
#endif
|
|
||||||
m_paperSize = wxSize(0, 0);
|
m_paperSize = wxSize(0, 0);
|
||||||
|
|
||||||
CalculatePaperSizeFromId();
|
CalculatePaperSizeFromId();
|
||||||
@ -382,17 +383,11 @@ wxPageSetupDialogData::wxPageSetupDialogData()
|
|||||||
wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
|
wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
|
||||||
: wxObject()
|
: wxObject()
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__)
|
|
||||||
m_pageSetupData = NULL;
|
|
||||||
#endif
|
|
||||||
(*this) = dialogData;
|
(*this) = dialogData;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
|
wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__)
|
|
||||||
m_pageSetupData = NULL;
|
|
||||||
#endif
|
|
||||||
m_paperSize = wxSize(0, 0);
|
m_paperSize = wxSize(0, 0);
|
||||||
m_minMarginTopLeft = wxPoint(0, 0);
|
m_minMarginTopLeft = wxPoint(0, 0);
|
||||||
m_minMarginBottomRight = wxPoint(0, 0);
|
m_minMarginBottomRight = wxPoint(0, 0);
|
||||||
@ -417,15 +412,6 @@ wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
|
|||||||
|
|
||||||
wxPageSetupDialogData::~wxPageSetupDialogData()
|
wxPageSetupDialogData::~wxPageSetupDialogData()
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && defined(__WXMSW__)
|
|
||||||
PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageSetupData;
|
|
||||||
if ( pd && pd->hDevMode )
|
|
||||||
GlobalFree(pd->hDevMode);
|
|
||||||
if ( pd && pd->hDevNames )
|
|
||||||
GlobalFree(pd->hDevNames);
|
|
||||||
if ( pd )
|
|
||||||
delete pd;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data)
|
wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data)
|
||||||
@ -455,188 +441,6 @@ wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
|
||||||
void wxPageSetupDialogData::ConvertToNative()
|
|
||||||
{
|
|
||||||
wxWindowsPrintNativeData *data =
|
|
||||||
(wxWindowsPrintNativeData *) m_printData.GetNativeData();
|
|
||||||
data->TransferFrom( m_printData );
|
|
||||||
|
|
||||||
PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageSetupData;
|
|
||||||
|
|
||||||
if ( m_pageSetupData == NULL )
|
|
||||||
{
|
|
||||||
pd = new PAGESETUPDLG;
|
|
||||||
pd->hDevMode = NULL;
|
|
||||||
pd->hDevNames = NULL;
|
|
||||||
m_pageSetupData = (void *)pd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass the devmode data (created in m_printData.ConvertToNative)
|
|
||||||
// to the PRINTDLG structure, since it'll
|
|
||||||
// be needed when PrintDlg is called.
|
|
||||||
|
|
||||||
if (pd->hDevMode)
|
|
||||||
{
|
|
||||||
GlobalFree(pd->hDevMode);
|
|
||||||
pd->hDevMode = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pd->hDevMode = (HGLOBAL) data->GetDevMode();
|
|
||||||
|
|
||||||
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!"));
|
|
||||||
|
|
||||||
// Pass the devnames data (created in m_printData.ConvertToNative)
|
|
||||||
// to the PRINTDLG structure, since it'll
|
|
||||||
// be needed when PrintDlg is called.
|
|
||||||
|
|
||||||
if (pd->hDevNames)
|
|
||||||
{
|
|
||||||
GlobalFree(pd->hDevNames);
|
|
||||||
pd->hDevNames = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pd->hDevNames = (HGLOBAL) data->GetDevNames();
|
|
||||||
|
|
||||||
data->SetDevNames((void*) NULL);
|
|
||||||
|
|
||||||
// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
|
|
||||||
|
|
||||||
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
|
||||||
|
|
||||||
if ( m_defaultMinMargins )
|
|
||||||
pd->Flags |= PSD_DEFAULTMINMARGINS;
|
|
||||||
if ( !m_enableMargins )
|
|
||||||
pd->Flags |= PSD_DISABLEMARGINS;
|
|
||||||
if ( !m_enableOrientation )
|
|
||||||
pd->Flags |= PSD_DISABLEORIENTATION;
|
|
||||||
if ( !m_enablePaper )
|
|
||||||
pd->Flags |= PSD_DISABLEPAPER;
|
|
||||||
if ( !m_enablePrinter )
|
|
||||||
pd->Flags |= PSD_DISABLEPRINTER;
|
|
||||||
if ( m_getDefaultInfo )
|
|
||||||
pd->Flags |= PSD_RETURNDEFAULT;
|
|
||||||
if ( m_enableHelp )
|
|
||||||
pd->Flags |= PSD_SHOWHELP;
|
|
||||||
|
|
||||||
// We want the units to be in hundredths of a millimetre
|
|
||||||
pd->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
|
|
||||||
|
|
||||||
pd->lStructSize = sizeof( PAGESETUPDLG );
|
|
||||||
pd->hwndOwner=(HWND)NULL;
|
|
||||||
// pd->hDevNames=(HWND)NULL;
|
|
||||||
pd->hInstance=(HINSTANCE)NULL;
|
|
||||||
// PAGESETUPDLG is in hundreds of a mm
|
|
||||||
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->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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ( pd->hDevMode )
|
|
||||||
{
|
|
||||||
DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
|
|
||||||
memset(devMode, 0, sizeof(DEVMODE));
|
|
||||||
devMode->dmSize = sizeof(DEVMODE);
|
|
||||||
devMode->dmOrientation = m_orientation;
|
|
||||||
devMode->dmFields = DM_ORIENTATION;
|
|
||||||
GlobalUnlock(pd->hDevMode);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxPageSetupDialogData::ConvertFromNative()
|
|
||||||
{
|
|
||||||
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData;
|
|
||||||
if ( !pd )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxWindowsPrintNativeData *data =
|
|
||||||
(wxWindowsPrintNativeData *) m_printData.GetNativeData();
|
|
||||||
|
|
||||||
// Pass the devmode data back to the wxPrintData structure where it really belongs.
|
|
||||||
if (pd->hDevMode)
|
|
||||||
{
|
|
||||||
if (data->GetDevMode())
|
|
||||||
{
|
|
||||||
// Make sure we don't leak memory
|
|
||||||
GlobalFree((HGLOBAL) data->GetDevMode());
|
|
||||||
}
|
|
||||||
data->SetDevMode( (void*) pd->hDevMode );
|
|
||||||
pd->hDevMode = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
data->TransferTo( m_printData );
|
|
||||||
|
|
||||||
// Pass the devnames data back to the wxPrintData structure where it really belongs.
|
|
||||||
if (pd->hDevNames)
|
|
||||||
{
|
|
||||||
if (data->GetDevNames())
|
|
||||||
{
|
|
||||||
// Make sure we don't leak memory
|
|
||||||
GlobalFree((HGLOBAL) data->GetDevNames());
|
|
||||||
}
|
|
||||||
data->SetDevNames((void*) pd->hDevNames);
|
|
||||||
pd->hDevNames = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
data->TransferTo( m_printData );
|
|
||||||
|
|
||||||
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_enablePaper = ((pd->Flags & PSD_DISABLEPAPER) != PSD_DISABLEPAPER);
|
|
||||||
m_enablePrinter = ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER);
|
|
||||||
m_getDefaultInfo = ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT);
|
|
||||||
m_enableHelp = ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP);
|
|
||||||
|
|
||||||
// PAGESETUPDLG is in hundreds of a mm
|
|
||||||
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_marginTopLeft.x = pd->rtMargin.left / 100;
|
|
||||||
m_marginTopLeft.y = pd->rtMargin.top / 100;
|
|
||||||
m_marginBottomRight.x = pd->rtMargin.right / 100;
|
|
||||||
m_marginBottomRight.y = pd->rtMargin.bottom / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
|
|
||||||
{
|
|
||||||
if ( m_pageSetupData == NULL )
|
|
||||||
ConvertToNative();
|
|
||||||
|
|
||||||
if ( m_pageSetupData != NULL && win != NULL)
|
|
||||||
{
|
|
||||||
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData;
|
|
||||||
pd->hwndOwner=(HWND) win->GetHWND();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // Win95
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
void wxPageSetupDialogData::ConvertToNative()
|
void wxPageSetupDialogData::ConvertToNative()
|
||||||
{
|
{
|
||||||
|
@ -837,11 +837,9 @@ BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler)
|
|||||||
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
EVT_MENU(wxID_PRINT, wxDocManager::OnPrint)
|
EVT_MENU(wxID_PRINT, wxDocManager::OnPrint)
|
||||||
EVT_MENU(wxID_PRINT_SETUP, wxDocManager::OnPrintSetup)
|
|
||||||
EVT_MENU(wxID_PREVIEW, wxDocManager::OnPreview)
|
EVT_MENU(wxID_PREVIEW, wxDocManager::OnPreview)
|
||||||
|
|
||||||
EVT_UPDATE_UI(wxID_PRINT, wxDocManager::OnUpdatePrint)
|
EVT_UPDATE_UI(wxID_PRINT, wxDocManager::OnUpdatePrint)
|
||||||
EVT_UPDATE_UI(wxID_PRINT_SETUP, wxDocManager::OnUpdatePrintSetup)
|
|
||||||
EVT_UPDATE_UI(wxID_PREVIEW, wxDocManager::OnUpdatePreview)
|
EVT_UPDATE_UI(wxID_PREVIEW, wxDocManager::OnUpdatePreview)
|
||||||
#endif
|
#endif
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@ -1005,22 +1003,6 @@ void wxDocManager::OnPrint(wxCommandEvent& WXUNUSED(event))
|
|||||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDocManager::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
|
||||||
wxWindow *parentWin = wxTheApp->GetTopWindow();
|
|
||||||
wxView *view = GetCurrentView();
|
|
||||||
if (view)
|
|
||||||
parentWin = view->GetFrame();
|
|
||||||
|
|
||||||
wxPrintDialogData data;
|
|
||||||
|
|
||||||
wxPrintDialog printerDialog(parentWin, &data);
|
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(true);
|
|
||||||
printerDialog.ShowModal();
|
|
||||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
|
void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
@ -1141,11 +1123,6 @@ void wxDocManager::OnUpdatePrint(wxUpdateUIEvent& event)
|
|||||||
event.Enable( (doc != (wxDocument*) NULL) );
|
event.Enable( (doc != (wxDocument*) NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDocManager::OnUpdatePrintSetup(wxUpdateUIEvent& event)
|
|
||||||
{
|
|
||||||
event.Enable( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocManager::OnUpdatePreview(wxUpdateUIEvent& event)
|
void wxDocManager::OnUpdatePreview(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
wxDocument *doc = GetCurrentDocument();
|
wxDocument *doc = GetCurrentDocument();
|
||||||
|
@ -591,18 +591,6 @@ bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlEasyPrinting::PrinterSetup()
|
|
||||||
{
|
|
||||||
wxPrintDialogData printDialogData(*GetPrintData());
|
|
||||||
wxPrintDialog printerDialog(m_ParentWindow, &printDialogData);
|
|
||||||
|
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(true);
|
|
||||||
|
|
||||||
if (printerDialog.ShowModal() == wxID_OK)
|
|
||||||
(*GetPrintData()) = printerDialog.GetPrintDialogData().GetPrintData();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlEasyPrinting::PageSetup()
|
void wxHtmlEasyPrinting::PageSetup()
|
||||||
{
|
{
|
||||||
|
@ -690,8 +690,10 @@ bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data )
|
|||||||
pd->Flags |= PD_PAGENUMS;
|
pd->Flags |= PD_PAGENUMS;
|
||||||
if ( data.GetEnableHelp() )
|
if ( data.GetEnableHelp() )
|
||||||
pd->Flags |= PD_SHOWHELP;
|
pd->Flags |= PD_SHOWHELP;
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
if ( data.GetSetupDialog() )
|
if ( data.GetSetupDialog() )
|
||||||
pd->Flags |= PD_PRINTSETUP;
|
pd->Flags |= PD_PRINTSETUP;
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -747,8 +749,9 @@ bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data )
|
|||||||
data.EnableSelection( ((pd->Flags & PD_NOSELECTION) != PD_NOSELECTION) );
|
data.EnableSelection( ((pd->Flags & PD_NOSELECTION) != PD_NOSELECTION) );
|
||||||
data.EnablePageNumbers( ((pd->Flags & PD_NOPAGENUMS) != PD_NOPAGENUMS) );
|
data.EnablePageNumbers( ((pd->Flags & PD_NOPAGENUMS) != PD_NOPAGENUMS) );
|
||||||
data.EnableHelp( ((pd->Flags & PD_SHOWHELP) == PD_SHOWHELP) );
|
data.EnableHelp( ((pd->Flags & PD_SHOWHELP) == PD_SHOWHELP) );
|
||||||
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
data.SetSetupDialog( ((pd->Flags & PD_PRINTSETUP) == PD_PRINTSETUP) );
|
data.SetSetupDialog( ((pd->Flags & PD_PRINTSETUP) == PD_PRINTSETUP) );
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,57 +764,220 @@ IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
|||||||
wxPageSetupDialog::wxPageSetupDialog()
|
wxPageSetupDialog::wxPageSetupDialog()
|
||||||
{
|
{
|
||||||
m_dialogParent = NULL;
|
m_dialogParent = NULL;
|
||||||
|
m_pageDlg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data)
|
wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data)
|
||||||
{
|
{
|
||||||
Create(p, data);
|
Create(p, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
|
bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
|
||||||
{
|
{
|
||||||
m_dialogParent = p;
|
m_dialogParent = p;
|
||||||
|
m_pageDlg = NULL;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
m_pageSetupData = (*data);
|
m_pageSetupData = (*data);
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
|
||||||
m_pageSetupData.SetOwnerWindow(p);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPageSetupDialog::~wxPageSetupDialog()
|
wxPageSetupDialog::~wxPageSetupDialog()
|
||||||
{
|
{
|
||||||
|
PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageDlg;
|
||||||
|
if ( pd && pd->hDevMode )
|
||||||
|
GlobalFree(pd->hDevMode);
|
||||||
|
if ( pd && pd->hDevNames )
|
||||||
|
GlobalFree(pd->hDevNames);
|
||||||
|
if ( pd )
|
||||||
|
delete pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxPageSetupDialog::ShowModal()
|
int wxPageSetupDialog::ShowModal()
|
||||||
{
|
{
|
||||||
#ifdef __WIN95__
|
ConvertToNative( m_pageSetupData );
|
||||||
m_pageSetupData.ConvertToNative();
|
|
||||||
PAGESETUPDLG *p = (PAGESETUPDLG *)m_pageSetupData.GetNativeData();
|
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
|
||||||
if (m_dialogParent)
|
if (m_dialogParent)
|
||||||
p->hwndOwner = (HWND) m_dialogParent->GetHWND();
|
pd->hwndOwner = (HWND) m_dialogParent->GetHWND();
|
||||||
else if (wxTheApp->GetTopWindow())
|
else if (wxTheApp->GetTopWindow())
|
||||||
p->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
pd->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||||
else
|
else
|
||||||
p->hwndOwner = 0;
|
pd->hwndOwner = 0;
|
||||||
BOOL retVal = PageSetupDlg( p ) ;
|
BOOL retVal = PageSetupDlg( pd ) ;
|
||||||
p->hwndOwner = 0;
|
pd->hwndOwner = 0;
|
||||||
if (retVal)
|
if (retVal)
|
||||||
{
|
{
|
||||||
m_pageSetupData.ConvertFromNative();
|
ConvertFromNative( m_pageSetupData );
|
||||||
return wxID_OK;
|
return wxID_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
#else
|
}
|
||||||
wxGenericPageSetupDialog *genericPageSetupDialog = new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData);
|
|
||||||
int ret = genericPageSetupDialog->ShowModal();
|
bool wxPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
|
||||||
m_pageSetupData = genericPageSetupDialog->GetPageSetupData();
|
{
|
||||||
genericPageSetupDialog->Close(true);
|
wxWindowsPrintNativeData *native_data =
|
||||||
return ret;
|
(wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
|
||||||
#endif
|
data.GetPrintData().ConvertToNative();
|
||||||
|
|
||||||
|
PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageDlg;
|
||||||
|
|
||||||
|
// Shouldn't have been defined anywhere
|
||||||
|
if (pd)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
pd = new PAGESETUPDLG;
|
||||||
|
pd->hDevMode = NULL;
|
||||||
|
pd->hDevNames = NULL;
|
||||||
|
m_pageDlg = (void *)pd;
|
||||||
|
|
||||||
|
// Pass the devmode data (created in m_printData.ConvertToNative)
|
||||||
|
// to the PRINTDLG structure, since it'll
|
||||||
|
// be needed when PrintDlg is called.
|
||||||
|
|
||||||
|
if (pd->hDevMode)
|
||||||
|
{
|
||||||
|
GlobalFree(pd->hDevMode);
|
||||||
|
pd->hDevMode = NULL;
|
||||||
|
}
|
||||||
|
pd->hDevMode = (HGLOBAL) native_data->GetDevMode();
|
||||||
|
native_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!"));
|
||||||
|
|
||||||
|
// Pass the devnames data (created in m_printData.ConvertToNative)
|
||||||
|
// to the PRINTDLG structure, since it'll
|
||||||
|
// be needed when PrintDlg is called.
|
||||||
|
|
||||||
|
if (pd->hDevNames)
|
||||||
|
{
|
||||||
|
GlobalFree(pd->hDevNames);
|
||||||
|
pd->hDevNames = NULL;
|
||||||
|
}
|
||||||
|
pd->hDevNames = (HGLOBAL) native_data->GetDevNames();
|
||||||
|
native_data->SetDevNames((void*) NULL);
|
||||||
|
|
||||||
|
// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
|
||||||
|
|
||||||
|
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
||||||
|
|
||||||
|
if ( data.GetDefaultMinMargins() )
|
||||||
|
pd->Flags |= PSD_DEFAULTMINMARGINS;
|
||||||
|
if ( !data.GetEnableMargins() )
|
||||||
|
pd->Flags |= PSD_DISABLEMARGINS;
|
||||||
|
if ( !data.GetEnableOrientation() )
|
||||||
|
pd->Flags |= PSD_DISABLEORIENTATION;
|
||||||
|
if ( !data.GetEnablePaper() )
|
||||||
|
pd->Flags |= PSD_DISABLEPAPER;
|
||||||
|
if ( !data.GetEnablePrinter() )
|
||||||
|
pd->Flags |= PSD_DISABLEPRINTER;
|
||||||
|
if ( data.GetDefaultInfo() )
|
||||||
|
pd->Flags |= PSD_RETURNDEFAULT;
|
||||||
|
if ( data.GetEnableHelp() )
|
||||||
|
pd->Flags |= PSD_SHOWHELP;
|
||||||
|
|
||||||
|
// We want the units to be in hundredths of a millimetre
|
||||||
|
pd->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS;
|
||||||
|
|
||||||
|
pd->lStructSize = sizeof( PAGESETUPDLG );
|
||||||
|
pd->hwndOwner=(HWND)NULL;
|
||||||
|
// pd->hDevNames=(HWND)NULL;
|
||||||
|
pd->hInstance=(HINSTANCE)NULL;
|
||||||
|
// PAGESETUPDLG is in hundreds of a mm
|
||||||
|
pd->ptPaperSize.x = data.GetPaperSize().x * 100;
|
||||||
|
pd->ptPaperSize.y = data.GetPaperSize().y * 100;
|
||||||
|
|
||||||
|
pd->rtMinMargin.left = data.GetMinMarginTopLeft().x * 100;
|
||||||
|
pd->rtMinMargin.top = data.GetMinMarginTopLeft().y * 100;
|
||||||
|
pd->rtMinMargin.right = data.GetMinMarginBottomRight().x * 100;
|
||||||
|
pd->rtMinMargin.bottom = data.GetMinMarginBottomRight().y * 100;
|
||||||
|
|
||||||
|
pd->rtMargin.left = data.GetMarginTopLeft().x * 100;
|
||||||
|
pd->rtMargin.top = data.GetMarginTopLeft().y * 100;
|
||||||
|
pd->rtMargin.right = data.GetMarginBottomRight().x * 100;
|
||||||
|
pd->rtMargin.bottom = data.GetMarginBottomRight().y * 100;
|
||||||
|
|
||||||
|
pd->lCustData = 0;
|
||||||
|
pd->lpfnPageSetupHook = NULL;
|
||||||
|
pd->lpfnPagePaintHook = NULL;
|
||||||
|
pd->hPageSetupTemplate = NULL;
|
||||||
|
pd->lpPageSetupTemplateName = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ( pd->hDevMode )
|
||||||
|
{
|
||||||
|
DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
|
||||||
|
memset(devMode, 0, sizeof(DEVMODE));
|
||||||
|
devMode->dmSize = sizeof(DEVMODE);
|
||||||
|
devMode->dmOrientation = m_orientation;
|
||||||
|
devMode->dmFields = DM_ORIENTATION;
|
||||||
|
GlobalUnlock(pd->hDevMode);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
|
||||||
|
{
|
||||||
|
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
|
||||||
|
if ( !pd )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
wxWindowsPrintNativeData *native_data =
|
||||||
|
(wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
|
||||||
|
|
||||||
|
// Pass the devmode data back to the wxPrintData structure where it really belongs.
|
||||||
|
if (pd->hDevMode)
|
||||||
|
{
|
||||||
|
if (native_data->GetDevMode())
|
||||||
|
{
|
||||||
|
// Make sure we don't leak memory
|
||||||
|
GlobalFree((HGLOBAL) native_data->GetDevMode());
|
||||||
|
}
|
||||||
|
native_data->SetDevMode( (void*) pd->hDevMode );
|
||||||
|
pd->hDevMode = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Isn't this superfluous? It's called again below.
|
||||||
|
// data.GetPrintData().ConvertFromNative();
|
||||||
|
|
||||||
|
// Pass the devnames data back to the wxPrintData structure where it really belongs.
|
||||||
|
if (pd->hDevNames)
|
||||||
|
{
|
||||||
|
if (native_data->GetDevNames())
|
||||||
|
{
|
||||||
|
// Make sure we don't leak memory
|
||||||
|
GlobalFree((HGLOBAL) native_data->GetDevNames());
|
||||||
|
}
|
||||||
|
native_data->SetDevNames((void*) pd->hDevNames);
|
||||||
|
pd->hDevNames = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.GetPrintData().ConvertFromNative();
|
||||||
|
|
||||||
|
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
||||||
|
|
||||||
|
data.SetDefaultMinMargins( ((pd->Flags & PSD_DEFAULTMINMARGINS) == PSD_DEFAULTMINMARGINS) );
|
||||||
|
data.EnableMargins( ((pd->Flags & PSD_DISABLEMARGINS) != PSD_DISABLEMARGINS) );
|
||||||
|
data.EnableOrientation( ((pd->Flags & PSD_DISABLEORIENTATION) != PSD_DISABLEORIENTATION) );
|
||||||
|
data.EnablePaper( ((pd->Flags & PSD_DISABLEPAPER) != PSD_DISABLEPAPER) );
|
||||||
|
data.EnablePrinter( ((pd->Flags & PSD_DISABLEPRINTER) != PSD_DISABLEPRINTER) );
|
||||||
|
data.SetDefaultInfo( ((pd->Flags & PSD_RETURNDEFAULT) == PSD_RETURNDEFAULT) );
|
||||||
|
data.EnableHelp( ((pd->Flags & PSD_SHOWHELP) == PSD_SHOWHELP) );
|
||||||
|
|
||||||
|
// PAGESETUPDLG is in hundreds of a mm
|
||||||
|
data.SetPaperSize( wxSize(pd->ptPaperSize.x / 100, pd->ptPaperSize.y / 100) );
|
||||||
|
|
||||||
|
data.SetMinMarginTopLeft( wxPoint(pd->rtMinMargin.left / 100, pd->rtMinMargin.top / 100) );
|
||||||
|
data.SetMinMarginBottomRight( wxPoint(pd->rtMinMargin.right / 100, pd->rtMinMargin.bottom / 100) );
|
||||||
|
|
||||||
|
data.SetMarginTopLeft( wxPoint(pd->rtMargin.left / 100, pd->rtMargin.top / 100) );
|
||||||
|
data.SetMarginBottomRight( wxPoint(pd->rtMargin.right / 100, pd->rtMargin.bottom / 100) );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -308,6 +308,8 @@ wxDC* wxWindowsPrinter::PrintDialog(wxWindow *parent)
|
|||||||
|
|
||||||
bool wxWindowsPrinter::Setup(wxWindow *parent)
|
bool wxWindowsPrinter::Setup(wxWindow *parent)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
// We no longer expose that dialog
|
||||||
wxPrintDialog dialog(parent, & m_printDialogData);
|
wxPrintDialog dialog(parent, & m_printDialogData);
|
||||||
dialog.GetPrintDialogData().SetSetupDialog(true);
|
dialog.GetPrintDialogData().SetSetupDialog(true);
|
||||||
|
|
||||||
@ -319,6 +321,9 @@ bool wxWindowsPrinter::Setup(wxWindow *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (ret == wxID_OK);
|
return (ret == wxID_OK);
|
||||||
|
#else
|
||||||
|
return wxID_CANCEL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user