Fix compilation if configured with --disable-printarch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Tim Kosse
2014-07-04 12:43:26 +00:00
parent 0445ddf58d
commit b60b063163
2 changed files with 26 additions and 2 deletions

View File

@@ -213,10 +213,12 @@ public:
void CreateStyles();
wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
wxRichTextPrinting* GetPrinting() const { return m_printing; }
wxRichTextStyleSheet* m_styleSheet;
#if wxUSE_PRINTING_ARCHITECTURE
wxRichTextPrinting* GetPrinting() const { return m_printing; }
wxRichTextPrinting* m_printing;
#endif
};
// Define a new frame type: this is going to be our main frame
@@ -303,8 +305,10 @@ public:
void OnURL(wxTextUrlEvent& event);
void OnStyleSheetReplacing(wxRichTextEvent& event);
#if wxUSE_PRINTING_ARCHITECTURE
void OnPrint(wxCommandEvent& event);
void OnPreview(wxCommandEvent& event);
#endif
void OnPageSetup(wxCommandEvent& event);
void OnInsertImage(wxCommandEvent& event);
@@ -479,8 +483,10 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_SWITCH_STYLE_SHEETS, MyFrame::OnSwitchStyleSheets)
EVT_MENU(ID_MANAGE_STYLES, MyFrame::OnManageStyles)
#if wxUSE_PRINTING_ARCHITECTURE
EVT_MENU(ID_PRINT, MyFrame::OnPrint)
EVT_MENU(ID_PREVIEW, MyFrame::OnPreview)
#endif
EVT_MENU(ID_PAGE_SETUP, MyFrame::OnPageSetup)
EVT_TEXT_URL(wxID_ANY, MyFrame::OnURL)
@@ -516,10 +522,12 @@ bool MyApp::OnInit()
#endif
m_styleSheet = new wxRichTextStyleSheet;
#if wxUSE_PRINTING_ARCHITECTURE
m_printing = new wxRichTextPrinting(wxT("Test Document"));
m_printing->SetFooterText(wxT("@TITLE@"), wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE);
m_printing->SetFooterText(wxT("Page @PAGENUM@"), wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_RIGHT);
#endif
CreateStyles();
@@ -570,7 +578,9 @@ bool MyApp::OnInit()
size.Scale(0.75, 0.75);
MyFrame *frame = new MyFrame(wxT("wxRichTextCtrl Sample"), wxID_ANY, wxDefaultPosition, size);
#if wxUSE_PRINTING_ARCHITECTURE
m_printing->SetParentWindow(frame);
#endif
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
@@ -584,7 +594,9 @@ bool MyApp::OnInit()
int MyApp::OnExit()
{
#if wxUSE_PRINTING_ARCHITECTURE
delete m_printing;
#endif
delete m_styleSheet;
return 0;
@@ -769,8 +781,10 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
fileMenu->Append(ID_RELOAD, wxT("&Reload Text\tF2"), wxT("Reload the initial text"));
fileMenu->AppendSeparator();
fileMenu->Append(ID_PAGE_SETUP, wxT("Page Set&up..."), wxT("Page setup"));
#if wxUSE_PRINTING_ARCHITECTURE
fileMenu->Append(ID_PRINT, wxT("&Print...\tCtrl+P"), wxT("Print"));
fileMenu->Append(ID_PREVIEW, wxT("Print Pre&view"), wxT("Print preview"));
#endif
fileMenu->AppendSeparator();
fileMenu->Append(ID_VIEW_HTML, wxT("&View as HTML"), wxT("View HTML"));
fileMenu->AppendSeparator();
@@ -2082,6 +2096,7 @@ void MyFrame::OnStyleSheetReplacing(wxRichTextEvent& event)
event.Veto();
}
#if wxUSE_PRINTING_ARCHITECTURE
void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().GetPrinting()->PrintBuffer(m_richTextCtrl->GetBuffer());
@@ -2091,6 +2106,7 @@ void MyFrame::OnPreview(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().GetPrinting()->PreviewBuffer(m_richTextCtrl->GetBuffer());
}
#endif
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
{

View File

@@ -387,7 +387,9 @@ class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext
public:
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc );
#if wxUSE_PRINTING_ARCHITECTURE
wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc );
#endif
#ifdef __WXGTK__
wxCairoContext( wxGraphicsRenderer* renderer, GdkWindow *window );
#endif
@@ -1640,6 +1642,7 @@ public :
bool m_offset;
} ;
#if wxUSE_PRINTING_ARCHITECTURE
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc )
: wxGraphicsContext(renderer)
{
@@ -1684,6 +1687,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC&
org = dc.GetLogicalOrigin();
cairo_translate( m_context, -org.x, -org.y );
}
#endif
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc )
: wxGraphicsContext(renderer)
@@ -2336,7 +2340,9 @@ public :
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
@@ -2429,11 +2435,13 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc)
return new wxCairoContext(this,dc);
}
#if wxUSE_PRINTING_ARCHITECTURE
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc)
{
ENSURE_LOADED_OR_RETURN(NULL);
return new wxCairoContext(this, dc);
}
#endif
#ifdef __WXMSW__
#if wxUSE_ENH_METAFILE